Function import


#include <include/flecs/addons/cpp/mixins/module/impl.hpp>

template <typename T>
flecs::entity import(world &world)


No description yet.

Mentioned in


Lines 31-55 in include/flecs/addons/cpp/mixins/module/impl.hpp.

template <typename T>
flecs::entity import(world& world) {
    const char *symbol = _::symbol_name<T>();

    ecs_entity_t m = ecs_lookup_symbol(world, symbol, true);

    if (!_::cpp_type<T>::registered(world)) {

        /* Module is registered with world, initialize static data */
        if (m) {
            _::cpp_type<T>::init(world, m, false);

        /* Module is not yet registered, register it now */
        } else {
            m = do_import<T>(world, symbol);

    /* Module has been registered, but could have been for another world. Import
     * if module hasn't been registered for this world. */
    } else if (!m) {
        m = do_import<T>(world, symbol);

    return flecs::entity(world, m);