ZeroBuf  0.1.0
ZeroBuf is a replacement for FlatBuffers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Zerobuf.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  * grigori.chevtchenko@epfl.ch
5  */
6 
7 #ifndef ZEROBUF_ZEROBUF_H
8 #define ZEROBUF_ZEROBUF_H
9 
10 #include <zerobuf/api.h>
11 #include <zerobuf/Types.h>
12 #include <servus/uint128_t.h>
13 
14 namespace zerobuf
15 {
22 class Zerobuf
23 {
24 public:
25  virtual servus::uint128_t getZerobufType() const = 0;
26  virtual Schema getSchema() const = 0;
27  virtual void notifyUpdated() {}
28 
29  ZEROBUF_API const void* getZerobufData() const;
30  ZEROBUF_API size_t getZerobufSize() const;
31  ZEROBUF_API void setZerobufData( const void* data, size_t size );
32 
33  ZEROBUF_API std::string toJSON() const;
34  ZEROBUF_API void fromJSON( const std::string& json );
35 
36  ZEROBUF_API bool operator==( const Zerobuf& rhs ) const;
37  ZEROBUF_API bool operator!=( const Zerobuf& rhs ) const;
38 
39  /* @internal */
40  const Allocator* getAllocator() const { return _alloc; }
41 
42 protected:
43  Zerobuf() : _alloc( 0 ) {}
44  explicit Zerobuf( Allocator* alloc ) : _alloc( alloc ) {}
45  ZEROBUF_API virtual ~Zerobuf();
46 
47  ZEROBUF_API Zerobuf& operator = ( const Zerobuf& rhs );
48  Allocator* getAllocator() { return _alloc; }
49 
50  ZEROBUF_API void _setZerobufArray(const void* data, const size_t size,
51  const size_t arrayNum );
52 
53 private:
54  Allocator* const _alloc;
55 
56  explicit Zerobuf( const Zerobuf& );
57 };
58 
59 }
60 
61 #endif
Defines export visibility macros for library ZeroBuf.
A runtime and optimized representation of the schema file input, which describes the data layout of a...
Definition: Schema.h:21
Allocator base class and interface.
Definition: Allocator.h:20
Base class for all zerobufs.
Definition: Zerobuf.h:22