33 #ifndef STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H 34 #define STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H 42 #include <unordered_map> 56 using std::unique_ptr;
67 unique_ptr<char[]> storage_;
73 Block(
size_t bufferSize)
74 : storage_(bufferSize?
new char[bufferSize] : NULL)
75 , was_released_(
false)
81 return bool(storage_);
93 REQUIRE (storage_,
"Block was never prepared for use");
94 return storage_.get();
100 was_released_ =
true;
106 typedef std::unordered_map<HashVal,BlockPool> PoolTable;
122 unique_ptr<diagn::PoolTable> pool_;
128 virtual uint prepareBuffers (uint count,
HashVal typeID)
override;
137 size_t emittedCnt()
const;
141 template<
typename TY>
142 TY& accessAs (uint bufferID);
145 bool withinOutputSequence (uint bufferID)
const;
161 template<
typename TY>
165 if (!withinOutputSequence (bufferID))
166 throw error::Invalid (
"Buffer with the given ID not yet emitted");
169 TY* converted = std::launder (reinterpret_cast<TY*> (memoryBlock.accessMemory()));
Helper for implementing a diagnostic BufferProvider: A block of heap allocated storage, with the capability to store some additional tracking information.
Any copy and copy construction prohibited.
an opaque mark to be used by the BufferProvider implementation.
Steam-Layer implementation namespace root.
Managing lifecycle for a collection of objects.
Simple vector based collection of pointers, managing lifecycle of the pointed-to objects.
Derived specific exceptions within Lumiera's exception hierarchy.
TY & accessAs(uint bufferID)
convenience shortcut: access the buffer with the given number, then try to convert the raw memory to ...
simple BufferProvider implementation with additional allocation tracking.
Lumiera error handling (C++ interface).
Hash value types and utilities.
Handle for a buffer for processing data, abstracting away the actual implementation.
size_t HashVal
a STL compatible hash value
Interface: a facility providing and managing working buffers for media calculations.
placeholder type for the contents of a data buffer.
Abstraction to represent buffer management and lifecycle within the render engine.