Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
BuffHandle Class Reference

#include "steam/engine/buffhandle.hpp"

Description

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

using PBuff = Buff *
 

Public Member Functions

 BuffHandle (BuffDescr const &typeInfo, void *storage=0)
 
 operator bool () const
 
void emit ()
 
void release ()
 
template<typename BU >
BU & create ()
 convenience shortcut: place and maintain an object within the buffer.
 
template<typename BU >
BU & accessAs ()
 convenience shortcut: access the buffer contents casted to a specific type.
 
Buffoperator* () const
 
bool isValid () const
 
HashVal entryID () const
 
size_t size () const
 

Private Types

using Buff = StreamType::ImplFacade::DataBuffer
 marker type for an actual data buffer
 

Private Member Functions

template<typename BU >
void takeOwnershipFor ()
 
void takeOwnershipFor (BuffDescr const &type)
 Install a standard TypeHandler for an already locked buffer.
 
void emergencyCleanup ()
 

Private Attributes

BuffDescr descriptor_
 
BuffpBuffer_
 

Constructor & Destructor Documentation

◆ BuffHandle()

BuffHandle ( BuffDescr const &  typeInfo,
void *  storage = 0 
)
inline

a buffer handle may be obtained by "locking" a buffer from the corresponding BufferProvider

Definition at line 124 of file buffhandle.hpp.

Member Typedef Documentation

◆ Buff

marker type for an actual data buffer

Definition at line 113 of file buffhandle.hpp.

◆ PBuff

using PBuff = Buff*

Definition at line 120 of file buffhandle.hpp.

Member Function Documentation

◆ operator bool()

operator bool ( ) const
inlineexplicit

Definition at line 131 of file buffhandle.hpp.

References BuffHandle::isValid().

+ Here is the call graph for this function:

◆ emit()

void emit ( )

Definition at line 280 of file buffer-provider.cpp.

References BuffHandle::descriptor_, BufferProvider::emitBuffer(), BuffHandle::isValid(), and BuffDescr::provider_.

Referenced by OutputProxyProvider_test::run(), and BufferProviderProtocol_test::verifySimpleUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ release()

◆ create()

template<typename BU >
BU & create ( )
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.

Exceptions
error::Logicin 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.

References _EXCEPTION_SAFE_INVOKE.

Referenced by BufferProviderProtocol_test::verifyObjectAttachment(), and BufferProviderProtocol_test::verifyObjectAttachmentFailure().

+ Here is the caller graph for this function:

◆ accessAs()

template<typename BU >
BU & accessAs ( )
inline

◆ operator*()

Buff & operator* ( ) const
inline

Definition at line 148 of file buffhandle.hpp.

References BuffHandle::pBuffer_.

◆ isValid()

bool isValid ( ) const
inline

Definition at line 155 of file buffhandle.hpp.

References BuffHandle::descriptor_, BuffHandle::pBuffer_, and BuffDescr::verifyValidity().

Referenced by BuffHandle::emit(), BuffHandle::operator bool(), BuffHandle::release(), OutputProxyProvider_test::run(), BuffHandle::takeOwnershipFor(), NodeBase_test::verify_FeedManifold(), BufferProviderProtocol_test::verifyObjectAttachmentFailure(), and BufferProviderProtocol_test::verifySimpleUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ entryID()

HashVal entryID ( ) const
inline

Definition at line 162 of file buffhandle.hpp.

References BuffHandle::descriptor_.

Referenced by BufferProvider::emergencyCleanup(), BufferProvider::emitBuffer(), BufferProvider::releaseBuffer(), TrackingInMemoryBlockSequence::trackFrame(), and TrackingInMemoryBlockSequence::transfer().

+ Here is the caller graph for this function:

◆ size()

size_t size ( ) const
inline

Definition at line 168 of file buffhandle.hpp.

References BuffHandle::descriptor_, and BuffDescr::determineBufferSize().

Referenced by BuffHandle::takeOwnershipFor(), BufferProviderProtocol_test::verifyObjectAttachment(), and BufferProviderProtocol_test::verifySimpleUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ takeOwnershipFor() [1/2]

template<typename BU >
void takeOwnershipFor ( )
inlineprivate

helper to attach an TypeHandler after-the fact.

Note
this prepares the buffer for placement-creating an embedded object. It doesn't actually create an object
Exceptions
error::Logicin 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 BuffHandle::descriptor_, BufferProvider::getDescriptor(), BuffDescr::provider_, and BuffHandle::takeOwnershipFor().

Referenced by BuffHandle::takeOwnershipFor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ takeOwnershipFor() [2/2]

void takeOwnershipFor ( BuffDescr const &  type)
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.

Parameters
typea 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
Exceptions
lifecycleerror when attempting to treat an buffer not in locked state
error::Logicin case of insufficient buffer space to hold the intended target object
Note
EX_STRONG

Definition at line 321 of file buffer-provider.cpp.

References BufferProvider::attachTypeHandler(), BuffHandle::descriptor_, BuffDescr::determineBufferSize(), BuffHandle::isValid(), LERR_, BuffDescr::provider_, and BuffHandle::size().

+ Here is the call graph for this function:

◆ emergencyCleanup()

void emergencyCleanup ( )
private

Definition at line 301 of file buffer-provider.cpp.

References BuffHandle::descriptor_, BufferProvider::emergencyCleanup(), BuffHandle::pBuffer_, and BuffDescr::provider_.

+ Here is the call graph for this function:

Member Data Documentation

◆ descriptor_

◆ pBuffer_

+ Collaboration diagram for BuffHandle:

The documentation for this class was generated from the following files: