Lumiera
0.pre.03
»edit your freedom«
|
#include "steam/engine/buffhandle.hpp"
Handle for a buffer for processing data, abstracting away the actual implementation.
The real buffer pointer can be retrieved by dereferencing this smart-handle class.
Definition at line 111 of file buffhandle.hpp.
Public Types | |
typedef Buff * | PBuff |
Public Member Functions | |
BuffHandle (BuffDescr const &typeInfo, void *storage=0) | |
template<typename BU > | |
BU & | accessAs () |
convenience shortcut: access the buffer contents casted to a specific type. More... | |
template<typename BU > | |
BU & | create () |
convenience shortcut: place and maintain an object within the buffer. More... | |
void | emit () |
HashVal | entryID () const |
bool | isValid () const |
operator bool () const | |
Buff & | operator* () const |
void | release () |
size_t | size () const |
Private Types | |
using | Buff = StreamType::ImplFacade::DataBuffer |
marker type for an actual data buffer | |
Private Member Functions | |
void | emergencyCleanup () |
template<typename BU > | |
void | takeOwnershipFor () |
void | takeOwnershipFor (BuffDescr const &type) |
Install a standard TypeHandler for an already locked buffer. More... | |
Private Attributes | |
BuffDescr | descriptor_ |
Buff * | pBuffer_ |
|
inline |
a buffer handle may be obtained by "locking" a buffer from the corresponding BufferProvider
Definition at line 124 of file buffhandle.hpp.
|
inline |
convenience shortcut: place and maintain an object within the buffer.
This operation performs the necessary steps to attach an object; if the buffer isn't locked yet, it will do so. Moreover, the created object will be owned by the buffer management facilities, i.e. the destructor is registered as cleanup function.
error::Logic | in case there is already another TypeHandler registered in charge of managing the buffer contents, or when the object to create would not fit into this buffer. |
Definition at line 76 of file buffhandle-attach.hpp.
|
inline |
convenience shortcut: access the buffer contents casted to a specific type.
Definition at line 110 of file buffhandle-attach.hpp.
|
inlineprivate |
helper to attach an TypeHandler after-the fact.
error::Logic | in case there is already another TypeHandler registered in charge of managing the buffer contents, or when the object to create would not fit into this buffer. |
Definition at line 95 of file buffhandle-attach.hpp.
References BufferProvider::getDescriptor().
|
private |
Install a standard TypeHandler for an already locked buffer.
This causes the dtor function to be invoked when releasing this buffer. The assumption is that client code will placement-construct an object into this buffer right away, and thus we're taking ownership on that object.
type | a reference BuffDescr defining an embedded TypeHandler to use A copy of this TypeHandler will be stored into the local metadata for this buffer only, not altering the basic buffer type in any way |
lifecycle | error when attempting to treat an buffer not in locked state |
error::Logic | in case of insufficient buffer space to hold the intended target object |
Definition at line 320 of file buffer-provider.cpp.