42 const uint DEFAULT_DESCRIPTOR = 0;
68 return meta_->isLocked (bufferID);
87 BufferProvider::getBufferSize (
HashVal typeID)
const 90 return typeKey.storageSize();
125 uint actually_possible = prepareBuffers (count, type);
126 if (!actually_possible)
127 throw error::State (
"unable to fulfil request for buffers" 128 ,LUMIERA_ERROR_BUFFER_MANAGEMENT);
129 return actually_possible;
148 REQUIRE (was_created_by_this_provider (type));
150 return provideLockedBuffer (type);
170 mark_emitted (metaEntry.parentKey(), metaEntry.localKey());
188 detachBuffer (metaEntry.parentKey(), metaEntry.localKey());
189 meta_->release (metaEntry);
213 throw error::Logic{
"unable to attach an object because buffer isn't locked for use" 216 metaEntry.useTypeHandlerFrom (refEntry);
231 metaEntry.invalidate (invokeDtor);
232 detachBuffer (metaEntry.parentKey(), metaEntry.localKey());
233 meta_->release (metaEntry);
240 BufferProvider::was_created_by_this_provider (
BufferDescriptor const& descr)
const 242 return isSameObject (*
this, *descr.provider_);
252 BufferDescriptor::verifyValidity()
const 254 return provider_->verifyValidity(*
this);
259 BufferDescriptor::determineBufferSize()
const 261 return provider_->getBufferSize (*
this);
269 descriptor_.provider_->emitBuffer(*
this);
274 BuffHandle::release()
279 descriptor_.provider_->releaseBuffer(*
this);
287 BuffHandle::emergencyCleanup()
289 descriptor_.provider_->emergencyCleanup(*
this);
309 if (!this->isValid())
310 throw error::Logic (
"attaching an object requires an buffer in locked state", LERR_(LIFECYCLE));
311 if (this->size() < type.determineBufferSize())
312 throw error::Logic (
"insufficient buffer size to hold an instance of that type");
314 descriptor_.provider_->attachTypeHandler(*
this, type);
allocated buffer, no longer in use
void attachTypeHandler(BuffHandle const &target, BufferDescriptor const &reference)
allow for attaching and owing an object within an already created buffer
#define ERROR_LOG_AND_IGNORE(_FLAG_, _OP_DESCR_)
convenience shortcut for a sequence of catch blocks just logging and consuming an error...
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
void releaseBuffer(BuffHandle const &)
BufferProvider API: declare done and detach.
inline string literal This is a marker type to indicate that
bool isTypeKey() const
is this Entry just an (abstract) placeholder for a type?
BuffHandle buildHandle(HashVal typeID, void *storage, LocalKey const &)
callback from implementation to build and enrol a BufferHandle, to be returned to the client as resul...
void emergencyCleanup(BuffHandle const &target, bool invokeDtor=false)
allocated buffer, returned from client
Entry & mark(BufferState newState)
Buffer state machine.
Steam-Layer implementation namespace root.
Derived specific exceptions within Lumiera's exception hierarchy.
an opaque ID to be used by the BufferProvider implementation.
uint announce(uint count, BufferDescriptor const &)
BufferProvider API: declare in advance the need for working buffers.
BufferDescriptor getDescriptorFor(size_t storageSize=0)
describe the kind of buffer managed by this provider
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
An opaque descriptor to identify the type and further properties of a data buffer.
bool isLocked() const
is this Entry currently associated to a concrete buffer? Is this buffer in use?
BuffHandle lockBuffer(BufferDescriptor const &)
BufferProvider API: retrieve a single buffer for exclusive use.
BufferProvider(Literal implementationID)
build a new provider instance, managing a family of buffers.
Lumiera error handling (C++ interface).
Handle for a buffer for processing data, abstracting away the actual implementation.
size_t HashVal
a STL compatible hash value
virtual ~BufferProvider()
this is an ABC
A pair of functors to maintain a datastructure within a buffer.
bool verifyValidity(BufferDescriptor const &) const
void emitBuffer(BuffHandle const &)
BufferProvider API: state transition to emitted state.
A complete metadata Entry, based on a Key.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
Abstraction to represent buffer management and lifecycle within the render engine.
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.