Class representing a general-use automatically managed/resized buffer. More...
#include <buffer.hpp>
Public Member Functions | |
| Buffer () | |
| Creates an empty buffer. More... | |
| Buffer (size_t size) | |
| Creates a buffer with pre-allocated size. More... | |
| Buffer (const void *buf, size_t length) | |
| Create a buffer by copying the supplied data from a const buffer. More... | |
| template<class InputIterator > | |
| Buffer (InputIterator first, InputIterator last) | |
| Create a buffer by copying the supplied data using iterator interface. More... | |
| uint8_t * | get () |
| Get pointer to the first byte of the buffer. More... | |
| uint8_t * | buf () |
| Get pointer to the first byte of the buffer (alternative version) More... | |
| template<class T > | |
| T * | get () |
| Get pointer to the first byte of the buffer and cast it (reinterpret_cast) to the requested type T. More... | |
| const uint8_t * | buf () const |
| Get pointer to the first byte of the buffer (alternative version) More... | |
| const uint8_t * | get () const |
| Get const pointer to the first byte of the buffer. More... | |
| template<class T > | |
| const T * | get () const |
| Get const pointer to the first byte of the buffer and cast it (reinterpret_cast) to the requested type T. More... | |
Data Fields | |
| T | elements |
| STL member. More... | |
Class representing a general-use automatically managed/resized buffer.
In most respect, Buffer class is equivalent to std::vector<uint8_t> and is in fact uses it as a base class. In addition to that, it provides buf() and buf<T>() helper method for easier access to the underlying data (buf<T>() casts pointer to the requested class)
Definition at line 28 of file buffer.hpp.
|
inline |
Creates an empty buffer.
Definition at line 34 of file buffer.hpp.
|
inlineexplicit |
Creates a buffer with pre-allocated size.
| size | size of the buffer to be allocated |
Definition at line 43 of file buffer.hpp.
|
inline |
Create a buffer by copying the supplied data from a const buffer.
| buf | const pointer to buffer |
| length | length of the buffer to copy |
Definition at line 53 of file buffer.hpp.
|
inline |
Create a buffer by copying the supplied data using iterator interface.
Note that the supplied iterators must be compatible with std::vector<uint8_t> interface
| first | iterator to a first element to copy |
| last | iterator to an element immediately following the last element to copy |
Definition at line 68 of file buffer.hpp.
|
inline |
Get pointer to the first byte of the buffer (alternative version)
Definition at line 86 of file buffer.hpp.
|
inline |
Get pointer to the first byte of the buffer (alternative version)
Definition at line 106 of file buffer.hpp.
|
inline |
Get pointer to the first byte of the buffer.
Definition at line 77 of file buffer.hpp.
|
inline |
Get pointer to the first byte of the buffer and cast it (reinterpret_cast) to the requested type T.
Definition at line 97 of file buffer.hpp.
|
inline |
Get const pointer to the first byte of the buffer.
Definition at line 115 of file buffer.hpp.
|
inline |
Get const pointer to the first byte of the buffer and cast it (reinterpret_cast) to the requested type T.
Definition at line 126 of file buffer.hpp.
|
inherited |
STL member.