7 #ifndef ZEROBUF_ZEROBUF_H 8 #define ZEROBUF_ZEROBUF_H 11 #include <zerobuf/Allocator.h> 12 #include <zerobuf/types.h> 13 #include <zerobuf/json.h> 14 #include <servus/serializable.h> 15 #include <servus/uint128_t.h> 28 class Zerobuf :
public servus::Serializable
49 ZEROBUF_API
virtual void compact(
float threshold = 0.1f );
58 ZEROBUF_API Zerobuf&
operator = ( Zerobuf&& rhs );
61 ZEROBUF_API
bool operator == (
const Zerobuf& rhs )
const;
64 ZEROBUF_API
bool operator != (
const Zerobuf& rhs )
const;
67 ZEROBUF_API
void reset( AllocatorPtr allocator );
70 ZEROBUF_API
void check()
const;
73 ZEROBUF_API
explicit Zerobuf( AllocatorPtr alloc );
74 ZEROBUF_API
virtual ~Zerobuf();
77 ZEROBUF_API
const Allocator& getAllocator()
const;
80 ZEROBUF_API
void _copyZerobufArray(
const void* data,
size_t size,
83 ZEROBUF_API
virtual void _parseJSON(
const Json::Value& json );
84 ZEROBUF_API
virtual void _createJSON( Json::Value& json )
const;
85 ZEROBUF_API
friend void fromJSON(
const Json::Value&,Zerobuf& );
86 ZEROBUF_API
friend void toJSON(
const Zerobuf&, Json::Value& );
89 AllocatorPtr _allocator;
92 Zerobuf(
const Zerobuf&
zerobuf ) =
delete;
94 ZEROBUF_API
bool _fromBinary(
const void* data,
const size_t size )
final;
95 ZEROBUF_API Data _toBinary()
const final;
96 ZEROBUF_API
bool _fromJSON(
const std::string& json )
final;
97 ZEROBUF_API std::string _toJSON()
const final;
100 inline std::ostream& operator << ( std::ostream& os,
const Zerobuf&
zerobuf )
102 return os <<
"\"" << zerobuf.getTypeName() <<
"\" : " << zerobuf.toJSON();
Defines export visibility macros for library ZeroBuf.
Zerobuf & operator=(const Zerobuf &rhs)
Assignment operator.
Zero-copy, zero-serialize, zero-hassle protocol buffers.
virtual size_t getZerobufStaticSize() const =0
virtual void notifyChanging()
Called if any data in this object is about to change.
bool operator==(const Zerobuf &rhs) const
bool operator!=(const Zerobuf &rhs) const
Allocator base class and interface.
Base class for all Zerobuf serializable objects.
virtual size_t getZerobufNumDynamics() const =0
virtual void compact(float threshold=0.1f)
Remove unused holes from the zerobuf.