ZeroBuf  0.4.0
Zero-copy, zero-serialize, zero-hassle protocol buffers
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 {
16 template< class A >
18 {
19 public:
20  ZEROBUF_API NonMovingSubAllocatorBase( A& parent, size_t index,
21  size_t numDynamic,
22  size_t staticSize );
23  ZEROBUF_API ~NonMovingSubAllocatorBase();
24 
25 
26  ZEROBUF_API uint8_t* getData() final;
27  ZEROBUF_API const uint8_t* getData() const final;
28  ZEROBUF_API size_t getSize() const final;
29  ZEROBUF_API void copyBuffer( const void* data, size_t size ) final;
30  bool isMutable() const final { return _parent.isMutable(); }
31 
32 private:
33  A& _parent;
34  const size_t _index;
35 
36  NonMovingSubAllocatorBase( const NonMovingSubAllocatorBase< A >& ) = delete;
37  NonMovingSubAllocatorBase< A >& operator = (
38  const NonMovingSubAllocatorBase< A >& ) = delete;
39  void _resize( size_t newSize ) final;
40 };
41 
44 
45 }
46 #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 child allocator which does not move existing fields.