LCOV - code coverage report
Current view: top level - zerobuf - StaticSubAllocator.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_STATICSUBALLOCATOR_H
       7             : #define ZEROBUF_STATICSUBALLOCATOR_H
       8             : 
       9             : #include <zerobuf/Allocator.h> // base class
      10             : #include <zerobuf/api.h>
      11             : 
      12             : namespace zerobuf
      13             : {
      14             : /** A zerobuf child allocator which manages a static sub-struct. */
      15             : template <class A>
      16             : class StaticSubAllocatorBase : public Allocator
      17             : {
      18             : public:
      19             :     ZEROBUF_API StaticSubAllocatorBase(A& parent, size_t offset, size_t size);
      20             :     ZEROBUF_API ~StaticSubAllocatorBase();
      21             : 
      22             :     ZEROBUF_API uint8_t* getData() final;
      23             :     ZEROBUF_API const uint8_t* getData() const final;
      24           1 :     size_t getSize() const final { return _size; }
      25             :     ZEROBUF_API void copyBuffer(const void* data, size_t size) final;
      26           0 :     bool isMutable() const final { return _parent.isMutable(); }
      27             : private:
      28             :     A& _parent;
      29             :     const size_t _offset;
      30             :     const size_t _size;
      31             : 
      32             :     StaticSubAllocatorBase(const StaticSubAllocatorBase<A>&) = delete;
      33             :     StaticSubAllocatorBase<A>& operator=(const StaticSubAllocatorBase<A>&) =
      34             :         delete;
      35             : };
      36             : 
      37             : typedef StaticSubAllocatorBase<Allocator> StaticSubAllocator;
      38             : typedef StaticSubAllocatorBase<const Allocator> ConstStaticSubAllocator;
      39             : }
      40             : 
      41             : #endif

Generated by: LCOV version 1.11