Lumiera  0.pre.03
»edit your freedom«
TrackingHeapBlockProvider Class Reference

#include "steam/engine/tracking-heap-block-provider.hpp"

Description

simple BufferProvider implementation with additional allocation tracking.

used as PImpl by DiagnosticBufferProvider and DiagnosticOutputSlot.

This dummy implementation of the BufferProvider interface uses a linearly growing table of heap allocated buffer blocks, which will never be discarded, unless the object is discarded as a whole. There is an additional testing/diagnostics API to access the tracked usage information, even when blocks are already marked as "released".

Definition at line 119 of file tracking-heap-block-provider.hpp.

Public Member Functions

 TrackingHeapBlockProvider ()
 
diagn::Blockaccess_emitted (uint bufferID)
 
template<typename TY >
TY & accessAs (uint bufferID)
 convenience shortcut: access the buffer with the given number, then try to convert the raw memory to the templated type. More...
 
virtual void detachBuffer (HashVal, LocalTag const &, Buff &) override
 mark a buffer as officially discarded
 
size_t emittedCnt () const
 
virtual void mark_emitted (HashVal, LocalTag const &) override
 
virtual uint prepareBuffers (uint count, HashVal typeID) override
 
virtual BuffHandle provideLockedBuffer (HashVal typeID) override
 
- Public Member Functions inherited from BufferProvider
virtual ~BufferProvider ()
 this is an ABC
 
uint announce (uint count, BuffDescr const &)
 BufferProvider API: declare in advance the need for working buffers. More...
 
void attachTypeHandler (BuffHandle const &target, BuffDescr const &reference)
 allow for attaching and owing an object within an already created buffer More...
 
void emergencyCleanup (BuffHandle const &target, bool invokeDtor=false)
 
void emitBuffer (BuffHandle const &)
 BufferProvider API: state transition to emitted state. More...
 
size_t getBufferSize (HashVal typeID) const
 
template<typename BU , typename... ARGS>
BuffDescr getDescriptor (ARGS ...args)
 define a "buffer type" for automatically creating an instance of the template type embedded into the buffer and destroying that embedded object when releasing the buffer.
 
BuffDescr getDescriptorFor (size_t storageSize=0)
 describe the kind of buffer managed by this provider
 
BuffDescr getDescriptorFor (size_t storageSize, TypeHandler specialTreatment)
 
BuffHandle lockBuffer (BuffDescr const &)
 BufferProvider API: retrieve a single buffer for exclusive use. More...
 
template<typename BU , typename... ARGS>
BuffHandle lockBufferFor (ARGS ...args)
 convenience shortcut: prepare and claim ("lock") a buffer suitable to hold an object of the given type. More...
 
void releaseBuffer (BuffHandle const &)
 BufferProvider API: declare done and detach. More...
 
bool verifyValidity (BuffDescr const &) const
 

Private Member Functions

diagn::BlockPoolgetBlockPoolFor (HashVal typeID)
 
diagn::BlocklocateBlock (HashVal typeID, void *)
 
diagn::BlocksearchInOutSeqeuence (void *storage)
 
bool withinOutputSequence (uint bufferID) const
 

Private Attributes

ScopedPtrVect< diagn::BlockoutSeq_
 
unique_ptr< diagn::PoolTable > pool_
 

Additional Inherited Members

- Protected Types inherited from BufferProvider
using Buff = StreamType::ImplFacade::DataBuffer
 placeholder marker type for an actual data buffer
 
- Protected Member Functions inherited from BufferProvider
 BufferProvider (Literal implementationID)
 build a new provider instance, managing a family of buffers. More...
 
BuffHandle buildHandle (HashVal typeID, Buff *storage, LocalTag const &=LocalTag::UNKNOWN)
 callback from implementation to build and enrol a BufferHandle, to be returned to the client as result of the lockBuffer call. More...
 
bool was_created_by_this_provider (BuffDescr const &) const
 

Constructor & Destructor Documentation

◆ TrackingHeapBlockProvider()

create a memory tracking BufferProvider,

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

Member Function Documentation

◆ accessAs()

TY & accessAs ( uint  bufferID)

convenience shortcut: access the buffer with the given number, then try to convert the raw memory to the templated type.

Exceptions
error::Invalidif the required fame number is beyond the number of buffers marked as "emitted"
error::Fatalif conversion is not possible or the conversion path chosen doesn't work (which might be due to RTTI indicating an incompatible type).

Definition at line 163 of file tracking-heap-block-provider.hpp.

+ Inheritance diagram for TrackingHeapBlockProvider:
+ Collaboration diagram for TrackingHeapBlockProvider:

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