Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
BlockPool Class Reference

Description

Pool of allocated buffer Blocks of a specific size. Helper for implementing a Diagnostic BufferProvider; actually does just heap allocations for the Blocks, but keeps a collection of allocated Blocks around. Individual entries can be retrieved and thus removed from the responsibility of BlockPool.

The idea is that each buffer starts its lifecycle within some pool and later gets "emitted" to an output sequence, where it remains for later investigation and diagnostics.

Definition at line 101 of file tracking-heap-block-provider.cpp.

Public Member Functions

 BlockPool ()
 
void initialise (size_t blockSize)
 
 ~BlockPool ()
 
void discard ()
 mark all managed blocks as disposed
 
uint prepare_for (uint number_of_expected_buffers)
 
BlockcreateBlock ()
 
Blockfind (void *blockLocation)
 
BlocktransferResponsibility (Block *allocatedBlock)
 
size_t size () const
 
bool isValid () const
 
 operator bool () const
 

Private Member Functions

bool verify_all_children_idle ()
 

Static Private Member Functions

static bool is_in_sane_state (Block const &block)
 

Private Attributes

uint maxAllocCount_
 
size_t memBlockSize_
 
PoolBlocks blockList_
 

Constructor & Destructor Documentation

◆ BlockPool()

BlockPool ( )
inline

Definition at line 108 of file tracking-heap-block-provider.cpp.

◆ ~BlockPool()

~BlockPool ( )
inline

Definition at line 122 of file tracking-heap-block-provider.cpp.

References BlockPool::verify_all_children_idle().

+ Here is the call graph for this function:

Member Function Documentation

◆ initialise()

void initialise ( size_t  blockSize)
inline

Definition at line 115 of file tracking-heap-block-provider.cpp.

References BlockPool::memBlockSize_.

Referenced by TrackingHeapBlockProvider::getBlockPoolFor().

+ Here is the caller graph for this function:

◆ discard()

void discard ( )
inline

mark all managed blocks as disposed

Definition at line 131 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_.

◆ prepare_for()

uint prepare_for ( uint  number_of_expected_buffers)
inline

Definition at line 138 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, BlockPool::maxAllocCount_, and ScopedPtrVect< T >::size().

Referenced by TrackingHeapBlockProvider::prepareBuffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createBlock()

Block & createBlock ( )
inline

Definition at line 152 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, ScopedPtrVect< T >::manage(), and BlockPool::memBlockSize_.

Referenced by TrackingHeapBlockProvider::provideLockedBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find()

Block * find ( void *  blockLocation)
inline

Definition at line 159 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_.

Referenced by TrackingHeapBlockProvider::locateBlock().

+ Here is the caller graph for this function:

◆ transferResponsibility()

Block * transferResponsibility ( Block allocatedBlock)
inline

Definition at line 166 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, and ScopedPtrVect< T >::detach().

Referenced by TrackingHeapBlockProvider::mark_emitted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

size_t size ( ) const
inline

Definition at line 173 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, and ScopedPtrVect< T >::size().

+ Here is the call graph for this function:

◆ isValid()

bool isValid ( ) const
inline

Definition at line 179 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, and ScopedPtrVect< T >::empty().

Referenced by BlockPool::operator bool().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator bool()

operator bool ( ) const
inlineexplicit

Definition at line 185 of file tracking-heap-block-provider.cpp.

References BlockPool::isValid().

+ Here is the call graph for this function:

◆ verify_all_children_idle()

bool verify_all_children_idle ( )
inlineprivate

Definition at line 192 of file tracking-heap-block-provider.cpp.

References BlockPool::blockList_, ERROR_LOG_AND_IGNORE, and BlockPool::is_in_sane_state().

Referenced by BlockPool::~BlockPool().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_in_sane_state()

static bool is_in_sane_state ( Block const &  block)
inlinestaticprivate

Definition at line 203 of file tracking-heap-block-provider.cpp.

References Block::was_closed(), and Block::was_used().

Referenced by BlockPool::verify_all_children_idle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ maxAllocCount_

uint maxAllocCount_
private

Definition at line 103 of file tracking-heap-block-provider.cpp.

Referenced by BlockPool::prepare_for().

◆ memBlockSize_

size_t memBlockSize_
private

◆ blockList_

+ Collaboration diagram for BlockPool:

The documentation for this class was generated from the following file: