|
OSVR-Core
|
A buffer of bytes, built on a byte-vector-like container. More...
#include <Buffer.h>
Public Types | |
| typedef ContainerType::value_type | ElementType |
| The (necessarily byte-size) type of elements in the underlying container. More... | |
| typedef BufferReader< ContainerType > | Reader |
| The corresponding BufferReader type. | |
Public Member Functions | |
| Buffer () | |
| Constructs an empty buffer. | |
| Buffer (ContainerType const &buf) | |
| Constructs a buffer wrapper by copy-constructing the contained type. More... | |
| template<typename InputIterator > | |
| Buffer (InputIterator beginIt, InputIterator endIt) | |
| Constructs a buffer by copying from two input iterators, representing a half-open range [beginIt, endIt) More... | |
| template<typename T > | |
| void | append (T const v) |
| Append the binary representation of a value. More... | |
| template<typename T > | |
| void | appendAligned (T const v, size_t const alignment) |
| Append the binary representation of a value, after adding the necessary number of padding bytes to begin the write at the given alignment within the buffer. More... | |
| void | append (ElementType const *v, size_t const n) |
| Append a byte-array's contents. | |
| void | appendAligned (ElementType const *v, size_t const n, size_t const alignment) |
| Append a byte-array's contents, after adding the necessary number of padding bytes to begin the write at the given alignment within the buffer. More... | |
| void | appendPadding (size_t const bytes) |
| Append the specified number of bytes of padding. | |
| Reader | startReading () const |
| Returns a reader object, for making a single read pass over the buffer. More... | |
| size_t | size () const |
| Gets the current size, in bytes. | |
| ContainerType & | getContents () |
| Provides access to the underlying container. | |
| ElementType const * | data () const |
| Provides access to the underlying data. | |
A buffer of bytes, built on a byte-vector-like container.
Provides methods for easily appending to the buffer (including alignment padding), and a nested class for reading from such a buffer.
| typedef ContainerType::value_type osvr::common::Buffer< ContainerType >::ElementType |
The (necessarily byte-size) type of elements in the underlying container.
|
inlineexplicit |
Constructs a buffer wrapper by copy-constructing the contained type.
|
inline |
Constructs a buffer by copying from two input iterators, representing a half-open range [beginIt, endIt)
Passed directly to contained type, so semantics are identical.
|
inline |
Append the binary representation of a value.
The value cannot be a pointer here.
Safe to do without violating strict aliasing because ElementType is a character type.
|
inline |
Append the binary representation of a value, after adding the necessary number of padding bytes to begin the write at the given alignment within the buffer.
The value cannot be a pointer here.
|
inline |
Append a byte-array's contents, after adding the necessary number of padding bytes to begin the write at the given alignment within the buffer.
|
inline |
Returns a reader object, for making a single read pass over the buffer.
Do not modify this buffer during the lifetime of a reader!
1.8.12