33 #ifndef __H__UG__binary_buffer__
34 #define __H__UG__binary_buffer__
86 inline void read(
char* buf,
size_t size);
90 inline void write(
const char* buf,
size_t size);
A Buffer for binary data.
Definition: binary_buffer.h:56
size_t read_pos() const
returns the current read-pos (in bytes)
Definition: binary_buffer_impl.h:48
char * buffer()
returns the raw buffer pointer or NULL if the buffer is empty (capacity() == 0)
Definition: binary_buffer_impl.h:94
size_t capacity() const
returns the capacity (reserved memory) of the buffer
Definition: binary_buffer_impl.h:43
void set_write_pos(size_t pos)
sets the write position.
Definition: binary_buffer.cpp:69
size_t m_readPos
Definition: binary_buffer.h:106
void reserve(size_t newSize)
resizes the associated buffer to the given size.
Definition: binary_buffer.cpp:58
void read(char *buf, size_t size)
reads data of the given size (in bytes)
Definition: binary_buffer_impl.h:58
BinaryBuffer()
Definition: binary_buffer.cpp:38
size_t m_writePos
Definition: binary_buffer.h:107
void set_read_pos(size_t pos)
sets the read position (in bytes).
Definition: binary_buffer.cpp:64
void clear()
clears the buffer
Definition: binary_buffer.cpp:48
size_t write_pos() const
returns the current write-pos (in bytes)
Definition: binary_buffer_impl.h:53
std::vector< char > m_data
Definition: binary_buffer.h:105
bool eof()
returns true if the read-position reached the write-position
Definition: binary_buffer_impl.h:99
void write(const char *buf, size_t size)
writes data of the given size (in bytes)
Definition: binary_buffer_impl.h:71