ZeroBuf
0.4.0
Zero-copy, zero-serialize, zero-hassle protocol buffers
|
Allocator base class and interface. More...
#include <Allocator.h>
Public Member Functions | |
virtual uint8_t * | getData ()=0 |
virtual const uint8_t * | getData () const =0 |
virtual size_t | getSize () const =0 |
virtual void | copyBuffer (const void *data, size_t size)=0 |
virtual void | compact (float) |
virtual bool | isMovable () const |
virtual bool | isMutable () const |
virtual uint8_t * | updateAllocation (size_t, bool, size_t) |
Update allocation of the dynamic elem at index to have newSize bytes. More... | |
template<class T > | |
T * | getItemPtr (const size_t offset) |
template<class T > | |
const T * | getItemPtr (const size_t offset) const |
template<class T > | |
T & | getItem (const size_t offset) |
template<class T > | |
T | getItem (const size_t offset) const |
template<class T > | |
T * | getDynamic (const size_t index) |
template<class T > | |
const T * | getDynamic (const size_t index) const |
uint64_t | getDynamicOffset (const size_t index) const |
size_t | getDynamicSize (const size_t index) const |
void | check (const size_t numDynamics) const |
Allocator base class and interface.
Implements part of the binary data layout by providing access to the stored elements. Not intended to be used by application code.
Definition at line 20 of file Allocator.h.
|
inlinevirtual |
Update allocation of the dynamic elem at index to have newSize bytes.
The offset and size fields in the static section are updated as needed. Does not copy the old data to the new location.
Reimplemented in zerobuf::NonMovingBaseAllocator.
Definition at line 43 of file Allocator.h.
Referenced by zerobuf::Vector< T >::clear(), zerobuf::Vector< T >::compact(), zerobuf::Vector< T >::fromJSON(), zerobuf::Vector< T >::operator[](), zerobuf::Vector< T >::push_back(), and zerobuf::Vector< T >::toJSONBinary().