LCOV - code coverage report
Current view: top level - zerobuf - NonMovingSubAllocator.h (source / functions) Hit Total Coverage
Test: ZeroBuf Lines: 1 1 100.0 %
Date: 2018-01-09 16:38:26 Functions: 1 2 50.0 %

          Line data    Source code
       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             : {
      15             : /** A zerobuf child allocator which does not move existing fields */
      16             : template <class A>
      17             : class NonMovingSubAllocatorBase : public NonMovingBaseAllocator
      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          33 :     bool isMutable() const final { return _parent.isMutable(); }
      29             : private:
      30             :     A& _parent;
      31             :     const size_t _index;
      32             : 
      33             :     NonMovingSubAllocatorBase(const NonMovingSubAllocatorBase<A>&) = delete;
      34             :     NonMovingSubAllocatorBase<A>& operator=(
      35             :         const NonMovingSubAllocatorBase<A>&) = delete;
      36             :     void _resize(size_t newSize) final;
      37             : };
      38             : 
      39             : typedef NonMovingSubAllocatorBase<Allocator> NonMovingSubAllocator;
      40             : typedef NonMovingSubAllocatorBase<const Allocator> ConstNonMovingSubAllocator;
      41             : }
      42             : #endif

Generated by: LCOV version 1.11