Lumiera  0.pre.03
»edit your freedom«
TypeHandler Struct Reference

#include "steam/engine/type-handler.hpp"

Description

A pair of functors to maintain a datastructure within a buffer.

TypeHandler describes how to outfit the buffer in a specific way. Special convenience builder function(s) are provided to create a TypeHandler performing placement-new into a buffer given on invocation.

Note
engine::BufferMetadata uses a TypeHandler to represent any special treatment of a buffer space. When defined, the buffer will be prepared on locking and cleanup will be invoked automatically when releasing.
Warning
comparison and hash values are based merely on the type of the Ctor and Dtor functions – so all type handlers bound to the same functor type count as equivalent. This might not be what you'd expect, however, there is no sane way to test for equivalence of functors anyway. In the typical usage, a TypeHandler will be created by TypeHandler::create<TY>(), and thus will be dedicated to a given type to be placed into the storage buffer.

Definition at line 118 of file type-handler.hpp.

Public Types

typedef function< void(void *)> DoInBuffer
 

Public Member Functions

 TypeHandler ()
 build an invalid NIL TypeHandler
 
template<typename CTOR , typename DTOR >
 TypeHandler (CTOR ctor, DTOR dtor)
 build a TypeHandler binding to arbitrary constructor and destructor functions. More...
 
bool isValid () const
 

Static Public Member Functions

template<class X >
static TypeHandler create ()
 builder function defining a TypeHandler to place a default-constructed object into the buffer. More...
 
template<class X , typename A1 >
static TypeHandler create (A1 a1)
 

Public Attributes

DoInBuffer createAttached
 
DoInBuffer destroyAttached
 
HashVal identity
 

Friends

HashVal hash_value (TypeHandler const &handler)
 
bool operator!= (TypeHandler const &left, TypeHandler const &right)
 
bool operator== (TypeHandler const &left, TypeHandler const &right)
 

Constructor & Destructor Documentation

◆ TypeHandler()

TypeHandler ( CTOR  ctor,
DTOR  dtor 
)
inline

build a TypeHandler binding to arbitrary constructor and destructor functions.

On invocation, these functions get a void* to the buffer.

Note
the functor objects created from these operations might be shared for handling multiple buffers. Be careful with any state or arguments.

Definition at line 141 of file type-handler.hpp.

Member Function Documentation

◆ create()

static TypeHandler create ( )
inlinestatic

builder function defining a TypeHandler to place a default-constructed object into the buffer.

Definition at line 152 of file type-handler.hpp.

+ Collaboration diagram for TypeHandler:

The documentation for this struct was generated from the following file: