Flecs: include/flecs/addons/cpp/c_types.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
c_types.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8namespace flecs {
9
17
18using world_t = ecs_world_t;
19using world_info_t = ecs_world_info_t;
20using id_t = ecs_id_t;
21using entity_t = ecs_entity_t;
22using type_t = ecs_type_t;
23using table_t = ecs_table_t;
24using term_t = ecs_term_t;
25using query_t = ecs_query_t;
26using query_group_info_t = ecs_query_group_info_t;
27using observer_t = ecs_observer_t;
28using iter_t = ecs_iter_t;
29using ref_t = ecs_ref_t;
30using table_record_t = ecs_table_record_t;
31using table_records_t = ecs_table_records_t;
32using component_record_t = ecs_component_record_t;
33using type_info_t = ecs_type_info_t;
34using type_hooks_t = ecs_type_hooks_t;
35using flags32_t = ecs_flags32_t;
36using flags64_t = ecs_flags64_t;
37
38enum inout_kind_t {
39 InOutDefault = EcsInOutDefault,
40 InOutNone = EcsInOutNone,
41 InOutFilter = EcsInOutFilter,
42 InOut = EcsInOut,
43 In = EcsIn,
44 Out = EcsOut
45};
46
47enum oper_kind_t {
48 And = EcsAnd,
49 Or = EcsOr,
50 Not = EcsNot,
51 Optional = EcsOptional,
52 AndFrom = EcsAndFrom,
53 OrFrom = EcsOrFrom,
54 NotFrom = EcsNotFrom
55};
56
57enum query_cache_kind_t {
58 QueryCacheDefault = EcsQueryCacheDefault,
59 QueryCacheAuto = EcsQueryCacheAuto,
60 QueryCacheAll = EcsQueryCacheAll,
61 QueryCacheNone = EcsQueryCacheNone
62};
63
65static const flecs::entity_t PAIR = ECS_PAIR;
66static const flecs::entity_t AUTO_OVERRIDE = ECS_AUTO_OVERRIDE;
67static const flecs::entity_t TOGGLE = ECS_TOGGLE;
68
72
73/* Builtin components */
74using Component = EcsComponent;
75using Identifier = EcsIdentifier;
76using Poly = EcsPoly;
77using DefaultChildComponent = EcsDefaultChildComponent;
78
79/* Builtin tags */
80static const flecs::entity_t Query = EcsQuery;
81static const flecs::entity_t Observer = EcsObserver;
82static const flecs::entity_t Private = EcsPrivate;
83static const flecs::entity_t Module = EcsModule;
84static const flecs::entity_t Prefab = EcsPrefab;
85static const flecs::entity_t Disabled = EcsDisabled;
86static const flecs::entity_t Empty = EcsEmpty;
87static const flecs::entity_t Monitor = EcsMonitor;
88static const flecs::entity_t System = EcsSystem;
89static const flecs::entity_t Pipeline = ecs_id(EcsPipeline);
90static const flecs::entity_t Phase = EcsPhase;
91static const flecs::entity_t Constant = EcsConstant;
92
93/* Builtin event tags */
94static const flecs::entity_t OnAdd = EcsOnAdd;
95static const flecs::entity_t OnRemove = EcsOnRemove;
96static const flecs::entity_t OnSet = EcsOnSet;
97static const flecs::entity_t OnTableCreate = EcsOnTableCreate;
98static const flecs::entity_t OnTableDelete = EcsOnTableDelete;
99
100/* Builtin term flags */
101static const uint64_t Self = EcsSelf;
102static const uint64_t Up = EcsUp;
103static const uint64_t Trav = EcsTrav;
104static const uint64_t Cascade = EcsCascade;
105static const uint64_t Desc = EcsDesc;
106static const uint64_t IsVariable = EcsIsVariable;
107static const uint64_t IsEntity = EcsIsEntity;
108static const uint64_t IsName = EcsIsName;
109static const uint64_t TraverseFlags = EcsTraverseFlags;
110static const uint64_t TermRefFlags = EcsTermRefFlags;
111
112/* Builtin entity ids */
113static const flecs::entity_t Flecs = EcsFlecs;
114static const flecs::entity_t FlecsCore = EcsFlecsCore;
115static const flecs::entity_t World = EcsWorld;
116
117/* Component traits */
118static const flecs::entity_t Wildcard = EcsWildcard;
119static const flecs::entity_t Any = EcsAny;
120static const flecs::entity_t This = EcsThis;
121static const flecs::entity_t Transitive = EcsTransitive;
122static const flecs::entity_t Reflexive = EcsReflexive;
123static const flecs::entity_t Final = EcsFinal;
124static const flecs::entity_t Inheritable = EcsInheritable;
125static const flecs::entity_t PairIsTag = EcsPairIsTag;
126static const flecs::entity_t Exclusive = EcsExclusive;
127static const flecs::entity_t Acyclic = EcsAcyclic;
128static const flecs::entity_t Traversable = EcsTraversable;
129static const flecs::entity_t Symmetric = EcsSymmetric;
130static const flecs::entity_t With = EcsWith;
131static const flecs::entity_t OneOf = EcsOneOf;
132static const flecs::entity_t Trait = EcsTrait;
133static const flecs::entity_t Relationship = EcsRelationship;
134static const flecs::entity_t Target = EcsTarget;
135static const flecs::entity_t CanToggle = EcsCanToggle;
136
137/* OnInstantiate trait */
138static const flecs::entity_t OnInstantiate = EcsOnInstantiate;
139static const flecs::entity_t Override = EcsOverride;
140static const flecs::entity_t Inherit = EcsInherit;
141static const flecs::entity_t DontInherit = EcsDontInherit;
142
143/* OnDelete/OnDeleteTarget traits */
144static const flecs::entity_t OnDelete = EcsOnDelete;
145static const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget;
146static const flecs::entity_t Remove = EcsRemove;
147static const flecs::entity_t Delete = EcsDelete;
148static const flecs::entity_t Panic = EcsPanic;
149
150/* Builtin relationships */
151static const flecs::entity_t IsA = EcsIsA;
152static const flecs::entity_t ChildOf = EcsChildOf;
153static const flecs::entity_t DependsOn = EcsDependsOn;
154static const flecs::entity_t SlotOf = EcsSlotOf;
155
156/* Misc */
157static const flecs::entity_t OrderedChildren = EcsOrderedChildren;
158static const flecs::entity_t Singleton = EcsSingleton;
159
160/* Builtin identifiers */
161static const flecs::entity_t Name = EcsName;
162static const flecs::entity_t Symbol = EcsSymbol;
163
164/* Storage */
165static const flecs::entity_t Sparse = EcsSparse;
166static const flecs::entity_t DontFragment = EcsDontFragment;
167
168/* Builtin predicates for comparing entity ids in queries. */
169static const flecs::entity_t PredEq = EcsPredEq;
170static const flecs::entity_t PredMatch = EcsPredMatch;
171static const flecs::entity_t PredLookup = EcsPredLookup;
172
173/* Builtin marker entities for query scopes */
174static const flecs::entity_t ScopeOpen = EcsScopeOpen;
175static const flecs::entity_t ScopeClose = EcsScopeClose;
176
178
179}
EcsIdentifier
struct EcsIdentifier EcsIdentifier
A (string) identifier.
EcsPoly
struct EcsPoly EcsPoly
Component for storing a poly object.
EcsDefaultChildComponent
struct EcsDefaultChildComponent EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
EcsComponent
struct EcsComponent EcsComponent
Component information.
EcsScopeClose
const ecs_entity_t EcsScopeClose
Marker used to indicate the end of a scope (}) in queries.
EcsOnRemove
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
EcsThis
const ecs_entity_t EcsThis
This entity.
EcsWildcard
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
EcsName
const ecs_entity_t EcsName
Tag to indicate name identifier.
EcsAcyclic
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
EcsSymmetric
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
EcsOnSet
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
EcsReflexive
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
EcsTrait
const ecs_entity_t EcsTrait
Can be added to components to indicate it is a trait.
EcsEmpty
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
EcsOneOf
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
EcsOnTableDelete
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
EcsOnTableCreate
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
EcsObserver
const ecs_entity_t EcsObserver
Tag added to observers.
EcsQuery
const ecs_entity_t EcsQuery
Tag added to queries.
EcsRelationship
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
EcsSingleton
const ecs_entity_t EcsSingleton
Mark component as singleton.
EcsOrderedChildren
const ecs_entity_t EcsOrderedChildren
Tag that when added to a parent ensures stable order of ecs_children result.
EcsDontFragment
const ecs_entity_t EcsDontFragment
Mark component as non-fragmenting.
EcsTraversable
const ecs_entity_t EcsTraversable
Marks a relationship as traversable.
EcsPredLookup
const ecs_entity_t EcsPredLookup
Marker used to indicate $var ~= "pattern" matching in queries.
EcsIsA
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
EcsExclusive
const ecs_entity_t EcsExclusive
Can be added to relationship to indicate that the relationship can only occur once on an entity.
EcsSymbol
const ecs_entity_t EcsSymbol
Tag to indicate symbol identifier.
EcsDependsOn
const ecs_entity_t EcsDependsOn
Used to express dependency relationships.
EcsTransitive
const ecs_entity_t EcsTransitive
Marks a relationship as transitive.
EcsDelete
const ecs_entity_t EcsDelete
Delete cleanup policy.
EcsChildOf
const ecs_entity_t EcsChildOf
Used to express parent-child relationships.
EcsFlecsCore
const ecs_entity_t EcsFlecsCore
Core module scope.
EcsMonitor
const ecs_entity_t EcsMonitor
Event that triggers observer when an entity starts/stops matching a query.
EcsCanToggle
const ecs_entity_t EcsCanToggle
Mark a component as toggleable with ecs_enable_id().
EcsPredEq
const ecs_entity_t EcsPredEq
Marker used to indicate $var == ... matching in queries.
EcsPhase
const ecs_entity_t EcsPhase
Phase pipeline phase.
EcsWorld
const ecs_entity_t EcsWorld
Entity associated with world (used for "attaching" components to world).
EcsPrivate
const ecs_entity_t EcsPrivate
Tag to indicate an entity/component/system is private to a module.
EcsScopeOpen
const ecs_entity_t EcsScopeOpen
Marker used to indicate the start of a scope ({) in queries.
EcsRemove
const ecs_entity_t EcsRemove
Remove cleanup policy.
EcsOverride
const ecs_entity_t EcsOverride
Override component on instantiate.
EcsPredMatch
const ecs_entity_t EcsPredMatch
Marker used to indicate $var == "name" matching in queries.
EcsInherit
const ecs_entity_t EcsInherit
Inherit component on instantiate.
EcsSlotOf
const ecs_entity_t EcsSlotOf
Used to express a slot (used with prefab inheritance).
EcsModule
const ecs_entity_t EcsModule
Tag added to module entities.
EcsSparse
const ecs_entity_t EcsSparse
Mark component as sparse.
EcsOnAdd
const ecs_entity_t EcsOnAdd
Event that triggers when an id is added to an entity.
EcsPrefab
const ecs_entity_t EcsPrefab
Tag added to prefab entities.
EcsOnInstantiate
const ecs_entity_t EcsOnInstantiate
Relationship that specifies component inheritance behavior.
EcsInheritable
const ecs_entity_t EcsInheritable
Mark component as inheritable.
EcsAny
const ecs_entity_t EcsAny
Any entity ("_").
EcsTarget
const ecs_entity_t EcsTarget
Ensure that an entity is always used in pair as target.
EcsWith
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
EcsOnDelete
const ecs_entity_t EcsOnDelete
Relationship used for specifying cleanup behavior.
EcsOnDeleteTarget
const ecs_entity_t EcsOnDeleteTarget
Relationship used to define what should happen when a target entity (second element of a pair) is del...
EcsFlecs
const ecs_entity_t EcsFlecs
Root scope for builtin flecs entities.
EcsSystem
const ecs_entity_t EcsSystem
Tag added to systems.
EcsDisabled
const ecs_entity_t EcsDisabled
When this tag is added to an entity it is skipped by queries, unless EcsDisabled is explicitly querie...
EcsDontInherit
const ecs_entity_t EcsDontInherit
Never inherit component on instantiate.
EcsPairIsTag
const ecs_entity_t EcsPairIsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
EcsPanic
const ecs_entity_t EcsPanic
Panic cleanup policy.
EcsFinal
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
EcsConstant
const ecs_entity_t EcsConstant
Tag added to enum/bitmask constants.
ecs_id
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_component_record_t
struct ecs_component_record_t ecs_component_record_t
Information about a (component) id, such as type info and tables with the id.
Definition flecs.h:473
ecs_term_t
struct ecs_term_t ecs_term_t
A term is a single element in a query.
Definition flecs.h:414
ecs_type_info_t
struct ecs_type_info_t ecs_type_info_t
Type information.
Definition flecs.h:467
ecs_observer_t
struct ecs_observer_t ecs_observer_t
An observer is a system that is invoked when an event matches its query.
Definition flecs.h:436
ecs_ref_t
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:457
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:361
ecs_world_t
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:405
ecs_type_hooks_t
struct ecs_type_hooks_t ecs_type_hooks_t
Type hooks are callbacks associated with component lifecycle events.
Definition flecs.h:462
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:354
ecs_query_t
struct ecs_query_t ecs_query_t
A query returns entities matching a list of constraints.
Definition flecs.h:417
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:411
ecs_iter_t
struct ecs_iter_t ecs_iter_t
Type used for iterating iterable objects.
Definition flecs.h:447
ECS_PAIR
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
ECS_AUTO_OVERRIDE
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
ECS_TOGGLE
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
ecs_world_info_t
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
ecs_query_group_info_t
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
EcsIsEntity
#define EcsIsEntity
Term id is an entity.
Definition flecs.h:753
EcsIsVariable
#define EcsIsVariable
Term id is a variable.
Definition flecs.h:747
EcsIsName
#define EcsIsName
Term id is a name (don't attempt to lookup as entity).
Definition flecs.h:759
EcsDesc
#define EcsDesc
Iterate groups in descending order.
Definition flecs.h:741
EcsCascade
#define EcsCascade
Sort results breadth first.
Definition flecs.h:735
EcsTrav
#define EcsTrav
Traverse relationship transitively.
Definition flecs.h:729
EcsTraverseFlags
#define EcsTraverseFlags
All term traversal flags.
Definition flecs.h:765
EcsTermRefFlags
#define EcsTermRefFlags
All term reference kind flags.
Definition flecs.h:771
EcsUp
#define EcsUp
Match by traversing upwards.
Definition flecs.h:723
EcsSelf
#define EcsSelf
Match on self.
Definition flecs.h:717
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:707
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:705
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:708
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:706
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:689
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:687
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:686
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:684
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:685
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:688
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:696
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:697
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:695
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:699
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:694
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:700
EcsAndFrom
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:698