ZeroBuf
0.5.0
Zero-copy, zero-serialize, zero-hassle protocol buffers
|
Base class for all Zerobuf serializable objects. More...
#include <Zerobuf.h>
Public Member Functions | |
virtual size_t | getZerobufStaticSize () const =0 |
virtual size_t | getZerobufNumDynamics () const =0 |
virtual void | compact (float threshold=0.1f) |
Remove unused holes from the zerobuf. More... | |
Zerobuf & | operator= (const Zerobuf &rhs) |
Assignment operator. More... | |
Zerobuf (Zerobuf &&rhs) | |
Move ctor. More... | |
Zerobuf & | operator= (Zerobuf &&rhs) |
Move operator. More... | |
bool | operator== (const Zerobuf &rhs) const |
bool | operator!= (const Zerobuf &rhs) const |
void | reset (AllocatorPtr allocator) |
void | check () const |
Protected Member Functions | |
Zerobuf (AllocatorPtr alloc) | |
virtual void | notifyChanged () |
Called if any data in this object has changed. More... | |
const Allocator & | getAllocator () const |
Allocator & | getAllocator () |
void | _copyZerobufArray (const void *data, size_t size, size_t arrayNum) |
virtual void | _parseJSON (const Json::Value &json) |
virtual void | _createJSON (Json::Value &json) const |
bool | _fromBinary (const void *data, const size_t size) override |
Friends | |
void | fromJSON (const Json::Value &, Zerobuf &) |
void | toJSON (const Zerobuf &, Json::Value &) |
Base class for all Zerobuf serializable objects.
The zerobufCxx.py code generator creates subclasses of this class. Zerobuf objects can serialize/deserialize directly from their member storage and from and to JSON. All members are zero-initialized, unless they do have a default value. fromJSON() will compact the Zerobuf.
zerobuf::Zerobuf::Zerobuf | ( | Zerobuf && | rhs | ) |
Move ctor.
|
virtual |
Remove unused holes from the zerobuf.
Compaction only occurs if the current allocation exceeds the relative threshold to the optimal size, that is, if unusedMemory divided by optimalMemory is above the threshold.
threshold | the compaction threshold |
|
pure virtual |
|
pure virtual |
|
inlineprotectedvirtual |
bool zerobuf::Zerobuf::operator!= | ( | const Zerobuf & | rhs | ) | const |
Move operator.
May copy data if zerobuf is not movable
bool zerobuf::Zerobuf::operator== | ( | const Zerobuf & | rhs | ) | const |