template<typename T>
cubos::core::ecs::TypeBuilder class

Builder for reflection::Type objects which represent ECS types.

Template parameters
T Relation type.

Used to reduce the amount of boilerplate code required to define a ECS types. Automatically adds the reflection::ConstructibleTrait and reflection::FieldsTrait. The type T must be default-constructible, copy-constructible and move-constructible.

Constructors, destructors, conversion operators

TypeBuilder(std::string name)
Constructs.

Public functions

auto symmetric() && -> TypeBuilder&&
Makes the type symmetric. Only used by relation types.
auto tree() && -> TypeBuilder&&
Makes the type a tree relation. Only used by relation types.
auto ephemeral() && -> TypeBuilder&&
Makes the type ephemeral.
template<typename F>
auto withField(std::string name, F T::* pointer) && -> TypeBuilder&&
Adds a field to the type.
auto build() && -> reflection::Type&
Builds the type.

Function documentation

template<typename T>
cubos::core::ecs::TypeBuilder<T>::TypeBuilder(std::string name)

Constructs.

Parameters
name Type name, including namespace.

template<typename T>
TypeBuilder&& cubos::core::ecs::TypeBuilder<T>::symmetric() &&

Makes the type symmetric. Only used by relation types.

Returns Builder.

template<typename T>
TypeBuilder&& cubos::core::ecs::TypeBuilder<T>::tree() &&

Makes the type a tree relation. Only used by relation types.

Returns Builder.

template<typename T>
TypeBuilder&& cubos::core::ecs::TypeBuilder<T>::ephemeral() &&

Makes the type ephemeral.

Returns Builder.

template<typename T> template<typename F>
TypeBuilder&& cubos::core::ecs::TypeBuilder<T>::withField(std::string name, F T::* pointer) &&

Adds a field to the type.

Template parameters
F Field type.
Parameters
name Field name.
pointer Field pointer.
Returns Builder.

template<typename T>
reflection::Type& cubos::core::ecs::TypeBuilder<T>::build() &&

Builds the type.

Returns Relation type.