21template <
typename Self>
22template <
typename Func>
29template<
typename Enum>
35template<
typename First>
63template <
typename First,
typename Second>
74 "cannot use read-only world/stage to create mutable handle");
80 "cannot use iterator created for read-only world/stage to create mutable handle");
86 "cannot use entity created for read-only world/stage to create mutable handle");
106 ECS_RECORD_TO_ROW(r->row), 1);
113template <
bool Match,
typename Func>
123 for (int32_t cur = 0; cur < count; cur ++) {
124 if constexpr (Match) {
134 const ecs_record_t *r = ecs_record_find(real_world, entity);
135 if (r && (r->row & EcsEntityHasDontFragment)) {
136 for (
auto cr = flecs_component_dont_fragment_first(real_world); cr;
137 cr = flecs_component_dont_fragment_next(cr))
139 auto id = flecs_component_get_id(cr);
143 auto sparse = flecs_component_get_sparse(cr);
144 if (sparse && flecs_sparse_has(sparse, entity)) {
154template <
typename Func>
159template <
typename Func>
161 _::each_id<true>(
world_,
id_, obj ? ecs_pair(pred, obj) : pred, func);
164template <
typename Func>
172template <typename Func, if_t< is_callable<Func>::value > >
173inline bool entity_view::get(
const Func& func)
const {
194template <
typename... Args>
199template <typename E, if_t< is_enum<E>::value >>
205template <typename E, if_t< is_enum<E>::value >>
enum_data< E > enum_type(flecs::world_t *world)
Convenience function for getting enum reflection data.
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
flecs::entity entity(Args &&... args) const
Create an entity.
E to_constant() const
Convert an entity to an enum constant.
ecs_entity_t entity_t
Entity type.
ecs_world_t world_t
World type.
ecs_entity_t ecs_clone(ecs_world_t *world, ecs_entity_t dst, ecs_entity_t src, bool copy_value)
Clone an entity.
ecs_entity_t ecs_new(ecs_world_t *world)
Create new entity ID.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
ecs_entity_t ecs_get_parent(const ecs_world_t *world, ecs_entity_t entity)
Get the parent (target of the ChildOf relationship) for an entity.
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t component)
Get the target of a relationship for a given component.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
bool ecs_id_match(ecs_id_t component, ecs_id_t pattern)
Utility to match a component with a pattern.
bool ecs_id_is_wildcard(ecs_id_t component)
Utility to check if a component is a wildcard.
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Look up an entity from a path.
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_id_t *component_out)
Search for a component in a table type starting from an offset.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get the type for a table.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
A type is a list of (component) IDs.
const Self & insert(const Func &func) const
Set 1..N components.
flecs::type type() const
Get the entity's type.
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
flecs::table_range range() const
Get table range for the entity.
flecs::entity target_for(flecs::entity_t relationship, flecs::id_t id) const
Get the target of a pair for a given relationship ID.
flecs::entity clone(bool clone_value=true, flecs::entity_t dst_id=0) const
Clone an entity.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
flecs::table table() const
Get the entity's table.
flecs::entity parent() const
Get parent of entity.
void each(const Func &func) const
Iterate (component) IDs of an entity.
Enum get_constant() const
Get enum constant for enum relationship.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
flecs::entity mut(const flecs::world &stage) const
Return a mutable entity handle for the current stage.
Class that wraps around a flecs::id_t.
flecs::world world() const
Get the world.
flecs::id_t id_
The raw ID value.
flecs::entity second() const
Get second element from a pair.
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
Class for iterating over query results.
flecs::world world() const
Get the world associated with the iterator.
ref()
Default constructor.
flecs::id_t * array() const
Return a pointer to the ID array.
int32_t count() const
Return the number of IDs in the type.
untyped_ref()
Default constructor.
flecs::world world() const
Get the world associated with the reference.
flecs::entity entity() const
Return the entity associated with the reference.
world_t * world_
Pointer to the underlying C world.
flecs::id id() const
Get ID from a type.
world_t * c_ptr() const
Obtain a pointer to the C world object.
bool is_readonly() const
Test whether the current world object is readonly.
flecs::id id(E value) const
Convert an enum constant to an entity.