Cogs.Core
|
An attribute containing metadata or describing behavior of a structure. More...
#include <Attributes.h>
Public Member Functions | |
TypeId | getType () const |
Get the type of the derived attribute class. | |
TypeId | getGenericType () const |
bool | isRuntime () const |
Gets value of the runtime attribute flag. | |
Protected Member Functions | |
Attribute (TypeId type) | |
Constructs an attribute instance with the given type. | |
Attribute (TypeId type, TypeId genericType, bool runtime=true) | |
Constructs a generic attribute instance with the given type and generic type parameter. | |
template<typename T > | |
T & | get (size_t index=0) |
Get the stored value of the given type, with an optional index. | |
template<typename T > | |
const T & | get (size_t index=0) const |
See non-const get() implementation. | |
An attribute containing metadata or describing behavior of a structure.
Attributes can be used to store arbitrary metadata on a structure. The base attribute class is designed to offer data storage and type information for derived attributes.
Derived types shall not have local storage.
Definition at line 24 of file Attributes.h.
|
inlineprotected |
Constructs an attribute instance with the given type.
type | Type id of the derived attribute type. |
Definition at line 43 of file Attributes.h.
|
inlineprotected |
Constructs a generic attribute instance with the given type and generic type parameter.
type | Type id of the derived attribute type. |
genericType | Type id of the derived attributes template value type. |
runtime | bool True if the attribute can be used for runtime information, false if code-generation. |
Definition at line 52 of file Attributes.h.
|
inlineprotected |
Get the stored value of the given type, with an optional index.
If an index is given, the storage is assumed to contain an array of values of type T, and the index is used to look up the nth value.
Type | of the value to retrieve. |
index | Optional array index of the value to retrieve. |
Definition at line 71 of file Attributes.h.
|
inlineprotected |
See non-const get() implementation.
Definition at line 80 of file Attributes.h.
|
inline |
Gets an optional generic type parameter when the derived attribute class is a template.
Definition at line 32 of file Attributes.h.
|
inline |
Get the type of the derived attribute class.
Definition at line 28 of file Attributes.h.
|
inline |
Gets value of the runtime attribute flag.
Definition at line 35 of file Attributes.h.