Skip to content

Commit 08303ea

Browse files
committed
Improve comments in public headers
1 parent 9dfb8c0 commit 08303ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+7693
-2351
lines changed

distr/flecs.h

Lines changed: 3846 additions & 1175 deletions
Large diffs are not rendered by default.

include/flecs.h

Lines changed: 131 additions & 108 deletions
Large diffs are not rendered by default.

include/flecs/addons/alerts.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,36 @@
2828
extern "C" {
2929
#endif
3030

31+
/** Maximum number of severity filters per alert. */
3132
#define ECS_ALERT_MAX_SEVERITY_FILTERS (4)
3233

3334
/** Module id. */
3435
FLECS_API extern ECS_COMPONENT_DECLARE(FlecsAlerts);
3536

36-
/* Module components */
37+
/** Module components. */
3738

3839
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlert); /**< Component added to alert, and used as first element of alert severity pair. */
3940
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertInstance); /**< Component added to alert instance. */
4041
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertsActive); /**< Component added to alert source which tracks how many active alerts there are. */
4142
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertTimeout); /**< Component added to alert which tracks how long an alert has been inactive. */
4243

43-
/* Alert severity tags */
44+
/** Alert severity tags. */
4445
FLECS_API extern ECS_TAG_DECLARE(EcsAlertInfo); /**< Info alert severity. */
4546
FLECS_API extern ECS_TAG_DECLARE(EcsAlertWarning); /**< Warning alert severity. */
4647
FLECS_API extern ECS_TAG_DECLARE(EcsAlertError); /**< Error alert severity. */
4748
FLECS_API extern ECS_TAG_DECLARE(EcsAlertCritical); /**< Critical alert severity. */
4849

4950
/** Component added to alert instance. */
5051
typedef struct EcsAlertInstance {
51-
char *message; /**< Generated alert message */
52+
char *message; /**< Generated alert message. */
5253
} EcsAlertInstance;
5354

5455
/** Map with active alerts for entity. */
5556
typedef struct EcsAlertsActive {
56-
int32_t info_count; /**< Number of alerts for source with info severity */
57-
int32_t warning_count; /**< Number of alerts for source with warning severity */
58-
int32_t error_count; /**< Number of alerts for source with error severity */
59-
ecs_map_t alerts;
57+
int32_t info_count; /**< Number of alerts for source with info severity. */
58+
int32_t warning_count; /**< Number of alerts for source with warning severity. */
59+
int32_t error_count; /**< Number of alerts for source with error severity. */
60+
ecs_map_t alerts; /**< Map of active alerts for entity. */
6061
} EcsAlertsActive;
6162

6263
/** Alert severity filter.
@@ -66,16 +67,16 @@ typedef struct EcsAlertsActive {
6667
* severity of an alert from Warning to Error.
6768
*/
6869
typedef struct ecs_alert_severity_filter_t {
69-
ecs_entity_t severity; /* Severity kind */
70-
ecs_id_t with; /* Component to match */
71-
const char *var; /* Variable to match component on. Do not include the
70+
ecs_entity_t severity; /**< Severity kind. */
71+
ecs_id_t with; /**< Component to match. */
72+
const char *var; /**< Variable to match component on. Do not include the
7273
* '$' character. Leave to NULL for $this. */
73-
int32_t _var_index; /* Index of variable in filter (do not set) */
74+
int32_t _var_index; /**< Index of variable in filter (do not set) */
7475
} ecs_alert_severity_filter_t;
7576

7677
/** Alert descriptor, used with ecs_alert_init(). */
7778
typedef struct ecs_alert_desc_t {
78-
int32_t _canary;
79+
int32_t _canary; /**< Used for validity testing. Do not set. */
7980

8081
/** Entity associated with alert */
8182
ecs_entity_t entity;
@@ -99,7 +100,7 @@ typedef struct ecs_alert_desc_t {
99100
/** User friendly name. Will only be set if FLECS_DOC addon is enabled. */
100101
const char *doc_name;
101102

102-
/** Description of alert. Will only be set if FLECS_DOC addon is enabled */
103+
/** Description of alert. Will only be set if FLECS_DOC addon is enabled. */
103104
const char *brief;
104105

105106
/** Metric kind. Must be EcsAlertInfo, EcsAlertWarning, EcsAlertError or

include/flecs/addons/app.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct ecs_app_desc_t {
4040
int32_t threads; /**< Number of threads. */
4141
int32_t frames; /**< Number of frames to run (0 for infinite) */
4242
bool enable_rest; /**< Enables ECS access over HTTP, necessary for explorer */
43-
bool enable_stats; /**< Periodically collect statistics */
43+
bool enable_stats; /**< Periodically collect statistics. */
4444
uint16_t port; /**< HTTP port used by REST API */
4545

4646
ecs_app_init_action_t init; /**< If set, function is ran before starting the

include/flecs/addons/cpp/c_types.hpp

Lines changed: 121 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,164 +15,230 @@ namespace flecs {
1515
* @{
1616
*/
1717

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-
18+
using world_t = ecs_world_t; /**< World type. */
19+
using world_info_t = ecs_world_info_t; /**< World info type. */
20+
using id_t = ecs_id_t; /**< Id type. */
21+
using entity_t = ecs_entity_t; /**< Entity type. */
22+
using type_t = ecs_type_t; /**< Type type. */
23+
using table_t = ecs_table_t; /**< Table type. */
24+
using term_t = ecs_term_t; /**< Term type. */
25+
using query_t = ecs_query_t; /**< Query type. */
26+
using query_group_info_t = ecs_query_group_info_t; /**< Query group info type. */
27+
using observer_t = ecs_observer_t; /**< Observer type. */
28+
using iter_t = ecs_iter_t; /**< Iterator type. */
29+
using ref_t = ecs_ref_t; /**< Ref type. */
30+
using table_record_t = ecs_table_record_t; /**< Table record type. */
31+
using table_records_t = ecs_table_records_t; /**< Table records type. */
32+
using component_record_t = ecs_component_record_t; /**< Component record type. */
33+
using type_info_t = ecs_type_info_t; /**< Type info type. */
34+
using type_hooks_t = ecs_type_hooks_t; /**< Type hooks type. */
35+
using flags32_t = ecs_flags32_t; /**< 32-bit flags type. */
36+
using flags64_t = ecs_flags64_t; /**< 64-bit flags type. */
37+
38+
/** Inout kind. */
3839
enum inout_kind_t {
39-
InOutDefault = EcsInOutDefault,
40-
InOutNone = EcsInOutNone,
41-
InOutFilter = EcsInOutFilter,
42-
InOut = EcsInOut,
43-
In = EcsIn,
44-
Out = EcsOut
40+
InOutDefault = EcsInOutDefault, /**< InOutDefault. */
41+
InOutNone = EcsInOutNone, /**< InOutNone. */
42+
InOutFilter = EcsInOutFilter, /**< InOutFilter. */
43+
InOut = EcsInOut, /**< InOut. */
44+
In = EcsIn, /**< In. */
45+
Out = EcsOut /**< Out. */
4546
};
4647

48+
/** Operator kind. */
4749
enum oper_kind_t {
48-
And = EcsAnd,
49-
Or = EcsOr,
50-
Not = EcsNot,
51-
Optional = EcsOptional,
52-
AndFrom = EcsAndFrom,
53-
OrFrom = EcsOrFrom,
54-
NotFrom = EcsNotFrom
50+
And = EcsAnd, /**< And operator. */
51+
Or = EcsOr, /**< Or operator. */
52+
Not = EcsNot, /**< Not operator. */
53+
Optional = EcsOptional, /**< Optional operator. */
54+
AndFrom = EcsAndFrom, /**< AndFrom operator. */
55+
OrFrom = EcsOrFrom, /**< OrFrom operator. */
56+
NotFrom = EcsNotFrom /**< NotFrom operator. */
5557
};
5658

59+
/** Query cache kind. */
5760
enum query_cache_kind_t {
58-
QueryCacheDefault = EcsQueryCacheDefault,
59-
QueryCacheAuto = EcsQueryCacheAuto,
60-
QueryCacheAll = EcsQueryCacheAll,
61-
QueryCacheNone = EcsQueryCacheNone
61+
QueryCacheDefault = EcsQueryCacheDefault, /**< Default query cache. */
62+
QueryCacheAuto = EcsQueryCacheAuto, /**< Auto query cache. */
63+
QueryCacheAll = EcsQueryCacheAll, /**< Cache all. */
64+
QueryCacheNone = EcsQueryCacheNone /**< No caching. */
6265
};
6366

64-
/** Id bit flags */
65-
static const flecs::entity_t PAIR = ECS_PAIR;
66-
static const flecs::entity_t AUTO_OVERRIDE = ECS_AUTO_OVERRIDE;
67-
static const flecs::entity_t TOGGLE = ECS_TOGGLE;
67+
/** Id bit flags. */
68+
static const flecs::entity_t PAIR = ECS_PAIR; /**< Pair flag. */
69+
static const flecs::entity_t AUTO_OVERRIDE = ECS_AUTO_OVERRIDE; /**< Auto override flag. */
70+
static const flecs::entity_t TOGGLE = ECS_TOGGLE; /**< Toggle flag. */
6871

6972
////////////////////////////////////////////////////////////////////////////////
7073
//// Builtin components and tags
7174
////////////////////////////////////////////////////////////////////////////////
7275

73-
/* Builtin components */
76+
/** Builtin EcsComponent type. */
7477
using Component = EcsComponent;
78+
/** Builtin EcsIdentifier type. */
7579
using Identifier = EcsIdentifier;
80+
/** Builtin EcsPoly type. */
7681
using Poly = EcsPoly;
82+
/** Builtin EcsDefaultChildComponent type. */
7783
using DefaultChildComponent = EcsDefaultChildComponent;
84+
/** Builtin EcsParent type. */
7885
using Parent = EcsParent;
7986

80-
/* Builtin tags */
87+
/** Builtin Query tag. */
8188
static const flecs::entity_t Query = EcsQuery;
89+
/** Builtin Observer tag. */
8290
static const flecs::entity_t Observer = EcsObserver;
91+
/** Builtin Module tag. */
8392
static const flecs::entity_t Module = EcsModule;
93+
/** Builtin Prefab tag. */
8494
static const flecs::entity_t Prefab = EcsPrefab;
95+
/** Builtin Disabled tag. */
8596
static const flecs::entity_t Disabled = EcsDisabled;
97+
/** Builtin Empty tag. */
8698
static const flecs::entity_t Empty = EcsEmpty;
99+
/** Builtin Monitor tag. */
87100
static const flecs::entity_t Monitor = EcsMonitor;
101+
/** Builtin System tag. */
88102
static const flecs::entity_t System = EcsSystem;
103+
/** Builtin Pipeline tag. */
89104
static const flecs::entity_t Pipeline = ecs_id(EcsPipeline);
105+
/** Builtin Phase tag. */
90106
static const flecs::entity_t Phase = EcsPhase;
107+
/** Builtin Constant tag. */
91108
static const flecs::entity_t Constant = EcsConstant;
109+
/** Builtin ParentDepth tag. */
92110
static const flecs::entity_t ParentDepth = EcsParentDepth;
93111

94-
/* Builtin event tags */
112+
/** Builtin OnAdd event. */
95113
static const flecs::entity_t OnAdd = EcsOnAdd;
114+
/** Builtin OnRemove event. */
96115
static const flecs::entity_t OnRemove = EcsOnRemove;
116+
/** Builtin OnSet event. */
97117
static const flecs::entity_t OnSet = EcsOnSet;
118+
/** Builtin OnTableCreate event. */
98119
static const flecs::entity_t OnTableCreate = EcsOnTableCreate;
120+
/** Builtin OnTableDelete event. */
99121
static const flecs::entity_t OnTableDelete = EcsOnTableDelete;
100122

101-
/* Builtin term flags */
123+
/** Self term flag. */
102124
static const uint64_t Self = EcsSelf;
125+
/** Up term flag. */
103126
static const uint64_t Up = EcsUp;
127+
/** Trav term flag. */
104128
static const uint64_t Trav = EcsTrav;
129+
/** Cascade term flag. */
105130
static const uint64_t Cascade = EcsCascade;
131+
/** Desc term flag. */
106132
static const uint64_t Desc = EcsDesc;
133+
/** IsVariable term flag. */
107134
static const uint64_t IsVariable = EcsIsVariable;
135+
/** IsEntity term flag. */
108136
static const uint64_t IsEntity = EcsIsEntity;
137+
/** IsName term flag. */
109138
static const uint64_t IsName = EcsIsName;
139+
/** TraverseFlags term flag mask. */
110140
static const uint64_t TraverseFlags = EcsTraverseFlags;
141+
/** TermRefFlags term flag mask. */
111142
static const uint64_t TermRefFlags = EcsTermRefFlags;
112143

113-
/* Builtin entity ids */
144+
/** Builtin Flecs entity. */
114145
static const flecs::entity_t Flecs = EcsFlecs;
146+
/** Builtin FlecsCore entity. */
115147
static const flecs::entity_t FlecsCore = EcsFlecsCore;
148+
/** Builtin World entity. */
116149
static const flecs::entity_t World = EcsWorld;
117150

118-
/* Component traits */
151+
/** Wildcard entity. */
119152
static const flecs::entity_t Wildcard = EcsWildcard;
153+
/** Any entity. */
120154
static const flecs::entity_t Any = EcsAny;
155+
/** This variable entity. */
121156
static const flecs::entity_t This = EcsThis;
157+
/** Transitive trait. */
122158
static const flecs::entity_t Transitive = EcsTransitive;
159+
/** Reflexive trait. */
123160
static const flecs::entity_t Reflexive = EcsReflexive;
161+
/** Final trait. */
124162
static const flecs::entity_t Final = EcsFinal;
163+
/** Inheritable trait. */
125164
static const flecs::entity_t Inheritable = EcsInheritable;
165+
/** PairIsTag trait. */
126166
static const flecs::entity_t PairIsTag = EcsPairIsTag;
167+
/** Exclusive trait. */
127168
static const flecs::entity_t Exclusive = EcsExclusive;
169+
/** Acyclic trait. */
128170
static const flecs::entity_t Acyclic = EcsAcyclic;
171+
/** Traversable trait. */
129172
static const flecs::entity_t Traversable = EcsTraversable;
173+
/** Symmetric trait. */
130174
static const flecs::entity_t Symmetric = EcsSymmetric;
175+
/** With trait. */
131176
static const flecs::entity_t With = EcsWith;
177+
/** OneOf trait. */
132178
static const flecs::entity_t OneOf = EcsOneOf;
179+
/** Trait tag. */
133180
static const flecs::entity_t Trait = EcsTrait;
181+
/** Relationship tag. */
134182
static const flecs::entity_t Relationship = EcsRelationship;
183+
/** Target tag. */
135184
static const flecs::entity_t Target = EcsTarget;
185+
/** CanToggle trait. */
136186
static const flecs::entity_t CanToggle = EcsCanToggle;
137187

138-
/* OnInstantiate trait */
188+
/** OnInstantiate trait. */
139189
static const flecs::entity_t OnInstantiate = EcsOnInstantiate;
190+
/** Override trait. */
140191
static const flecs::entity_t Override = EcsOverride;
192+
/** Inherit trait. */
141193
static const flecs::entity_t Inherit = EcsInherit;
194+
/** DontInherit trait. */
142195
static const flecs::entity_t DontInherit = EcsDontInherit;
143196

144-
/* OnDelete/OnDeleteTarget traits */
197+
/** OnDelete cleanup trait. */
145198
static const flecs::entity_t OnDelete = EcsOnDelete;
199+
/** OnDeleteTarget cleanup trait. */
146200
static const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget;
201+
/** Remove cleanup action. */
147202
static const flecs::entity_t Remove = EcsRemove;
203+
/** Delete cleanup action. */
148204
static const flecs::entity_t Delete = EcsDelete;
205+
/** Panic cleanup action. */
149206
static const flecs::entity_t Panic = EcsPanic;
150207

151-
/* Builtin relationships */
208+
/** IsA relationship. */
152209
static const flecs::entity_t IsA = EcsIsA;
210+
/** ChildOf relationship. */
153211
static const flecs::entity_t ChildOf = EcsChildOf;
212+
/** DependsOn relationship. */
154213
static const flecs::entity_t DependsOn = EcsDependsOn;
214+
/** SlotOf relationship. */
155215
static const flecs::entity_t SlotOf = EcsSlotOf;
156216

157-
/* Misc */
217+
/** OrderedChildren tag. */
158218
static const flecs::entity_t OrderedChildren = EcsOrderedChildren;
219+
/** Singleton tag. */
159220
static const flecs::entity_t Singleton = EcsSingleton;
160221

161-
/* Builtin identifiers */
222+
/** Name identifier. */
162223
static const flecs::entity_t Name = EcsName;
224+
/** Symbol identifier. */
163225
static const flecs::entity_t Symbol = EcsSymbol;
164226

165-
/* Storage */
227+
/** Sparse storage tag. */
166228
static const flecs::entity_t Sparse = EcsSparse;
229+
/** DontFragment storage tag. */
167230
static const flecs::entity_t DontFragment = EcsDontFragment;
168231

169-
/* Builtin predicates for comparing entity ids in queries. */
232+
/** PredEq query predicate. */
170233
static const flecs::entity_t PredEq = EcsPredEq;
234+
/** PredMatch query predicate. */
171235
static const flecs::entity_t PredMatch = EcsPredMatch;
236+
/** PredLookup query predicate. */
172237
static const flecs::entity_t PredLookup = EcsPredLookup;
173238

174-
/* Builtin marker entities for query scopes */
239+
/** ScopeOpen query scope marker. */
175240
static const flecs::entity_t ScopeOpen = EcsScopeOpen;
241+
/** ScopeClose query scope marker. */
176242
static const flecs::entity_t ScopeClose = EcsScopeClose;
177243

178244
/** @} */

0 commit comments

Comments
 (0)