LCOV - code coverage report
Current view: top level - util - MemoryBlock.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 13 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 2 0.0 %
Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : //-       Class: MemoryBlock
       2                 :            : //-       Owner: Jim Hipp
       3                 :            : //- Description: MemoryBlock provides stack storage for block or "Chunk"
       4                 :            : //-              memory allocated with overloaded 'new' operators in classes
       5                 :            : //-              utilizing a MemoryManager object.
       6                 :            : //- Checked By: 
       7                 :            : //-    Version:
       8                 :            : 
       9                 :            : #include"MemoryBlock.hpp"
      10                 :            : 
      11                 :            : 
      12                 :            : // destructor: recusively deletes stack of allocated memory
      13                 :          0 : MemoryBlock::~MemoryBlock()
      14                 :            : {
      15         [ #  # ]:          0 :   delete [] block;
      16         [ #  # ]:          0 :   if (next) 
      17                 :            :   {
      18         [ #  # ]:          0 :     delete next;
      19                 :          0 :     next = NULL;
      20                 :            :   }
      21                 :          0 : }
      22                 :            : 
      23                 :            : // retreive total amount of memory allocated (bytes) including all blocks
      24                 :            : // beneath 'this' block on the stack
      25                 :          0 : int MemoryBlock::get_memory_allocation()
      26                 :            : {
      27                 :          0 :   MemoryBlock* block_ptr = this;
      28                 :            : 
      29                 :            :   // sum all allocated memory
      30                 :            : 
      31                 :          0 :   int amount = 0;
      32         [ #  # ]:          0 :   while (block_ptr)
      33                 :            :   {
      34                 :          0 :     amount += block_ptr->size;
      35                 :          0 :     block_ptr = block_ptr->next;
      36                 :            :   }
      37                 :            : 
      38                 :          0 :   return amount;
      39                 :            : }
      40                 :            : 
      41                 :            : 
      42                 :            : 

Generated by: LCOV version 1.11