46 "cannot create ref to empty type");
92 if (!world_ || !ref_.entity) {
131 T* result =
static_cast<T*
>(
get());
134 "nullptr dereference by flecs::ref");
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t component)
Get the type info for a component.
ecs_entity_t entity_t
Entity type.
ecs_world_t world_t
World type.
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t component)
Get a component from a ref.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Create a component ref.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t component)
Get the type for a component.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
Type that contains component information (passed to ctors/dtors/...).
ecs_size_t size
Size of the type.
Class that wraps around a flecs::id_t.
ref(world_t *world, entity_t entity, flecs::id_t id=0)
Construct a reference from a world, entity, and optional component ID.
T * try_get()
Try to get a typed pointer to the component value.
ref()
Default constructor.
T * operator->()
Dereference operator.
T * get()
Get a typed pointer to the component value.
Untyped component reference.
untyped_ref(world_t *world, entity_t entity, flecs::id_t id)
Construct a reference from a world, entity, and component ID.
flecs::id component() const
Return the component associated with the reference.
untyped_ref()
Default constructor.
void * get()
Get a pointer to the component value.
void * try_get()
Try to get a pointer to the component value.
bool has()
Check if the reference has a valid component value.
flecs::world world() const
Get the world associated with the reference.
flecs::entity entity() const
Return the entity associated with the reference.