Function import
Synopsis
#include <include/flecs/cpp/module.hpp>
template <typename T>
flecs::entity import(world &world)
Description
No description yet.
Mentioned in
- Manual / Modules in C++
Source
Lines 61-85 in include/flecs/cpp/module.hpp.
template <typename T>
flecs::entity import(world& world) {
const char *symbol = _::symbol_helper<T>::symbol();
ecs_entity_t m = ecs_lookup_symbol(world.c_ptr(), symbol);
if (!_::cpp_type<T>::registered()) {
/* Module is registered with world, initialize static data */
if (m) {
_::cpp_type<T>::init(world.c_ptr(), m, false);
/* Module is not yet registered, register it now */
} else {
m = do_import<T>(world);
}
/* 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);
}
return flecs::entity(world, m);
}