Function set

Summary

#include <include/flecs/addons/cpp/world.hpp>

(1) template <typename T, if_t< is_flecs_constructible< T >::value > = 0>
    void set(world_t *world, entity_t entity, T &&value, ecs_id_t id)

(2) template <typename T, if_t< is_flecs_constructible< T >::value > = 0>
    void set(world_t *world, entity_t entity, const T &value, ecs_id_t id)

(3) template <typename T, if_not_t< is_flecs_constructible< T >::value > = 0>
    void set(world_t *world, id_t entity, const T &value, id_t id)

(4) template <typename T, typename A>
    void set(world_t *world, entity_t entity, A &&value)

(5) template <typename T, typename A>
    void set(world_t *world, entity_t entity, const A &value)

Function overload

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, if_t< is_flecs_constructible< T >::value > = 0>
void set(world_t *world, entity_t entity, T &&value, ecs_id_t id)

Description

Static helper functions to assign a component value

Source

Lines 8-16 in include/flecs/addons/cpp/world.hpp.

template <typename T, if_t< is_flecs_constructible<T>::value > = 0>
inline void set(world_t *world, entity_t entity, T&& value, ecs_id_t id) {
    ecs_assert(_::cpp_type<T>::size() != 0, ECS_INVALID_PARAMETER, NULL);

    T& dst = *static_cast<T*>(ecs_get_mut_id(world, entity, id, NULL));
    dst = std::move(value);

    ecs_modified_id(world, entity, id);
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, if_t< is_flecs_constructible< T >::value > = 0>
void set(world_t *world, entity_t entity, const T &value, ecs_id_t id)

Description

No description yet.

Source

Lines 19-27 in include/flecs/addons/cpp/world.hpp.

template <typename T, if_t< is_flecs_constructible<T>::value > = 0>
inline void set(world_t *world, entity_t entity, const T& value, ecs_id_t id) {
    ecs_assert(_::cpp_type<T>::size() != 0, ECS_INVALID_PARAMETER, NULL);

    T& dst = *static_cast<T*>(ecs_get_mut_id(world, entity, id, NULL));
    dst = value;

    ecs_modified_id(world, entity, id);
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, if_not_t< is_flecs_constructible< T >::value > = 0>
void set(world_t *world, id_t entity, const T &value, id_t id)

Description

No description yet.

Source

Lines 46-58 in include/flecs/addons/cpp/world.hpp.

template <typename T, if_not_t< is_flecs_constructible<T>::value > = 0>
inline void set(world_t *world, id_t entity, const T& value, id_t id) {
    ecs_assert(_::cpp_type<T>::size() != 0, ECS_INVALID_PARAMETER, NULL);

    bool is_new = false;
    T& dst = *static_cast<T*>(ecs_get_mut_id(world, entity, id, &is_new));

    /* If type is not constructible get_mut should assert on new values */
    ecs_assert(!is_new, ECS_INTERNAL_ERROR, NULL);
    dst = value;

    ecs_modified_id(world, entity, id);
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, typename A>
void set(world_t *world, entity_t entity, A &&value)

Description

No description yet.

Source

Lines 81-85 in include/flecs/addons/cpp/world.hpp.

template <typename T, typename A>
inline void set(world_t *world, entity_t entity, A&& value) {
    id_t id = _::cpp_type<T>::id(world);
    flecs::set(world, entity, std::forward<A&&>(value), id);
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, typename A>
void set(world_t *world, entity_t entity, const A &value)

Description

No description yet.

Source

Lines 88-92 in include/flecs/addons/cpp/world.hpp.

template <typename T, typename A>
inline void set(world_t *world, entity_t entity, const A& value) {
    id_t id = _::cpp_type<T>::id(world);
    flecs::set(world, entity, value, id);
}