LCOV - code coverage report
Current view: top level - zerobuf - NonMovingAllocator.h (source / functions) Hit Total Coverage
Test: ZeroBuf Lines: 4 4 100.0 %
Date: 2018-01-09 16:38:26 Functions: 4 4 100.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_NONMOVINGALLOCATOR_H
       8             : #define ZEROBUF_NONMOVINGALLOCATOR_H
       9             : 
      10             : #include <zerobuf/NonMovingBaseAllocator.h> // base class
      11             : #include <zerobuf/api.h>
      12             : 
      13             : namespace zerobuf
      14             : {
      15             : /** A zerobuf root allocator which does not move existing fields */
      16             : class NonMovingAllocator : public NonMovingBaseAllocator
      17             : {
      18             : public:
      19             :     ZEROBUF_API NonMovingAllocator(size_t staticSize, size_t numDynamic);
      20             :     ZEROBUF_API ~NonMovingAllocator();
      21             : 
      22       23634 :     uint8_t* getData() final { return _data; }
      23       46546 :     const uint8_t* getData() const final { return _data; }
      24       23978 :     size_t getSize() const final { return _size; }
      25             :     ZEROBUF_API void copyBuffer(const void* data, size_t size) final;
      26           2 :     bool isMovable() const final { return true; }
      27             : private:
      28             :     NonMovingAllocator(const NonMovingAllocator&) = delete;
      29             :     NonMovingAllocator& operator=(const NonMovingAllocator&) = delete;
      30             : 
      31             :     uint8_t* _data;
      32             :     size_t _size;
      33             : 
      34             :     void _resize(size_t newSize) final;
      35             : };
      36             : }
      37             : #endif

Generated by: LCOV version 1.11