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

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2015, Human Brain Project
       3             :  *                     Stefan.Eilemann@epfl.ch
       4             :  */
       5             : 
       6             : #ifndef ZEROBUF_DYNAMICSUBALLOCATOR_H
       7             : #define ZEROBUF_DYNAMICSUBALLOCATOR_H
       8             : 
       9             : #include <zerobuf/Allocator.h> // base class
      10             : #include <zerobuf/api.h>
      11             : 
      12             : namespace zerobuf
      13             : {
      14             : /**
      15             :   * A zerobuf child allocator which manages a dynamic allocation of
      16             :   * statically-sized members
      17             :   */
      18             : template <class A>
      19             : class DynamicSubAllocatorBase : public Allocator
      20             : {
      21             : public:
      22             :     ZEROBUF_API DynamicSubAllocatorBase(A& parent, size_t headerIndex,
      23             :                                         size_t elementIndex, size_t size);
      24             :     ZEROBUF_API ~DynamicSubAllocatorBase();
      25             : 
      26             :     ZEROBUF_API uint8_t* getData() final;
      27             :     ZEROBUF_API const uint8_t* getData() const final;
      28           1 :     size_t getSize() const final { return _size; }
      29             :     ZEROBUF_API void copyBuffer(const void* data, size_t size) final;
      30           0 :     bool isMutable() const final { return _parent.isMutable(); }
      31             : private:
      32             :     A& _parent;
      33             :     const size_t _header;
      34             :     const size_t _element;
      35             :     const size_t _size;
      36             : 
      37             :     DynamicSubAllocatorBase(const DynamicSubAllocatorBase<A>&) = delete;
      38             :     DynamicSubAllocatorBase<A>& operator=(const DynamicSubAllocatorBase<A>&) =
      39             :         delete;
      40             : };
      41             : 
      42             : typedef DynamicSubAllocatorBase<Allocator> DynamicSubAllocator;
      43             : typedef DynamicSubAllocatorBase<const Allocator> ConstDynamicSubAllocator;
      44             : }
      45             : 
      46             : #endif

Generated by: LCOV version 1.11