|
|
This class can be used to conveniently store data. Note: currently it has limited functionalities; more will be added in the future.
explicit Buffer (size_t init_max_size)
| Buffer |
Constructor of a buffer of specified size.
Parameters:
init_max_size | the maximum amount of data that can be stored in the buffer. |
~Buffer ()
| ~Buffer |
void reset ()
| reset |
Reset/remove the data in the buffer.
size_t max_size ()
| max_size |
[const]
Returns: the maximum amount of data that can be stored in the buffer.
size_t data_size ()
| data_size |
[const]
Returns: the amount of data in the buffer.
uint8_t data (size_t offset)
throw (InvalidBufferOffset) | data |
[const]
Get the data value of the octet at the specified offset.
Parameters:
offset | the data offset from the beginning of the buffer. |
Returns: the data value at offset.
uint8_t * data ()
| data |
Returns: a pointer to the data in the buffer.
int add_data (uint8_t value)
| add_data |
Add a data octet to the buffer.
Parameters:
value | the value of the data octet to add to the buffer. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
bool is_full ()
| is_full |
[const]
Test if the buffer is full.
Returns: true if the buffer is full, otherwise false.