ZeroBuf  0.5.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/NonMovingBaseAllocator.h> // base class
11 #include <zerobuf/api.h>
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, size_t staticSize);
22  ZEROBUF_API ~NonMovingSubAllocatorBase();
23 
24  ZEROBUF_API uint8_t* getData() final;
25  ZEROBUF_API const uint8_t* getData() const final;
26  ZEROBUF_API size_t getSize() const final;
27  ZEROBUF_API void copyBuffer(const void* data, size_t size) final;
28  bool isMutable() const final { return _parent.isMutable(); }
29 private:
30  A& _parent;
31  const size_t _index;
32 
33  NonMovingSubAllocatorBase(const NonMovingSubAllocatorBase<A>&) = delete;
35  const NonMovingSubAllocatorBase<A>&) = delete;
36  void _resize(size_t newSize) final;
37 };
38 
41 }
42 #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.