ZeroBuf  0.4.0
Zero-copy, zero-serialize, zero-hassle protocol buffers
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();
21 
22  uint8_t* getData() final { return _data; }
23  const uint8_t* getData() const final { return _data; }
24  size_t getSize() const final { return _size; }
25  ZEROBUF_API void copyBuffer( const void* data, size_t size ) final;
26  bool isMovable() const final { return true; }
27 
28 private:
29  NonMovingAllocator( const NonMovingAllocator& ) = delete;
30  NonMovingAllocator& operator = ( const NonMovingAllocator& ) = delete;
31 
32  uint8_t* _data;
33  size_t _size;
34 
35  void _resize( size_t newSize ) final;
36 };
37 }
38 #endif
Allocator base class which does not move existing fields.
Defines export visibility macros for library ZeroBuf.
Zero-copy, zero-serialize, zero-hassle protocol buffers.
Definition: Allocator.h:12
A zerobuf root allocator which does not move existing fields.