ZeroBuf  0.1.0
ZeroBuf is a replacement for FlatBuffers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NonMovingSubAllocator.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  * grigori.chevtchenko@epfl.ch
5  */
6 
7 #ifndef ZEROBUF_NONMOVINGSUBALLOCATOR_H
8 #define ZEROBUF_NONMOVINGSUBALLOCATOR_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 NonMovingSubAllocator( NonMovingBaseAllocator* parent,
20  size_t index, size_t numDynamic,
21  size_t staticSize );
22  ZEROBUF_API NonMovingSubAllocator( const NonMovingSubAllocator& from );
23  ZEROBUF_API ~NonMovingSubAllocator();
24 
25  ZEROBUF_API
26  NonMovingSubAllocator& operator = ( const NonMovingSubAllocator& );
27 
28  ZEROBUF_API uint8_t* getData() final;
29  ZEROBUF_API const uint8_t* getData() const final;
30  size_t getSize() const final { return _size; }
31  ZEROBUF_API void copyBuffer( const void* data, size_t size ) final;
32 
33 private:
34  NonMovingBaseAllocator* _parent;
35  size_t _index;
36  size_t _size;
37 
38  void _resize( size_t newSize ) final;
39 };
40 }
41 #endif
Allocator base class which does not move existing fields.
Defines export visibility macros for library ZeroBuf.
A zerobuf child allocator which does not move existing fields.