Field definition describing a single data member of a data structure.
More...
#include <Field.h>
|
template<typename ClassType , typename FieldType > |
| Field (const Name &name, FieldType ClassType::*field) |
| Initializes a new field instance with the given name and the given pointer to member data.
|
|
| Field (const Field &other)=default |
| Default copy constructor.
|
|
| Field (Field &&other) noexcept=default |
| Default move constructor.
|
|
Field & | operator= (const Field &other)=default |
| Default copy assignment operator.
|
|
Field & | operator= (Field &&other) noexcept=default |
| Default move assignment operator.
|
|
template<typename FieldValueType > |
FieldValueType * | getPtr (void *container) const |
| Get a pointer to this field on the given container.
|
|
template<typename FieldValueType > |
const FieldValueType * | getPtr (const void *container) const |
| Get a const pointer to this field on the given container.
|
|
const Name & | getName () const |
| Get the name of the field.
|
|
TypeId | getTypeId () const |
| Get the type id of the field.
|
|
size_t | getOffset () const |
| Get the fields offset from the start of the structure in bytes.
|
|
FieldFlags | getFlags () const |
| Get the field flags.
|
|
bool | isSet (FieldFlags flag) const |
| Checks if the given flag(s) is set. Requires exact bit match if test of several bits.
|
|
size_t | getDimensions () const |
| Get the array dimensions of the field. Returns zero if the field is not an array.
|
|
Field & | setSerialize (bool serialize) |
| Mark if field shall be serializable, e.g. value saved generating Scene. Default = true.
|
|
template<typename T > |
Field & | add (T attribute) |
| Adds the given attribute.
|
|
template<typename T > |
const T * | get () const |
| Retrieve an attribute of the given type from storage, if present.
|
|
|
template<typename ClassType , typename FieldType > |
static FieldWrapper< Field, FieldType > | create (const Name &name, FieldType ClassType::*field) |
| Creates a new field instance, returning a wrapper for type safe continuation style setup.
|
|
Field definition describing a single data member of a data structure.
◆ Field() [1/3]
template<typename ClassType , typename FieldType >
Cogs::Reflection::Field::Field |
( |
const Name & |
name, |
|
|
FieldType ClassType::* |
field |
|
) |
| |
◆ Field() [2/3]
Cogs::Reflection::Field::Field |
( |
const Field & |
other | ) |
|
|
default |
Default copy constructor.
◆ Field() [3/3]
Cogs::Reflection::Field::Field |
( |
Field && |
other | ) |
|
|
defaultnoexcept |
Default move constructor.
◆ add()
Field & Cogs::Reflection::Field::add |
( |
T |
attribute | ) |
|
|
inline |
◆ create()
template<typename ClassType , typename FieldType >
FieldWrapper< Field, FieldType > Cogs::Reflection::Field::create |
( |
const Name & |
name, |
|
|
FieldType ClassType::* |
field |
|
) |
| |
|
static |
Creates a new field instance, returning a wrapper for type safe continuation style setup.
- See also
- Field::Field()
References name.
◆ get()
const T * Cogs::Reflection::Field::get |
( |
| ) |
const |
|
inline |
◆ getDimensions()
size_t Cogs::Reflection::Field::getDimensions |
( |
| ) |
const |
|
inline |
Get the array dimensions of the field. Returns zero if the field is not an array.
◆ getFlags()
FieldFlags Cogs::Reflection::Field::getFlags |
( |
| ) |
const |
|
inline |
◆ getName()
const Name & Cogs::Reflection::Field::getName |
( |
| ) |
const |
|
inline |
Get the name of the field.
◆ getOffset()
size_t Cogs::Reflection::Field::getOffset |
( |
| ) |
const |
|
inline |
Get the fields offset from the start of the structure in bytes.
◆ getPtr() [1/2]
template<typename FieldValueType >
const FieldValueType * Cogs::Reflection::Field::getPtr |
( |
const void * |
container | ) |
const |
|
inline |
Get a const pointer to this field on the given container.
- Parameters
-
container | Field container, e.g. component |
- Template Parameters
-
FieldValueType | The type of the field. |
◆ getPtr() [2/2]
template<typename FieldValueType >
FieldValueType * Cogs::Reflection::Field::getPtr |
( |
void * |
container | ) |
const |
|
inline |
Get a pointer to this field on the given container.
- Parameters
-
container | Field container, e.g. component |
- Template Parameters
-
FieldValueType | The type of the field. |
◆ getTypeId()
TypeId Cogs::Reflection::Field::getTypeId |
( |
| ) |
const |
|
inline |
Get the type id of the field.
◆ isSet()
bool Cogs::Reflection::Field::isSet |
( |
FieldFlags |
flag | ) |
const |
|
inline |
Checks if the given flag(s) is set. Requires exact bit match if test of several bits.
◆ operator=() [1/2]
Field & Cogs::Reflection::Field::operator= |
( |
const Field & |
other | ) |
|
|
default |
Default copy assignment operator.
◆ operator=() [2/2]
Field & Cogs::Reflection::Field::operator= |
( |
Field && |
other | ) |
|
|
defaultnoexcept |
Default move assignment operator.
◆ setSerialize()
Field & Cogs::Reflection::Field::setSerialize |
( |
bool |
serialize | ) |
|
|
inline |
Mark if field shall be serializable, e.g. value saved generating Scene. Default = true.
◆ unsetFlag()
void Cogs::Reflection::Field::unsetFlag |
( |
FieldFlags |
flag | ) |
|
|
inlineprivate |
◆ arrayDimensions
size_t Cogs::Reflection::Field::arrayDimensions = 0 |
|
private |
◆ attributes
◆ byteSize
size_t Cogs::Reflection::Field::byteSize |
|
private |
Size of the field in bytes.
◆ fieldFlags
◆ name
Name Cogs::Reflection::Field::name |
|
private |
◆ offset
size_t Cogs::Reflection::Field::offset |
|
private |
Offset of the field in bytes from the beginning of the container.
◆ typeId
TypeId Cogs::Reflection::Field::typeId |
|
private |
The documentation for this class was generated from the following files: