ZeroBuf  0.1.0
ZeroBuf is a replacement for FlatBuffers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NonMovingAllocator.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  * grigori.chevtchenko@epfl.ch
5  */
6 
7 #ifndef ZEROBUF_NONMOVINGALLOCATOR_H
8 #define ZEROBUF_NONMOVINGALLOCATOR_H
9 
10 #include <zerobuf/api.h>
11 #include <zerobuf/NonMovingBaseAllocator.h> // base class
12 
13 namespace zerobuf
14 {
17 {
18 public:
19  ZEROBUF_API NonMovingAllocator( size_t staticSize, size_t numDynamic );
20  ZEROBUF_API NonMovingAllocator( const NonMovingAllocator& from );
21  ZEROBUF_API ~NonMovingAllocator();
22 
23  ZEROBUF_API NonMovingAllocator& operator = ( const NonMovingAllocator& rhs );
24 
25  uint8_t* getData() final { return _data; }
26  const uint8_t* getData() const final { return _data; }
27  size_t getSize() const final { return _size; }
28  ZEROBUF_API void copyBuffer( const void* data, size_t size ) final;
29 
30 private:
31  uint8_t* _data;
32  size_t _size;
33 
34  void _resize( size_t newSize ) final;
35 };
36 }
37 #endif
Allocator base class which does not move existing fields.
Defines export visibility macros for library ZeroBuf.
A zerobuf root allocator which does not move existing fields.