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
18 using world_t = ecs_world_t;
19 using world_info_t = ecs_world_info_t;
20 using id_t = ecs_id_t;
21 using entity_t = ecs_entity_t;
22 using type_t = ecs_type_t;
23 using table_t = ecs_table_t;
24 using term_t = ecs_term_t;
25 using query_t = ecs_query_t;
26 using query_group_info_t = ecs_query_group_info_t;
27 using observer_t = ecs_observer_t;
28 using iter_t = ecs_iter_t;
29 using ref_t = ecs_ref_t;
30 using table_record_t = ecs_table_record_t;
31 using table_records_t = ecs_table_records_t;
32 using component_record_t = ecs_component_record_t;
33 using type_info_t = ecs_type_info_t;
34 using type_hooks_t = ecs_type_hooks_t;
35 using flags32_t = ecs_flags32_t;
36 using flags64_t = ecs_flags64_t;
37
39 enum inout_kind_t {
40 InOutDefault = EcsInOutDefault,
41 InOutNone = EcsInOutNone,
42 InOutFilter = EcsInOutFilter,
43 InOut = EcsInOut,
44 In = EcsIn,
45 Out = EcsOut
46};
47
49 enum oper_kind_t {
50 And = EcsAnd,
51 Or = EcsOr,
52 Not = EcsNot,
53 Optional = EcsOptional,
54 AndFrom = EcsAndFrom,
55 OrFrom = EcsOrFrom,
56 NotFrom = EcsNotFrom
57};
58
60 enum query_cache_kind_t {
61 QueryCacheDefault = EcsQueryCacheDefault,
62 QueryCacheAuto = EcsQueryCacheAuto,
63 QueryCacheAll = EcsQueryCacheAll,
64 QueryCacheNone = EcsQueryCacheNone
65};
66
68static const flecs::entity_t PAIR = ECS_PAIR;
69static const flecs::entity_t AUTO_OVERRIDE = ECS_AUTO_OVERRIDE;
70static const flecs::entity_t TOGGLE = ECS_TOGGLE;
71
75
77 using Component = EcsComponent;
79 using Identifier = EcsIdentifier;
81 using Poly = EcsPoly;
83 using DefaultChildComponent = EcsDefaultChildComponent;
85 using Parent = EcsParent;
86
88static const flecs::entity_t Query = EcsQuery;
90static const flecs::entity_t Observer = EcsObserver;
92static const flecs::entity_t Module = EcsModule;
94static const flecs::entity_t Prefab = EcsPrefab;
96static const flecs::entity_t Disabled = EcsDisabled;
98static const flecs::entity_t Empty = EcsEmpty;
100static const flecs::entity_t Monitor = EcsMonitor;
102static const flecs::entity_t System = EcsSystem;
104static const flecs::entity_t Pipeline = ecs_id(EcsPipeline);
106static const flecs::entity_t Phase = EcsPhase;
108static const flecs::entity_t Constant = EcsConstant;
110static const flecs::entity_t ParentDepth = EcsParentDepth;
111
113static const flecs::entity_t OnAdd = EcsOnAdd;
115static const flecs::entity_t OnRemove = EcsOnRemove;
117static const flecs::entity_t OnSet = EcsOnSet;
119static const flecs::entity_t OnTableCreate = EcsOnTableCreate;
121static const flecs::entity_t OnTableDelete = EcsOnTableDelete;
122
124static const uint64_t Self = EcsSelf;
126static const uint64_t Up = EcsUp;
128static const uint64_t Trav = EcsTrav;
130static const uint64_t Cascade = EcsCascade;
132static const uint64_t Desc = EcsDesc;
134static const uint64_t IsVariable = EcsIsVariable;
136static const uint64_t IsEntity = EcsIsEntity;
138static const uint64_t IsName = EcsIsName;
140static const uint64_t TraverseFlags = EcsTraverseFlags;
142static const uint64_t TermRefFlags = EcsTermRefFlags;
143
145static const flecs::entity_t Flecs = EcsFlecs;
147static const flecs::entity_t FlecsCore = EcsFlecsCore;
149static const flecs::entity_t World = EcsWorld;
150
152static const flecs::entity_t Wildcard = EcsWildcard;
154static const flecs::entity_t Any = EcsAny;
156static const flecs::entity_t This = EcsThis;
158static const flecs::entity_t Transitive = EcsTransitive;
160static const flecs::entity_t Reflexive = EcsReflexive;
162static const flecs::entity_t Final = EcsFinal;
164static const flecs::entity_t Inheritable = EcsInheritable;
166static const flecs::entity_t PairIsTag = EcsPairIsTag;
168static const flecs::entity_t Exclusive = EcsExclusive;
170static const flecs::entity_t Acyclic = EcsAcyclic;
172static const flecs::entity_t Traversable = EcsTraversable;
174static const flecs::entity_t Symmetric = EcsSymmetric;
176static const flecs::entity_t With = EcsWith;
178static const flecs::entity_t OneOf = EcsOneOf;
180static const flecs::entity_t Trait = EcsTrait;
182static const flecs::entity_t Relationship = EcsRelationship;
184static const flecs::entity_t Target = EcsTarget;
186static const flecs::entity_t CanToggle = EcsCanToggle;
187
189static const flecs::entity_t OnInstantiate = EcsOnInstantiate;
191static const flecs::entity_t Override = EcsOverride;
193static const flecs::entity_t Inherit = EcsInherit;
195static const flecs::entity_t DontInherit = EcsDontInherit;
196
198static const flecs::entity_t OnDelete = EcsOnDelete;
200static const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget;
202static const flecs::entity_t Remove = EcsRemove;
204static const flecs::entity_t Delete = EcsDelete;
206static const flecs::entity_t Panic = EcsPanic;
207
209static const flecs::entity_t IsA = EcsIsA;
211static const flecs::entity_t ChildOf = EcsChildOf;
213static const flecs::entity_t DependsOn = EcsDependsOn;
215static const flecs::entity_t SlotOf = EcsSlotOf;
216
218static const flecs::entity_t OrderedChildren = EcsOrderedChildren;
220static const flecs::entity_t Singleton = EcsSingleton;
221
223static const flecs::entity_t Name = EcsName;
225static const flecs::entity_t Symbol = EcsSymbol;
226
228static const flecs::entity_t Sparse = EcsSparse;
230static const flecs::entity_t DontFragment = EcsDontFragment;
231
233static const flecs::entity_t PredEq = EcsPredEq;
235static const flecs::entity_t PredMatch = EcsPredMatch;
237static const flecs::entity_t PredLookup = EcsPredLookup;
238
240static const flecs::entity_t ScopeOpen = EcsScopeOpen;
242static const flecs::entity_t ScopeClose = EcsScopeClose;
243
245
246}
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
Mark a relationship as acyclic.
EcsSymmetric
const ecs_entity_t EcsSymmetric
Mark 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
Mark 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 a query is empty.
EcsOneOf
const ecs_entity_t EcsOneOf
Ensure that a relationship target is a child of the 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 a pair as a 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() results.
EcsDontFragment
const ecs_entity_t EcsDontFragment
Mark component as non-fragmenting.
EcsTraversable
const ecs_entity_t EcsTraversable
Mark 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 a 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
Mark 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 an observer when an entity starts or 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).
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 a pair as a target.
EcsParentDepth
const ecs_entity_t EcsParentDepth
Relationship storing the entity's depth in a non-fragmenting hierarchy.
EcsWith
const ecs_entity_t EcsWith
Ensure that a component is always 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 built-in 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 queri...
EcsDontInherit
const ecs_entity_t EcsDontInherit
Never inherit component on instantiate.
EcsPairIsTag
const ecs_entity_t EcsPairIsTag
Can be added to a relationship to indicate that it should never hold data, even when it or the relati...
EcsPanic
const ecs_entity_t EcsPanic
Panic cleanup policy.
EcsFinal
const ecs_entity_t EcsFinal
Ensure that an entity or component cannot be used as a target in an IsA relationship.
EcsConstant
const ecs_entity_t EcsConstant
Tag added to enum or 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:497
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:481
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:385
ecs_table_record_t
struct ecs_table_record_t ecs_table_record_t
Opaque type for table record.
Definition flecs.h:531
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:429
ecs_id_t
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
Definition flecs.h:378
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:435
flecs::iter_t
ecs_iter_t iter_t
Iterator type.
Definition c_types.hpp:28
flecs::query_t
ecs_query_t query_t
Query type.
Definition c_types.hpp:25
flecs::component_record_t
ecs_component_record_t component_record_t
Component record type.
Definition c_types.hpp:32
flecs::world_info_t
ecs_world_info_t world_info_t
World info type.
Definition c_types.hpp:19
flecs::term_t
ecs_term_t term_t
Term type.
Definition c_types.hpp:24
flecs::DefaultChildComponent
EcsDefaultChildComponent DefaultChildComponent
Built-in EcsDefaultChildComponent type.
Definition c_types.hpp:83
flecs::table_t
ecs_table_t table_t
Table type.
Definition c_types.hpp:23
flecs::Component
EcsComponent Component
Built-in EcsComponent type.
Definition c_types.hpp:77
flecs::type_hooks_t
ecs_type_hooks_t type_hooks_t
Type hooks type.
Definition c_types.hpp:34
flecs::id_t
ecs_id_t id_t
ID type.
Definition c_types.hpp:20
flecs::Identifier
EcsIdentifier Identifier
Built-in EcsIdentifier type.
Definition c_types.hpp:79
flecs::ref_t
ecs_ref_t ref_t
Ref type.
Definition c_types.hpp:29
flecs::table_records_t
ecs_table_records_t table_records_t
Table records type.
Definition c_types.hpp:31
flecs::flags64_t
ecs_flags64_t flags64_t
64-bit flags type.
Definition c_types.hpp:36
flecs::table_record_t
ecs_table_record_t table_record_t
Table record type.
Definition c_types.hpp:30
flecs::oper_kind_t
oper_kind_t
Operator kind.
Definition c_types.hpp:49
flecs::entity_t
ecs_entity_t entity_t
Entity type.
Definition c_types.hpp:21
flecs::Parent
EcsParent Parent
Built-in EcsParent type.
Definition c_types.hpp:85
flecs::type_t
ecs_type_t type_t
Type type.
Definition c_types.hpp:22
flecs::query_group_info_t
ecs_query_group_info_t query_group_info_t
Query group info type.
Definition c_types.hpp:26
flecs::observer_t
ecs_observer_t observer_t
Observer type.
Definition c_types.hpp:27
flecs::flags32_t
ecs_flags32_t flags32_t
32-bit flags type.
Definition c_types.hpp:35
flecs::query_cache_kind_t
query_cache_kind_t
Query cache kind.
Definition c_types.hpp:60
flecs::Poly
EcsPoly Poly
Built-in EcsPoly type.
Definition c_types.hpp:81
flecs::world_t
ecs_world_t world_t
World type.
Definition c_types.hpp:18
flecs::type_info_t
ecs_type_info_t type_info_t
Type info type.
Definition c_types.hpp:33
flecs::inout_kind_t
inout_kind_t
Inout kind.
Definition c_types.hpp:39
flecs::NotFrom
@ NotFrom
NotFrom operator.
Definition c_types.hpp:56
flecs::OrFrom
@ OrFrom
OrFrom operator.
Definition c_types.hpp:55
flecs::AndFrom
@ AndFrom
AndFrom operator.
Definition c_types.hpp:54
flecs::And
@ And
And operator.
Definition c_types.hpp:50
flecs::Optional
@ Optional
Optional operator.
Definition c_types.hpp:53
flecs::Or
@ Or
Or operator.
Definition c_types.hpp:51
flecs::Not
@ Not
Not operator.
Definition c_types.hpp:52
flecs::QueryCacheNone
@ QueryCacheNone
No caching.
Definition c_types.hpp:64
flecs::QueryCacheAll
@ QueryCacheAll
Cache all.
Definition c_types.hpp:63
flecs::QueryCacheAuto
@ QueryCacheAuto
Auto query cache.
Definition c_types.hpp:62
flecs::QueryCacheDefault
@ QueryCacheDefault
Default query cache.
Definition c_types.hpp:61
flecs::In
@ In
In.
Definition c_types.hpp:44
flecs::Out
@ Out
Out.
Definition c_types.hpp:45
flecs::InOutFilter
@ InOutFilter
InOutFilter.
Definition c_types.hpp:42
flecs::InOutDefault
@ InOutDefault
InOutDefault.
Definition c_types.hpp:40
flecs::InOut
@ InOut
InOut.
Definition c_types.hpp:43
flecs::InOutNone
@ InOutNone
InOutNone.
Definition c_types.hpp:41
ECS_PAIR
const ecs_id_t ECS_PAIR
Indicate 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
Add a bitset to storage, which allows a component to be enabled or disabled.
EcsIsEntity
#define EcsIsEntity
Term ID is an entity.
Definition flecs.h:778
EcsIsVariable
#define EcsIsVariable
Term ID is a variable.
Definition flecs.h:772
EcsIsName
#define EcsIsName
Term ID is a name (don't attempt to look up as an entity).
Definition flecs.h:784
EcsDesc
#define EcsDesc
Iterate groups in descending order.
Definition flecs.h:766
EcsCascade
#define EcsCascade
Sort results breadth-first.
Definition flecs.h:760
EcsTrav
#define EcsTrav
Traverse relationship transitively.
Definition flecs.h:754
EcsTraverseFlags
#define EcsTraverseFlags
All term traversal flags.
Definition flecs.h:790
EcsTermRefFlags
#define EcsTermRefFlags
All term reference kind flags.
Definition flecs.h:796
EcsUp
#define EcsUp
Match by traversing upwards.
Definition flecs.h:748
EcsSelf
#define EcsSelf
Term ID flags.
Definition flecs.h:742
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:732
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:730
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:733
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:731
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:714
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:712
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:711
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:709
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:710
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:713
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:721
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:722
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:720
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term ID.
Definition flecs.h:724
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:719
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term ID.
Definition flecs.h:725
EcsAndFrom
@ EcsAndFrom
Term must match all components from term ID.
Definition flecs.h:723
EcsComponent
Component information.
Definition flecs.h:1600
EcsDefaultChildComponent
When added to an entity, this informs serialization formats which component to use when a value is as...
Definition flecs.h:1615
EcsIdentifier
A (string) identifier.
Definition flecs.h:1591
EcsParent
Non-fragmenting ChildOf relationship.
Definition flecs.h:1620
EcsPoly
Component for storing a poly object.
Definition flecs.h:1606
ecs_iter_t
Iterator.
Definition flecs.h:1170
ecs_observer_t
An observer reacts to events matching a query.
Definition flecs.h:879
ecs_query_group_info_t
Type that contains information about a query group.
Definition flecs.h:1564
ecs_query_t
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:838
ecs_term_t
Type that describes a term (single element in a query).
Definition flecs.h:814
ecs_type_hooks_t
Definition flecs.h:954
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:1023
ecs_type_t
A type is a list of (component) IDs.
Definition flecs.h:402
ecs_world_info_t
Type that contains information about the world.
Definition flecs.h:1504