ZeroBuf  0.1.0
ZeroBuf is a replacement for FlatBuffers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NonMovingBaseAllocator.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  * grigori.chevtchenko@epfl.ch
5  */
6 
7 #ifndef ZEROBUF_NONMOVINGBASEALLOCATOR_H
8 #define ZEROBUF_NONMOVINGBASEALLOCATOR_H
9 
10 #include <zerobuf/api.h>
11 #include <zerobuf/Allocator.h> // base class
12 
13 namespace zerobuf
14 {
17 {
18 public:
19  ZEROBUF_API NonMovingBaseAllocator( size_t staticSize, size_t numDynamic );
20  ZEROBUF_API
21  explicit NonMovingBaseAllocator( const NonMovingBaseAllocator& from );
22  ZEROBUF_API virtual ~NonMovingBaseAllocator();
23 
24  ZEROBUF_API
25  NonMovingBaseAllocator& operator = ( const NonMovingBaseAllocator& rhs );
26 
27  ZEROBUF_API uint8_t* updateAllocation( size_t index, size_t size ) override;
28 
29 protected:
30  virtual void _resize( size_t newSize ) = 0;
31 
32 private:
33  size_t _staticSize;
34  size_t _numDynamic;
35 };
36 }
37 #endif
Allocator base class which does not move existing fields.
Defines export visibility macros for library ZeroBuf.
Allocator base class and interface.
Definition: Allocator.h:20
ZEROBUF_API uint8_t * updateAllocation(size_t index, size_t size) override
Update allocation of the dynamic elem.