63 return meta_->isLocked (bufferID);
77 return BuffDescr (*
this,
meta_->key (storageSize, specialTreatment));
121 if (!actually_possible)
122 throw error::State (
"unable to fulfil request for buffers"
123 ,LUMIERA_ERROR_BUFFER_MANAGEMENT);
124 return actually_possible;
185 meta_->release (metaEntry);
209 throw error::Logic{
"unable to attach an object because buffer isn't locked for use"
229 meta_->release (metaEntry);
238 return isSameAdr (
this, descr.provider_);
324 throw error::Logic (
"attaching an object requires an buffer in locked state",
LERR_(LIFECYCLE));
326 throw error::Logic (
"insufficient buffer size to hold an instance of that type");
Abstraction to represent buffer management and lifecycle within the render engine.
placeholder type for the contents of a data buffer.
An opaque descriptor to identify the type and further properties of a data buffer.
BufferProvider * provider_
bool verifyValidity() const
uint announce(uint count)
convenience shortcut to start a buffer handling cycle
size_t determineBufferSize() const
Handle for a buffer for processing data, abstracting away the actual implementation.
Interface: a facility providing and managing working buffers for media calculations.
uint announce(uint count, BuffDescr const &)
BufferProvider API: declare in advance the need for working 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 resul...
bool was_created_by_this_provider(BuffDescr const &) const
virtual uint prepareBuffers(uint count, HashVal typeID)=0
bool verifyValidity(BuffDescr const &) const
void emergencyCleanup(BuffHandle const &target, bool invokeDtor=false)
void emitBuffer(BuffHandle const &)
BufferProvider API: state transition to emitted state.
virtual ~BufferProvider()
this is an ABC
unique_ptr< BufferMetadata > meta_
BuffDescr getDescriptorFor(size_t storageSize=0)
describe the kind of buffer managed by this provider
virtual void detachBuffer(HashVal, LocalTag const &, Buff &)=0
void attachTypeHandler(BuffHandle const &target, BuffDescr const &reference)
allow for attaching and owing an object within an already created buffer
virtual void mark_emitted(HashVal, LocalTag const &)=0
size_t getBufferSize(HashVal typeID) const
BufferProvider(Literal implementationID)
build a new provider instance, managing a family of buffers.
BuffHandle lockBuffer(BuffDescr const &)
BufferProvider API: retrieve a single buffer for exclusive use.
void releaseBuffer(BuffHandle const &)
BufferProvider API: declare done and detach.
virtual BuffHandle provideLockedBuffer(HashVal typeID)=0
an opaque mark to be used by the BufferProvider implementation.
static const LocalTag UNKNOWN
Marker when no distinct local key is given.
A complete metadata Entry, based on a Key.
bool isTypeKey() const
is this Entry just an (abstract) placeholder for a type?
Entry & mark(BufferState newState)
Buffer state machine.
bool isLocked() const
is this Entry currently associated to a concrete buffer? Is this buffer in use?
Entry & invalidate(bool invokeDtor=true)
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
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.
LumieraError< LERR_(STATE)> State
LumieraError< LERR_(LOGIC)> Logic
const uint DEFAULT_DESCRIPTOR
@ FREE
allocated buffer, no longer in use
@ EMITTED
allocated buffer, returned from client
Steam-Layer implementation namespace root.
bool isSameAdr(A const &a, B const &b)
compare plain object address identity, disregarding type.
A pair of functors to maintain a datastructure within a buffer.
static const TypeHandler RAW
Marker for the default case: raw buffer without type handling.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...