#include <Buffer.h>
Public Member Functions | |
Constructors & destructor | |
Buffer (std::size_t capacity=512) | |
Buffer (const Buffer &rhs) | |
virtual | ~Buffer () |
Assignment operator | |
Buffer & | operator= (const Buffer &rhs) |
Accessing buffer properties | |
std::size_t | capacity () const |
std::size_t | size () const |
Storing data values | |
void | put_id (const ident_t &id) |
void | put_time (const timestamp_t ×tamp) |
void | put_uint32 (const uint32_t &value) |
void | put_double (const double &value) |
void | put_event (const Event &event) |
Retrieving data values | |
ident_t | get_id () |
timestamp_t | get_time () |
uint32_t | get_uint32 () |
double | get_double () |
RemoteEvent | get_event (const GlobalDefs &defs) |
Protected Attributes | |
std::size_t | m_capacity |
Current buffer capacity. | |
std::size_t | m_size |
Current usage of buffer. | |
std::size_t | m_position |
Current read position. | |
uint8_t * | m_data |
Pointer to the actual data. |
Buffer | ( | std::size_t | capacity = 512 |
) |
Creates a new buffer instance with the given capacity, which has to be at least 1 byte (default: 512).
capacity | Initial capacity |
Copy constructor. Creates a new instance and initializes its data with the contents of the given buffer rhs (deep copy).
rhs | Source operand |
~Buffer | ( | ) | [virtual] |
Destructor. Destroys the instance and releases all occupied resources.
size_t capacity | ( | ) | const |
double get_double | ( | ) |
Returns the double-precision floating-point value store in the buffer at the current read position.
RemoteEvent get_event | ( | const GlobalDefs & | defs | ) |
Returns a new instance of RemoteEvent, initialized with the data stored in the buffer at the current read position.
defs | GlobalDefs instance providing the corresponding global definition data. |
ident_t get_id | ( | ) |
Returns the identifier stored in the buffer at the current read position.
timestamp_t get_time | ( | ) |
Returns the timestamp stored in the buffer at the current read position.
uint32_t get_uint32 | ( | ) |
Returns the 32-bit unsigned integer value stored in the buffer at the current read position.
Assignment operator. Creates a deep copy of the given argument rhs.
rhs | Source operand |
void put_double | ( | const double & | value | ) |
Appends the given double-precision floating-point value to the buffer. If not enough buffer space is available, the buffer will be automatically resized.
value | Value to be appended |
void put_event | ( | const Event & | event | ) |
Appends the data of the given event to the buffer. If not enough buffer space is available, the buffer will be automatically resized.
event | Event to be written to the buffer |
void put_id | ( | const ident_t & | id | ) |
Appends the given id to the buffer. If not enough buffer space is available, the buffer will be automatically resized.
id | Identifier to be appended |
void put_time | ( | const timestamp_t & | timestamp | ) |
Appends the given timestamp to the buffer. If not enough buffer space is available, the buffer will be automatically resized.
timestamp | Timestamp to be appended |
void put_uint32 | ( | const uint32_t & | value | ) |
Appends the given unsigned 32-bit integer value to the buffer. If not enough buffer space is available, the buffer will be automatically resized.
value | Value to be appended |
size_t size | ( | ) | const |
![]() |
Copyright © 1998–2009 Forschungszentrum Jülich, Jülich Supercomputing Centre |