|
Apache Log4cxx
Version 1.7.0
|
An area of memory and a cursor into that memory. More...
#include <bytebuffer.h>
Public Member Functions | |
| ByteBuffer (char *data, size_t capacity) | |
A capacity sized area of memory at data. | |
| ~ByteBuffer () | |
| void | carry () |
| Move the remaining bytes to the start of the memory area and set the cursor to the end of the those bytes. | |
| void | clear () |
| Set the cursor to the start of the memory area and use the capacity as the extent to which the cursor can advance. | |
| void | flip () |
Set the extent to which the cursor can advance, limit(), to the current cursor position and move the cursor to the start of the memory area. | |
| char * | data () |
| The start of the memory area. | |
| const char * | data () const |
| The start of the memory area. | |
| char * | current () |
| The memory at the cursor position. | |
| const char * | current () const |
| The memory at the cursor position. | |
| size_t | limit () const |
| The extent to which the cursor can advance as an offset from the start of the memory area. | |
| void | limit (size_t newLimit) |
Use newLimit as the extent to which the cursor can advance. | |
| size_t | position () const |
| The offset of the current cursor from the start of the memory area. | |
| size_t | remaining () const |
| The number of bytes from the current cursor until the cursor can no longer advance. | |
| void | position (size_t newPosition) |
Use newPosition as the cursor position providing it is less than the extent to which the cursor can advance, otherwise set the cursor to the extent to which the cursor can advance. | |
| size_t | increment_position (size_t byteCount) |
Advance the cursor by byteCount if that does not exceed the extent to which the cursor can advance, otherwise set the cursor to the extent to which the cursor can advance. | |
| bool | put (char byteValue) |
Store byteValue at the cursor position and advance the cursor position unless the cursor cannot advance any further. | |
An area of memory and a cursor into that memory.
Provides the remaining bytes available for storage or to be processed.
The flip method switches its role from being a space for storage to being a collection of bytes to be processed.
The carry method switches it back to being a space for storage, while retaining any unprocessed bytes.
It does not own the memory, so does not allocate or free memory. The user must ensure the lifetime of the memory exceeds the lifeime of the class instance.
| log4cxx::helpers::ByteBuffer::ByteBuffer | ( | char * | data, |
| size_t | capacity ) |
A capacity sized area of memory at data.
| log4cxx::helpers::ByteBuffer::~ByteBuffer | ( | ) |
| void log4cxx::helpers::ByteBuffer::carry | ( | ) |
Move the remaining bytes to the start of the memory area and set the cursor to the end of the those bytes.
| void log4cxx::helpers::ByteBuffer::clear | ( | ) |
Set the cursor to the start of the memory area and use the capacity as the extent to which the cursor can advance.
| char * log4cxx::helpers::ByteBuffer::current | ( | ) |
The memory at the cursor position.
| const char * log4cxx::helpers::ByteBuffer::current | ( | ) | const |
The memory at the cursor position.
| char * log4cxx::helpers::ByteBuffer::data | ( | ) |
The start of the memory area.
| const char * log4cxx::helpers::ByteBuffer::data | ( | ) | const |
The start of the memory area.
| void log4cxx::helpers::ByteBuffer::flip | ( | ) |
Set the extent to which the cursor can advance, limit(), to the current cursor position and move the cursor to the start of the memory area.
| size_t log4cxx::helpers::ByteBuffer::increment_position | ( | size_t | byteCount | ) |
Advance the cursor by byteCount if that does not exceed the extent to which the cursor can advance, otherwise set the cursor to the extent to which the cursor can advance.
| size_t log4cxx::helpers::ByteBuffer::limit | ( | ) | const |
The extent to which the cursor can advance as an offset from the start of the memory area.
Intially this is the capacity of the buffer.
| void log4cxx::helpers::ByteBuffer::limit | ( | size_t | newLimit | ) |
Use newLimit as the extent to which the cursor can advance.
If newLimit exceeds the memory capacity, an exception is thrown. If the current cursor is currently beyond newLimit the cursor is changed to be at newLimit.
| size_t log4cxx::helpers::ByteBuffer::position | ( | ) | const |
The offset of the current cursor from the start of the memory area.
| void log4cxx::helpers::ByteBuffer::position | ( | size_t | newPosition | ) |
Use newPosition as the cursor position providing it is less than the extent to which the cursor can advance, otherwise set the cursor to the extent to which the cursor can advance.
| bool log4cxx::helpers::ByteBuffer::put | ( | char | byteValue | ) |
Store byteValue at the cursor position and advance the cursor position unless the cursor cannot advance any further.
byteValue was stored in the buffer. | size_t log4cxx::helpers::ByteBuffer::remaining | ( | ) | const |
The number of bytes from the current cursor until the cursor can no longer advance.