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 115 of file buffhandle.hpp.
Public Types | |
typedef Buff * | PBuff |
Public Member Functions | |
BuffHandle (BufferDescriptor 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 | |
typedef StreamType::ImplFacade::DataBuffer | Buff |
Private Member Functions | |
void | emergencyCleanup () |
template<typename BU > | |
void | takeOwnershipFor () |
void | takeOwnershipFor (BufferDescriptor const &type) |
Install a standard TypeHandler for an already locked buffer. More... | |
Private Attributes | |
BufferDescriptor | descriptor_ |
Buff * | pBuffer_ |
|
inline |
a buffer handle may be obtained by "locking" a buffer from the corresponding BufferProvider
Definition at line 128 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 85 of file buffhandle-attach.hpp.
|
inline |
convenience shortcut: access the buffer contents casted to a specific type.
Definition at line 119 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 104 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 BufferDescriptor 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 307 of file buffer-provider.cpp.