Public Member Functions | |
CyclicBuffer (int maxSize) | |
void | add (const spi::LoggingEventPtr &event) |
spi::LoggingEventPtr | get (int i) |
spi::LoggingEventPtr | get () |
int | length () const |
void | resize (int newSize) |
This buffer gives read access to any element in the buffer not just the first or last element.
CyclicBuffer | ( | int | maxSize | ) |
Instantiate a new CyclicBuffer of at most maxSize
events. The maxSize
argument must a positive integer.
maxSize | The maximum number of elements in the buffer. |
IllegalArgumentException | if maxSize is negative. |
maxSize
events. The maxSize
argument must a positive integer. maxSize | The maximum number of elements in the buffer. |
void add | ( | const spi::LoggingEventPtr & | event | ) |
Add an event
as the last event in the buffer.
Add an event
as the last event in the buffer.
spi::LoggingEventPtr get | ( | int | i | ) |
Get the ith oldest event currently in the buffer. If i is outside the range 0 to the number of elements currently in the buffer, then null
is returned.
Get the ith oldest event currently in the buffer. If i is outside the range 0 to the number of elements currently in the buffer, then null
is returned.
spi::LoggingEventPtr get | ( | ) |
Get the oldest (first) element in the buffer. The oldest element is removed from the buffer.
Get the oldest (first) element in the buffer. The oldest element is removed from the buffer.
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 cyclic buffer to newSize
.
IllegalArgumentException | if newSize is negative. |
newSize
. IllegalArgumentException | if newSize is negative. |