49 return static_cast<Buff*
> (mem);
60 return storage == &inQuestion;
64 inline function<bool(Block
const&)>
74 typename VEC::iterator pos
75 = std::find_if (vec.begin(),vec.end()
125 ERROR (
test,
"Block actively in use while shutting down BufferProvider "
126 "allocation pool. This might lead to Segfault and memory leaks.");
134 block.markReleased();
147 return number_of_expected_buffers;
161 return pick_Block_by_storage (
blockList_, blockLocation);
185 operator bool()
const
227 , pool_(new
diagn::PoolTable)
233 INFO (proc_mem,
"discarding %zu diagnostic buffer entries",
outSeq_.size());
243 return responsiblePool.
prepare_for (requestedAmount);
261 throw error::Logic (
"Attempt to emit a buffer not known to this BufferProvider"
262 , LUMIERA_ERROR_BUFFER_MANAGEMENT);
269 WARN (proc_mem,
"Attempt to emit() an already closed buffer.");
271 WARN (proc_mem,
"Attempt to emit() a buffer not found in active pool. "
272 "Maybe duplicate call to emit()?");
281 REQUIRE (block4buffer,
"releasing a buffer not allocated through this provider");
299 for (
auto& [
_, blockPool] : *
pool_)
307 return emptyPlaceholder;
315 if (bufferID >= MAX_BUFFERS)
316 throw error::Fatal (
"hardwired internal limit for test buffers exceeded");
318 return bufferID <
outSeq_.size();
335 return block4buffer? block4buffer
342 return pick_Block_by_storage (
outSeq_, blockLocation);
Simple vector based collection of pointers, managing lifecycle of the pointed-to objects.
T * detach(void *objAddress)
withdraw responsibility for a specific object.
T & manage(T *obj)
take ownership of the given object, adding it at the end of the collection
placeholder type for the contents of a data buffer.
Handle for a buffer for processing data, abstracting away the actual implementation.
Interface: a facility providing and managing working buffers for media calculations.
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 resul...
size_t getBufferSize(HashVal typeID) const
an opaque mark to be used by the BufferProvider implementation.
size_t emittedCnt() const
diagn::Block * locateBlock(HashVal typeID, void *)
virtual void mark_emitted(HashVal, LocalTag const &) override
unique_ptr< diagn::PoolTable > pool_
bool withinOutputSequence(uint bufferID) const
TrackingHeapBlockProvider()
virtual uint prepareBuffers(uint count, HashVal typeID) override
virtual BuffHandle provideLockedBuffer(HashVal typeID) override
virtual void detachBuffer(HashVal, LocalTag const &, Buff &) override
mark a buffer as officially discarded
ScopedPtrVect< diagn::Block > outSeq_
virtual ~TrackingHeapBlockProvider()
diagn::Block * searchInOutSeqeuence(void *storage)
diagn::Block & access_emitted(uint bufferID)
diagn::BlockPool & getBlockPoolFor(HashVal typeID)
Block * find(void *blockLocation)
void discard()
mark all managed blocks as disposed
bool verify_all_children_idle()
void initialise(size_t blockSize)
static bool is_in_sane_state(Block const &block)
uint prepare_for(uint number_of_expected_buffers)
Block * transferResponsibility(Block *allocatedBlock)
Helper for implementing a diagnostic BufferProvider: A block of heap allocated storage,...
void * accessMemory() const
Lumiera error handling (C++ interface).
#define ERROR_LOG_AND_IGNORE(_FLAG_, _OP_DESCR_)
convenience shortcut for a sequence of catch blocks just logging and consuming an error.
This header is for including and configuring NoBug.
LumieraError< LERR_(FATAL), Logic > Fatal
LumieraError< LERR_(LOGIC)> Logic
function< bool(Block const &)> search_for_block_using_this_storage(void *storage)
build a searching predicate
bool identifyBlock(Block const &inQuestion, void *storage)
helper to find Block entries based on their raw memory address
Block * pick_Block_by_storage(VEC &vec, void *blockLocation)
diagn::Block emptyPlaceholder(0)
Buff * asBuffer(void *mem)
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool isSameAdr(A const &a, B const &b)
compare plain object address identity, disregarding type.
bool and_all(IT i, IT end, FUN predicate)
All quantification: check if all elements of a collection satisfy the given predicate.
Managing lifecycle for a collection of objects.
Dummy implementation of the BufferProvider interface to support writing unit tests.
Perform operations "for each element" of a collection.