42 #ifndef STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H 43 #define STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H 51 #include <unordered_map> 65 using std::unique_ptr;
76 unique_ptr<char[]> storage_;
82 Block(
size_t bufferSize)
83 : storage_(bufferSize?
new char[bufferSize] : NULL)
84 , was_released_(
false)
90 return bool(storage_);
102 REQUIRE (storage_,
"Block was never prepared for use");
103 return storage_.get();
109 was_released_ =
true;
115 typedef std::unordered_map<HashVal,BlockPool> PoolTable;
131 unique_ptr<diagn::PoolTable> pool_;
137 virtual uint prepareBuffers (uint count,
HashVal typeID);
146 size_t emittedCnt()
const;
150 template<
typename TY>
151 TY& accessAs (uint bufferID);
154 bool withinOutputSequence (uint bufferID)
const;
170 template<
typename TY>
174 if (!withinOutputSequence (bufferID))
175 throw error::Invalid (
"Buffer with the given ID not yet emitted");
178 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.
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.
an opaque ID to be used by the BufferProvider implementation.
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.
Abstraction to represent buffer management and lifecycle within the render engine.