Skip to content

Commit 3e19d08

Browse files
SanderMertensfacebook-github-bot
authored andcommitted
Add missing comments to Flecs headers
Summary: TSIA Differential Revision: D96177556
1 parent 39ecda8 commit 3e19d08

File tree

15 files changed

+452
-164
lines changed

15 files changed

+452
-164
lines changed

include/flecs.h

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ typedef struct ecs_header_t {
523523
ecs_mixins_t *mixins; /**< Table with offsets to (optional) mixins */
524524
} ecs_header_t;
525525

526+
/** Opaque type for table record. */
526527
typedef struct ecs_table_record_t ecs_table_record_t;
527528

528529
/** @} */
@@ -1398,8 +1399,8 @@ typedef struct ecs_observer_desc_t {
13981399

13991400
/** Used for internal purposes. Do not set. */
14001401
int32_t *last_event_id;
1401-
int8_t term_index_;
1402-
ecs_flags32_t flags_;
1402+
int8_t term_index_; /**< Used for internal purposes. Do not set. */
1403+
ecs_flags32_t flags_; /**< Used for internal purposes. Do not set. */
14031404
} ecs_observer_desc_t;
14041405

14051406
/** Used with ecs_emit().
@@ -1537,7 +1538,7 @@ typedef struct ecs_world_info_t {
15371538

15381539
/** Type that contains information about a query group. */
15391540
typedef struct ecs_query_group_info_t {
1540-
uint64_t id;
1541+
uint64_t id; /**< Group id */
15411542
int32_t match_count; /**< How often tables have been matched/unmatched */
15421543
int32_t table_count; /**< Number of tables in group */
15431544
void *ctx; /**< Group context, returned by on_group_create */
@@ -1581,30 +1582,33 @@ typedef struct EcsDefaultChildComponent {
15811582
ecs_id_t component; /**< Default component id. */
15821583
} EcsDefaultChildComponent;
15831584

1584-
/* Non-fragmenting ChildOf relationship. */
1585+
/** Non-fragmenting ChildOf relationship. */
15851586
typedef struct EcsParent {
1586-
ecs_entity_t value;
1587+
ecs_entity_t value; /**< Parent entity */
15871588
} EcsParent;
15881589

1589-
/* Component with data to instantiate a non-fragmenting tree. */
1590+
/** Component with data to instantiate a non-fragmenting tree. */
15901591
typedef struct {
1591-
const char *child_name; /* Name of prefab child */
1592-
ecs_table_t *table; /* Table in which child will be stored */
1593-
uint32_t child; /* Prefab child entity (without generation) */
1594-
int32_t parent_index; /* Index into children vector */
1592+
const char *child_name; /**< Name of prefab child */
1593+
ecs_table_t *table; /**< Table in which child will be stored */
1594+
uint32_t child; /**< Prefab child entity (without generation) */
1595+
int32_t parent_index; /**< Index into children vector */
15951596
} ecs_tree_spawner_child_t;
15961597

1598+
/** Tree spawner data for a single hierarchy depth. */
15971599
typedef struct {
1598-
ecs_vec_t children; /* vector<ecs_tree_spawner_child_t> */
1600+
ecs_vec_t children; /**< vector<ecs_tree_spawner_child_t> */
15991601
} ecs_tree_spawner_t;
16001602

1603+
/** Tree instantiation cache component.
1604+
* Tree instantiation cache, indexed by depth. Tables will have a
1605+
* (ParentDepth, depth) pair indicating the hierarchy depth. This means that
1606+
* for different depths, the tables the children are created in will also be
1607+
* different. Caching tables for different depths therefore speeds up
1608+
* instantiating trees even when the top level entity is not at the root.
1609+
*/
16011610
typedef struct EcsTreeSpawner {
1602-
/* Tree instantiation cache, indexed by depth. Tables will have a
1603-
* (ParentDepth, depth) pair indicating the hierarchy depth. This means that
1604-
* for different depths, the tables the children are created in will also be
1605-
* different. Caching tables for different depths therefore speeds up
1606-
* instantiating trees even when the top level entity is not at the root. */
1607-
ecs_tree_spawner_t data[FLECS_TREE_SPAWNER_DEPTH_CACHE_SIZE];
1611+
ecs_tree_spawner_t data[FLECS_TREE_SPAWNER_DEPTH_CACHE_SIZE]; /**< Cache data indexed by depth */
16081612
} EcsTreeSpawner;
16091613

16101614
/** @} */
@@ -3371,6 +3375,7 @@ FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
33713375
* @param world The world.
33723376
* @param entity The entity.
33733377
* @param component The component to get/add.
3378+
* @param size The size of the component.
33743379
* @return The component pointer.
33753380
*
33763381
* @see ecs_emplace_id()
@@ -4128,6 +4133,7 @@ char* ecs_get_path_w_sep(
41284133
* @param sep The separator to use between path elements.
41294134
* @param prefix The initial character to use for root elements.
41304135
* @param buf The buffer to write to.
4136+
* @param escape Whether to escape separator characters in names.
41314137
*
41324138
* @see ecs_get_path_w_sep()
41334139
*/
@@ -5727,6 +5733,7 @@ void* ecs_field_w_size(
57275733
* @param it the iterator.
57285734
* @param size The size of the field type.
57295735
* @param index The index of the field.
5736+
* @param row The row to get data for.
57305737
* @return A pointer to the data of the field.
57315738
*/
57325739
FLECS_API
@@ -6191,6 +6198,8 @@ void ecs_table_swap_rows(
61916198
* @param entity The entity to commit.
61926199
* @param record The entity's record (optional, providing it saves a lookup).
61936200
* @param table The table to commit the entity to.
6201+
* @param added Components added to the entity.
6202+
* @param removed Components removed from the entity.
61946203
* @return True if the entity got moved, false otherwise.
61956204
*/
61966205
FLECS_API
@@ -6325,7 +6334,21 @@ int32_t ecs_search_relation(
63256334
ecs_id_t *component_out,
63266335
struct ecs_table_record_t **tr_out);
63276336

6328-
/* Up traversal from entity */
6337+
/** Search for component id by following a relationship, starting from entity.
6338+
* This operation is the same as ecs_search_relation(), but starts the search
6339+
* from an entity rather than a table.
6340+
*
6341+
* @param world The world.
6342+
* @param entity The entity from which to begin the search.
6343+
* @param id The component id to search for.
6344+
* @param rel The relationship to follow.
6345+
* @param self If true, also search the entity itself.
6346+
* @param cr Optional component record for the id.
6347+
* @param tgt_out Out parameter for the target entity.
6348+
* @param id_out Out parameter for the found id.
6349+
* @param tr_out Out parameter for the table record.
6350+
* @return The index of the id in the entity's type, or -1 if not found.
6351+
*/
63296352
FLECS_API
63306353
int32_t ecs_search_relation_for_entity(
63316354
const ecs_world_t *world,

include/flecs/addons/alerts.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
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. */
@@ -56,7 +57,7 @@ typedef struct EcsAlertsActive {
5657
int32_t info_count; /**< Number of alerts for source with info severity */
5758
int32_t warning_count; /**< Number of alerts for source with warning severity */
5859
int32_t error_count; /**< Number of alerts for source with error severity */
59-
ecs_map_t alerts;
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;

include/flecs/addons/doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ FLECS_API extern const ecs_entity_t EcsDocColor;
6565
* - EcsDocColor
6666
*/
6767
typedef struct EcsDocDescription {
68-
char *value;
68+
char *value; /**< Description value */
6969
} EcsDocDescription;
7070

7171
/** Add UUID to entity.

0 commit comments

Comments
 (0)