#include <Buffer.hh>
Public Types | |
typedef std::vector< unsigned char > | DataVector |
The data vector used for internal buffer representation. | |
Public Member Functions | |
Buffer (u64 size=0) | |
Default constructor. | |
void | swap (Buffer &buffer) |
Swap the contents of two buffers efficiently. | |
u64 | size () const |
Return the size of the buffer in bytes. | |
void | resize (u64 size) |
Resize the buffer. | |
u32 | read_pos (u64 byte_pos, unsigned int bit_offset, unsigned int bits) const |
Read value from the buffer. | |
u32 | read_elem (u64 elem, unsigned int bits_per_elem) const |
Read element at a given fixed-width element. | |
void | write_pos (u64 byte_pos, unsigned int bit_offset, u32 value, unsigned int bits) |
Write value in the buffer. | |
void | write_elem (u64 elem, unsigned int bits_per_elem, u32 value) |
Write value in the buffer in the place of given fixed-width element. | |
const unsigned char * | data () const |
Const access the internal data buffer. | |
unsigned char * | data () |
Access the internal data buffer. | |
Private Attributes | |
DataVector | m_data |
Buffer containing the actual bit data. |
The size of the buffer must be less than 2^64 bits.
|
The data vector used for internal buffer representation.
|
|
Default constructor.
|
|
Access the internal data buffer. It is safe to write and read the first size() bytes of the pointer. Note, that resize() and swap may invalidate the pointer. |
|
Const access the internal data buffer. It is safe to write and read the first size() bytes of the pointer. Note, that resize() and swap may invalidate the pointer. |
|
Read element at a given fixed-width element.
|
|
Read value from the buffer.
|
|
Resize the buffer. Growing the buffer does not invalidate buffer contents. If the buffer is grown, the new values are initialized to zero.
|
|
Return the size of the buffer in bytes.
|
|
Swap the contents of two buffers efficiently. Invalidates pointers returned earlier by the data() method. |
|
Write value in the buffer in the place of given fixed-width element.
|
|
Write value in the buffer.
|
|
Buffer containing the actual bit data.
|