![]() |
Allocators
|
A non-owning reference to a buffer. More...
#include <buffer_ref.hpp>
Public Member Functions | |
template<typename pointer_type > | |
buffer_ref (pointer_type *data, size_t length) | |
Creates a reference through a pointer and length. More... | |
template<typename pointer_type > | |
buffer_ref (const pointer_type *data, size_t length) | |
Creates a reference through const pointer and length. More... | |
template<typename pointer_type > | |
buffer_ref (pointer_type *pointer) | |
Creates a buffer reference from a type pointer. More... | |
buffer_ref (const memory_block &block) | |
Creates a buffer reference from a memory block definition. More... | |
buffer_ref (const std::string &s) | |
Creates a buffer reference for a string. More... | |
template<typename reference_type > | |
reference_type | as () |
Obtains a reference to the underlying memory block treating it as the given reference_type. More... | |
template<typename pointer_type > | |
pointer_type | as_pointer () |
Obtains a reference to the underlying memory block treating it as a representation of the given pointer_type. More... | |
size_t | length () const |
Number of bytes in the buffer. | |
buffer_ref | subbuf (size_t length) const |
Obtains a sub buffer with the given size. More... | |
A non-owning reference to a buffer.
A buffer reference provides a range of utilities for describing a buffer - like pointer to memory block where the buffer data resides and length of the data. Additionally methods for accessing the data from the buffer are provided.
Definition at line 18 of file buffer_ref.hpp.
|
inline |
Creates a reference through a pointer and length.
data | A pointer to memory location. |
length | Number of bytes in the buffer. |
Definition at line 9 of file buffer_ref.ipp.
Referenced by subbuf().
|
inline |
Creates a reference through const pointer and length.
data | A pointer to memory block. |
length | Length of the block. |
Definition at line 20 of file buffer_ref.ipp.
|
inline |
Creates a buffer reference from a type pointer.
Creates buffer holds a pointer given in the constructor and length of the type passed in the constructor.
pointer | A pointer to a type. |
Definition at line 31 of file buffer_ref.ipp.
|
inline |
Creates a buffer reference from a memory block definition.
reference | A memory_block the buffer is pointing at. |
Definition at line 39 of file buffer_ref.ipp.
|
inline |
Creates a buffer reference for a string.
s | A string to get the buffer definition from. |
Definition at line 47 of file buffer_ref.ipp.
|
inline |
Obtains a reference to the underlying memory block treating it as the given reference_type.
Definition at line 56 of file buffer_ref.ipp.
|
inline |
Obtains a reference to the underlying memory block treating it as a representation of the given pointer_type.
Definition at line 67 of file buffer_ref.ipp.
|
inline |
Obtains a sub buffer with the given size.
length | The size of sub buffer. |
Definition at line 79 of file buffer_ref.ipp.