![]() |
Lumiera 0.pre.04~rc.1
»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 119 of file tracking-heap-block-provider.hpp.
Public Member Functions | |
| virtual uint | prepareBuffers (uint count, HashVal typeID) override |
| virtual BuffHandle | provideLockedBuffer (HashVal typeID) override |
| virtual void | mark_emitted (HashVal, LocalTag const &) override |
| virtual void | detachBuffer (HashVal, LocalTag const &, Buff &) override |
| mark a buffer as officially discarded | |
| TrackingHeapBlockProvider () | |
| virtual | ~TrackingHeapBlockProvider () |
| size_t | emittedCnt () const |
| 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. | |
| void | markAllEmitted () |
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. | |
| BuffHandle | lockBuffer (BuffDescr const &) |
| BufferProvider API: retrieve a single buffer for exclusive use. | |
| void | emitBuffer (BuffHandle const &) |
| BufferProvider API: state transition to emitted state. | |
| void | releaseBuffer (BuffHandle const &) |
| BufferProvider API: declare done and detach. | |
| 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. | |
| void | attachTypeHandler (BuffHandle const &target, BuffDescr const &reference) |
| allow for attaching and owing an object within an already created buffer | |
| void | emergencyCleanup (BuffHandle const &target, bool invokeDtor=false) |
| BuffDescr | getDescriptorFor (size_t storageSize=0) |
| describe the kind of buffer managed by this provider | |
| BuffDescr | getDescriptorFor (size_t storageSize, TypeHandler specialTreatment) |
| 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. | |
| bool | verifyValidity (BuffDescr const &) const |
| size_t | getBufferSize (HashVal typeID) const |
Private Member Functions | |
| bool | withinOutputSequence (uint bufferID) const |
| diagn::BlockPool & | getBlockPoolFor (HashVal typeID) |
| diagn::Block * | locateBlock (HashVal typeID, void *) |
| diagn::Block * | searchInOutSeqeuence (void *storage) |
Private Attributes | |
| unique_ptr< diagn::PoolTable > | pool_ |
| ScopedPtrVect< diagn::Block > | outSeq_ |
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. | |
| 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. | |
| bool | was_created_by_this_provider (BuffDescr const &) const |
create a memory tracking BufferProvider,
Definition at line 225 of file tracking-heap-block-provider.cpp.
|
virtual |
Definition at line 231 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::outSeq_.
Implements BufferProvider.
Definition at line 240 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::getBlockPoolFor(), and BlockPool::prepare_for().
Here is the call graph for this function:
|
overridevirtual |
Implements BufferProvider.
Definition at line 248 of file tracking-heap-block-provider.cpp.
References Block::accessMemory(), BufferProvider::buildHandle(), BlockPool::createBlock(), and TrackingHeapBlockProvider::getBlockPoolFor().
Here is the call graph for this function:
|
overridevirtual |
Implements BufferProvider.
Definition at line 257 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::getBlockPoolFor(), TrackingHeapBlockProvider::locateBlock(), TrackingHeapBlockProvider::outSeq_, BlockPool::transferResponsibility(), and Block::was_closed().
Here is the call graph for this function:mark a buffer as officially discarded
Implements BufferProvider.
Definition at line 278 of file tracking-heap-block-provider.cpp.
References Block::accessMemory(), util::isSameAdr(), TrackingHeapBlockProvider::locateBlock(), and Block::markReleased().
Here is the call graph for this function:| size_t emittedCnt | ( | ) | const |
Definition at line 291 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::outSeq_.
Referenced by TrackingInMemoryBlockSequence::accessEmittedBuffer(), TrackingInMemoryBlockSequence::accessEmittedFrame(), and TrackingHeapBlockProvider_test::verifyTestProtocol().
Here is the caller graph for this function:| diagn::Block & access_emitted | ( | uint | bufferID | ) |
Definition at line 304 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::outSeq_, and TrackingHeapBlockProvider::withinOutputSequence().
Referenced by TrackingHeapBlockProvider::accessAs(), TrackingHeapBlockProvider_test::simpleExample(), TrackingHeapBlockProvider_test::verifyStandardCase(), and TrackingHeapBlockProvider_test::verifyTestProtocol().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 165 of file tracking-heap-block-provider.hpp.
References TrackingHeapBlockProvider::access_emitted(), Block::accessMemory(), and TrackingHeapBlockProvider::withinOutputSequence().
Referenced by TrackingHeapBlockProvider_test::verifyTestProtocol().
Here is the call graph for this function:
Here is the caller graph for this function:| void markAllEmitted | ( | ) |
Definition at line 297 of file tracking-heap-block-provider.cpp.
References _, and TrackingHeapBlockProvider::pool_.
Referenced by DiagnosticBufferProvider::reset().
Here is the caller graph for this function:
|
private |
Definition at line 313 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::outSeq_.
Referenced by TrackingHeapBlockProvider::access_emitted(), and TrackingHeapBlockProvider::accessAs().
Here is the caller graph for this function:
|
private |
Definition at line 322 of file tracking-heap-block-provider.cpp.
References BufferProvider::getBufferSize(), and BlockPool::initialise().
Referenced by TrackingHeapBlockProvider::locateBlock(), TrackingHeapBlockProvider::mark_emitted(), TrackingHeapBlockProvider::prepareBuffers(), and TrackingHeapBlockProvider::provideLockedBuffer().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 331 of file tracking-heap-block-provider.cpp.
References BlockPool::find(), TrackingHeapBlockProvider::getBlockPoolFor(), and TrackingHeapBlockProvider::searchInOutSeqeuence().
Referenced by TrackingHeapBlockProvider::detachBuffer(), and TrackingHeapBlockProvider::mark_emitted().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 340 of file tracking-heap-block-provider.cpp.
References TrackingHeapBlockProvider::outSeq_.
Referenced by TrackingHeapBlockProvider::locateBlock().
Here is the caller graph for this function:
|
private |
Definition at line 122 of file tracking-heap-block-provider.hpp.
Referenced by TrackingHeapBlockProvider::markAllEmitted().
|
private |
Definition at line 123 of file tracking-heap-block-provider.hpp.
Referenced by TrackingHeapBlockProvider::~TrackingHeapBlockProvider(), TrackingHeapBlockProvider::access_emitted(), TrackingHeapBlockProvider::emittedCnt(), TrackingHeapBlockProvider::mark_emitted(), TrackingHeapBlockProvider::searchInOutSeqeuence(), and TrackingHeapBlockProvider::withinOutputSequence().
Inheritance diagram for TrackingHeapBlockProvider:
Collaboration diagram for TrackingHeapBlockProvider: