Lumiera
0.pre.03
»edit your freedom«
|
#include "steam/engine/buffer-metadata.hpp"
Registry for managing buffer metadata.
This is an implementation level service, used by the standard BufferProvider implementation. Each metadata registry (instance) defines and maintains a family of "buffer types"; beyond the buffer storage size, the concrete meaning of those types is tied to the corresponding BufferProvider implementation and remains opaque. These types are represented as hierarchically linked hash keys. The implementation may bind a TypeHandler to a specific type, allowing automatic invocation of a "constructor" and "destructor" function on each buffer of this type, when locking or freeing the corresponding buffer.
Definition at line 539 of file buffer-metadata.hpp.
Public Types | |
typedef metadata::Entry | Entry |
typedef metadata::Key | Key |
Public Member Functions | |
BufferMetadata (Literal implementationID) | |
establish a metadata registry. More... | |
Entry & | get (HashVal hashID) |
access the metadata record registered with the given hash key. More... | |
bool | isKnown (HashVal key) const |
bool | isLocked (HashVal key) const |
Key | key (size_t storageSize, TypeHandler instanceFunc=RAW_BUFFER, LocalKey specifics=UNSPECIFIC) |
combine the distinguishing properties into a single type key, which will be known/remembered from that point on. More... | |
Key | key (Key const &parentKey, TypeHandler const &instanceFunc) |
create a sub-type, using a different type/handler functor | |
Key | key (Key const &parentKey, LocalKey specifics) |
create a sub-type, using a different private-ID (implementation defined) | |
Key const & | key (Key const &parentKey, void *concreteBuffer, LocalKey const &implID=UNSPECIFIC) |
shortcut to access the Key part of a (probably new) Entry describing a concrete buffer at the given address More... | |
Entry & | lock (Key const &parentKey, void *concreteBuffer, LocalKey const &implID=UNSPECIFIC, bool onlyNew=false) |
core operation to access or create a concrete buffer metadata entry. More... | |
Entry & | markLocked (Key const &parentKey, void *buffer, LocalKey const &implID=UNSPECIFIC) |
combine the type (Key) with a concrete buffer, thereby marking this buffer as locked. More... | |
void | release (HashVal key) |
purge the bare metadata Entry from the metadata tables. More... | |
void | release (Entry const &entry) |
Private Member Functions | |
void | maybeStore (Key const &key) |
Entry & | store_and_lock (Entry const &metadata) |
template<typename PAR , typename DEF > | |
Key | trackKey (PAR parent, DEF specialisation) |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
Private Attributes | |
HashVal | family_ |
Literal | id_ |
metadata::Table | table_ |
|
inline |
establish a metadata registry.
Such will maintain a family of buffer type entries and provide a service for storing and retrieving metadata for concrete buffer entries associated with these types.
implementationID | to distinguish families of type keys belonging to different registries. |
Definition at line 559 of file buffer-metadata.hpp.
|
inline |
combine the distinguishing properties into a single type key, which will be known/remembered from that point on.
Properties are combined according to a fixed type specialisation order, with the buffer size forming the base level, possible TypeHandler functors the second level, and implementation defined LocalKey entries the third level. All these levels describe abstract type keys, not entries for concrete buffers. The latter are always created as children of a known type key.
Definition at line 575 of file buffer-metadata.hpp.
|
inline |
shortcut to access the Key part of a (probably new) Entry describing a concrete buffer at the given address
Definition at line 611 of file buffer-metadata.hpp.
|
inline |
core operation to access or create a concrete buffer metadata entry.
The hashID of the entry in question is built, based on the parentKey, which denotes a buffer type, and the concrete buffer address. If yet unknown, a new concrete buffer metadata Entry is created and initialised to LOCKED state. Otherwise just the existing Entry is fetched.
parentKey | a key describing the type of the buffer |
concreteBuffer | storage pointer, must not be NULL |
onlyNew | disallow fetching an existing entry |
error::Logic | when #onlyNew is set, but an equivalent entry was registered previously. This indicates a serious error in buffer lifecycle management. |
error::Invalid | when invoked with NULL buffer. Use the key functions instead to register and track type keys. |
Definition at line 643 of file buffer-metadata.hpp.
|
inline |
access the metadata record registered with the given hash key.
This might be a pseudo entry in case of a Key describing a buffer type. Otherwise, the entry associated with a concrete buffer pointer is returned by reference, an can be modified (e.g. state change)
hashID | which can be calculated from the Key |
error::Invalid | when there is no such entry |
Definition at line 678 of file buffer-metadata.hpp.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), and Table::fetch().
Referenced by WrappedStandardExeBuilder::__call__().
|
inline |
combine the type (Key) with a concrete buffer, thereby marking this buffer as locked.
Store a concrete metadata Entry to account for this fact. This might include invoking a constructor function, in case the type (Key) defines a (nontrivial) TypeHandler.
error::Fatal | when locking a NULL buffer |
exceptions | which might be raised by a TypeHandler's constructor function. In this case, the Entry remains created, but is marked as FREE |
Definition at line 716 of file buffer-metadata.hpp.
|
inline |
purge the bare metadata Entry from the metadata tables.
error::Logic | if the entry isn't marked FREE already |
Definition at line 729 of file buffer-metadata.hpp.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), Table::fetch(), and steam::engine::FREE.