Lumiera
0.pre.03
»edit your freedom«
|
#include "steam/engine/tracking-heap-block-provider.hpp"
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 128 of file tracking-heap-block-provider.hpp.
Public Member Functions | |
TrackingHeapBlockProvider () | |
diagn::Block & | access_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 entryID, LocalKey const &) |
mark a buffer as officially discarded | |
size_t | emittedCnt () const |
virtual void | mark_emitted (HashVal entryID, LocalKey const &) |
virtual uint | prepareBuffers (uint count, HashVal typeID) |
virtual BuffHandle | provideLockedBuffer (HashVal typeID) |
Public Member Functions inherited from BufferProvider | |
virtual | ~BufferProvider () |
this is an ABC | |
uint | announce (uint count, BufferDescriptor const &) |
BufferProvider API: declare in advance the need for working buffers. More... | |
void | attachTypeHandler (BuffHandle const &target, BufferDescriptor 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 > | |
BufferDescriptor | getDescriptor () |
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. | |
BufferDescriptor | getDescriptorFor (size_t storageSize=0) |
describe the kind of buffer managed by this provider | |
BufferDescriptor | getDescriptorFor (size_t storageSize, TypeHandler specialTreatment) |
BuffHandle | lockBuffer (BufferDescriptor const &) |
BufferProvider API: retrieve a single buffer for exclusive use. More... | |
template<typename BU > | |
BuffHandle | lockBufferFor () |
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 (BufferDescriptor const &) const |
Private Member Functions | |
diagn::BlockPool & | getBlockPoolFor (HashVal typeID) |
diagn::Block * | locateBlock (HashVal typeID, void *) |
diagn::Block * | searchInOutSeqeuence (void *storage) |
bool | withinOutputSequence (uint bufferID) const |
Private Attributes | |
ScopedPtrVect< diagn::Block > | outSeq_ |
unique_ptr< diagn::PoolTable > | pool_ |
Additional Inherited Members | |
Protected Member Functions inherited from BufferProvider | |
BufferProvider (Literal implementationID) | |
build a new provider instance, managing a family of buffers. More... | |
BuffHandle | buildHandle (HashVal typeID, void *storage, LocalKey const &) |
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 (BufferDescriptor const &) const |
create a memory tracking BufferProvider,
Definition at line 223 of file tracking-heap-block-provider.cpp.
TY & accessAs | ( | uint | bufferID | ) |
convenience shortcut: access the buffer with the given number, then try to convert the raw memory to the templated type.
error::Invalid | if the required fame number is beyond the number of buffers marked as "emitted" |
error::Fatal | if 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 172 of file tracking-heap-block-provider.hpp.