Public Member Functions | |
BoundedFIFO (int maxSize) | |
spi::LoggingEventPtr | get () |
void | put (const spi::LoggingEventPtr &o) |
int | getMaxSize () const |
bool | isFull () const |
int | length () const |
void | resize (int newSize) |
bool | wasEmpty () const |
bool | wasFull () const |
BoundedFIFO
serves as the bounded first-in-first-out buffer heavily used by the AsyncAppender.
BoundedFIFO | ( | int | maxSize | ) |
Instantiate a new BoundedFIFO with a maximum size passed as argument.
LoggingEventPtr get | ( | ) |
Get the first element in the buffer. Returns null
if there are no elements in the buffer.
void put | ( | const spi::LoggingEventPtr & | o | ) |
Place a LoggingEvent in the buffer. If the buffer is full then the event is silently dropped. It is the caller's responsability to make sure that the buffer has free space.
int getMaxSize | ( | ) | const [inline] |
Get the maximum size of the buffer.
bool isFull | ( | ) | const [inline] |
Return true
if the buffer is full, i.e. of the number of elements in the buffer equals the buffer size.
int length | ( | ) | const [inline] |
Get the number of elements in the buffer. This number is guaranteed to be in the range 0 to maxSize
(inclusive).
void resize | ( | int | newSize | ) |
Resize the buffer to a new size. If the new size is smaller than the old size events might be lost.
bool wasEmpty | ( | ) | const [inline] |
Returns true
if there is just one element in the buffer. In other words, if there were no elements before the last put operation completed.
bool wasFull | ( | ) | const [inline] |
Returns true
if the number of elements in the buffer plus 1 equals the maximum buffer size, returns false
otherwise.