RTC Toolkit
2.0.0
|
Implementation of buffer (ring) that allows to have preallocated slots of type T. More...
#include <repubBuf.hpp>
Public Member Functions | |
RepubBuf (const std::string &id, uint16_t size) | |
Create buffer with: More... | |
RepubBuf (const char *id, uint16_t size) | |
Create buffer with: More... | |
RepubBuf (uint16_t size) | |
Create buffer without identifier, but with. More... | |
~RepubBuf () noexcept | |
RepubBuf (RepubBuf &&rhs)=delete | |
RepubBuf & | operator= (RepubBuf &&rhs)=delete |
T * | GetNextFree () |
Returns next free slot of the buffer. More... | |
void | MakeAvailable () |
Returns back (filled/set) slot that has been retrieved by GetNextFree. More... | |
void | ReleaseFree () |
Release slot (not filled/set) that has been retrieved by GetNextFree. More... | |
T * | GetNextAvail () |
Returns next available (filled/set) slot. More... | |
T * | WaitNextAvail () |
The call blocks (waits) for next available (filled/set) slot. More... | |
void | MakeFree () |
Returns back slot that has been retrived/given by call WaitNextAvail or GetNextAvail. More... | |
void | ReleaseWait () |
Release WaitNextAvail. More... | |
uint16_t | GetFreeCapacity () |
Number of free slots in buffer that can be retrieved by calling GetNextFree. More... | |
uint16_t | GetAvail () |
Number of availabel (occupied) (filled/set) slots in buffer that can be retrieved by calling WaitNextAvail or GetNextAvail. More... | |
void | DumpStatistic () |
Dumps statistic(s): maximum occupancy of the buffer. More... | |
uint16_t | GetMaxOccupancy () |
Returns maximal occupancy of the buffer. More... | |
uint16_t | GetSize () |
Returns (maximal) queue/buffer. More... | |
Implementation of buffer (ring) that allows to have preallocated slots of type T.
Buffer allows that a producer takes (gets) a free slot i.e. slot that is already allocated, but the value is not set. Producer can set value of the slot and retrun it back, and make it available for consumption. It is implemented with assumption that it is taken just one free slot at the time i.e. the next free slot is requested after the previos one is returned i.e makdae available for consumption. A consumer can in similar way request next available slot i.e. slot that has already set value. Again here the next avilabel slot can be requested after the previos one is returned. It can use it and after return it back to be available as free slot. The buffer is implemented for one producer and one consumer use case.
|
inline |
Create buffer with:
id | identifier |
size | size |
|
inline |
Create buffer with:
id | identifier |
size | size |
|
inline |
Create buffer without identifier, but with.
size | size |
|
inlinenoexcept |
|
delete |
|
inline |
Dumps statistic(s): maximum occupancy of the buffer.
It is not thread safe as it is forseen to be used just at the end of usage of the buffer.
|
inline |
Number of availabel (occupied) (filled/set) slots in buffer that can be retrieved by calling WaitNextAvail or GetNextAvail.
|
inline |
Number of free slots in buffer that can be retrieved by calling GetNextFree.
|
inline |
Returns maximal occupancy of the buffer.
|
inline |
Returns next available (filled/set) slot.
Call does not block i.e. wait.
|
inline |
Returns next free slot of the buffer.
Which can be filled, and returned back by callling MakeAvailable
|
inline |
Returns (maximal) queue/buffer.
|
inline |
Returns back (filled/set) slot that has been retrieved by GetNextFree.
Buffer slot is available to be retrieved by calling GetNextAvail e.g. for publishing.
|
inline |
Returns back slot that has been retrived/given by call WaitNextAvail or GetNextAvail.
The slot is after available as free slot and can be returned by GetNextFree
|
delete |
|
inline |
Release slot (not filled/set) that has been retrieved by GetNextFree.
It can be used in case when we retrieved a slot by GetNextFree, but we do not want to return the slot filled. This can be the case at stop. The released slot is available for next GetNextFree, and no buffer slot is available to GetNextAvail, but it is avail
|
inline |
Release WaitNextAvail.
|
inline |
The call blocks (waits) for next available (filled/set) slot.
It returns when next availabe (filled/set) slot is there. Alternatively can be relased by calling ReleaseWait.