Scanframe Modular Application 0.1.0
|
Template for creating a dynamic buffer using an allocator. More...
#include <TDynamicBuffer.h>
Public Member Functions | |
TDynamicBuffer () | |
Default constructor. | |
TDynamicBuffer (const TDynamicBuffer &db) | |
Copy constructor. | |
TDynamicBuffer (size_t sz) | |
Initializing constructor. | |
~TDynamicBuffer () | |
Destructor. | |
void | reserve (size_t sz, bool shrink=false) |
Reserves the array but does leave the data in tact. | |
void | resize (size_t sz, bool shrink=false) |
Resizes the array but does leave the data in tact. | |
void | offset (size_t ofs) |
Sets an virtual offset to the buffer. | |
size_t | offset () const |
Returns the current offset. | |
size_t | size () |
Returns the byte size of the buffer. | |
size_t | size () const |
Returns the byte size of the buffer. | |
size_t | reserved () const |
Gets the reserved size of this instance. | |
void * | data () |
Gets a void pointer to the start of the buffer. | |
const void * | data () const |
char * | c_str () |
Gets a character pointer to the start of the buffer. | |
const char * | c_str () const |
Gets a const character pointer to the start of the buffer. | |
template<typename T > | |
T * | ptr (size_t offset=0) |
Gets a typed pointer to the specified given offset the start of the buffer. | |
template<typename T > | |
const T * | ptr (size_t offset=0) const |
Gets a typed pointer to the specified given offset the start of the buffer. | |
void | grow (size_t sz) |
Grows the array to the specified size but keeps the current data intact. | |
void | zero (bool reserved=false) |
void | set (int c=0, bool reserved=false) |
Sets all memory to the given character. When reserved is true not only the current size but all of it. | |
void * | data (size_t offset) |
Gets a void pointer with a byte offset from the start. | |
const void * | data (size_t offset) const |
Gets a const void pointer with a byte offset from the start. | |
operator void * () | |
Cast operator to void pointer. | |
operator const char * () const | |
Const cast operators to pointer. | |
operator char * () | |
Cast operator to a character pointer. | |
operator const void * () const | |
Const cast operator to void pointer. | |
char & | operator[] (size_t i) |
Character array operator to access a single byte element. | |
char | operator[] (size_t i) const |
Const character array operator to access a single byte element. | |
TDynamicBuffer & | operator= (const TDynamicBuffer &db) |
Assignment operators. | |
Template for creating a dynamic buffer using an allocator.
Alloc | Allocator type. |
sf::TDynamicBuffer< Alloc >::TDynamicBuffer | ( | ) |
Default constructor.
|
inline |
Copy constructor.
|
explicit |
Initializing constructor.
|
inline |
Destructor.
|
inline |
Gets a character pointer to the start of the buffer.
|
inline |
Gets a const character pointer to the start of the buffer.
|
inline |
Gets a void pointer to the start of the buffer.
|
inline |
Returns a const pointer to the start of the buffer.
|
inline |
Gets a void pointer with a byte offset from the start.
|
inline |
Gets a const void pointer with a byte offset from the start.
void sf::TDynamicBuffer< Alloc >::grow | ( | size_t | sz | ) |
Grows the array to the specified size but keeps the current data intact.
|
inline |
Returns the current offset.
|
inline |
Sets an virtual offset to the buffer.
|
inlineexplicit |
Cast operator to a character pointer.
|
inlineexplicit |
Const cast operators to pointer.
|
inlineexplicit |
Const cast operator to void pointer.
|
inlineexplicit |
Cast operator to void pointer.
TDynamicBuffer< Alloc > & sf::TDynamicBuffer< Alloc >::operator= | ( | const TDynamicBuffer< Alloc > & | db | ) |
Assignment operators.
|
inline |
Character array operator to access a single byte element.
|
inline |
Const character array operator to access a single byte element.
|
inline |
Gets a typed pointer to the specified given offset the start of the buffer.
|
inline |
Gets a typed pointer to the specified given offset the start of the buffer.
void sf::TDynamicBuffer< Alloc >::reserve | ( | size_t | sz, |
bool | shrink = false |
||
) |
Reserves the array but does leave the data in tact.
|
inline |
Gets the reserved size of this instance.
void sf::TDynamicBuffer< Alloc >::resize | ( | size_t | sz, |
bool | shrink = false |
||
) |
Resizes the array but does leave the data in tact.
sz | When 0 and shrink is true the underlying buffer is freed. |
shrink |
|
inline |
Sets all memory to the given character. When reserved is true not only the current size but all of it.
|
inline |
Returns the byte size of the buffer.
|
inline |
Returns the byte size of the buffer.
|
inline |
Zeros all current memory size or all reserved.