forked from SanderMertens/flecs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.h
More file actions
239 lines (195 loc) · 5.53 KB
/
Copy pathtable.h
File metadata and controls
239 lines (195 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/**
* @file table.h
* @brief Table functions.
*/
#ifndef FLECS_TABLE_H
#define FLECS_TABLE_H
/* Init table */
void flecs_table_init(
ecs_world_t *world,
ecs_table_t *table,
ecs_table_t *from);
/** Copy type. */
ecs_type_t flecs_type_copy(
ecs_world_t *world,
const ecs_type_t *src);
/** Free type. */
void flecs_type_free(
ecs_world_t *world,
ecs_type_t *type);
/** Find or create table for a set of components */
ecs_table_t* flecs_table_find_or_create(
ecs_world_t *world,
ecs_type_t *type);
/* Initialize columns for data */
void flecs_table_init_data(
ecs_world_t *world,
ecs_table_t *table);
/* Clear all entities from a table. */
void flecs_table_clear_entities(
ecs_world_t *world,
ecs_table_t *table);
/* Reset a table to its initial state */
void flecs_table_reset(
ecs_world_t *world,
ecs_table_t *table);
/* Clear all entities from the table. Do not invoke OnRemove systems */
void flecs_table_clear_entities_silent(
ecs_world_t *world,
ecs_table_t *table);
/* Clear table data. Don't call OnRemove handlers. */
void flecs_table_clear_data(
ecs_world_t *world,
ecs_table_t *table,
ecs_data_t *data);
/* Return number of entities in data */
int32_t flecs_table_data_count(
const ecs_data_t *data);
/* Add a new entry to the table for the specified entity */
int32_t flecs_table_append(
ecs_world_t *world,
ecs_table_t *table,
ecs_entity_t entity,
ecs_record_t *record,
bool construct,
bool on_add);
/* Delete an entity from the table. */
void flecs_table_delete(
ecs_world_t *world,
ecs_table_t *table,
int32_t index,
bool destruct);
/* Make sure table records are in correct table cache list */
bool flecs_table_records_update_empty(
ecs_table_t *table);
/* Move a row from one table to another */
void flecs_table_move(
ecs_world_t *world,
ecs_entity_t dst_entity,
ecs_entity_t src_entity,
ecs_table_t *new_table,
int32_t new_index,
ecs_table_t *old_table,
int32_t old_index,
bool construct);
/* Grow table with specified number of records. Populate table with entities,
* starting from specified entity id. */
int32_t flecs_table_appendn(
ecs_world_t *world,
ecs_table_t *table,
ecs_data_t *data,
int32_t count,
const ecs_entity_t *ids);
/* Set table to a fixed size. Useful for preallocating memory in advance. */
void flecs_table_set_size(
ecs_world_t *world,
ecs_table_t *table,
ecs_data_t *data,
int32_t count);
/* Shrink table to contents */
bool flecs_table_shrink(
ecs_world_t *world,
ecs_table_t *table);
/* Get dirty state for table columns */
int32_t* flecs_table_get_dirty_state(
ecs_world_t *world,
ecs_table_t *table);
/* Initialize root table */
void flecs_init_root_table(
ecs_world_t *world);
/* Unset components in table */
void flecs_table_remove_actions(
ecs_world_t *world,
ecs_table_t *table);
/* Free table */
void flecs_table_free(
ecs_world_t *world,
ecs_table_t *table);
/* Free table */
void flecs_table_free_type(
ecs_world_t *world,
ecs_table_t *table);
/* Replace data */
void flecs_table_replace_data(
ecs_world_t *world,
ecs_table_t *table,
ecs_data_t *data);
/* Merge data of one table into another table */
void flecs_table_merge(
ecs_world_t *world,
ecs_table_t *new_table,
ecs_table_t *old_table,
ecs_data_t *new_data,
ecs_data_t *old_data);
void flecs_table_swap(
ecs_world_t *world,
ecs_table_t *table,
int32_t row_1,
int32_t row_2);
ecs_table_t *flecs_table_traverse_add(
ecs_world_t *world,
ecs_table_t *table,
ecs_id_t *id_ptr,
ecs_table_diff_t *diff);
ecs_table_t *flecs_table_traverse_remove(
ecs_world_t *world,
ecs_table_t *table,
ecs_id_t *id_ptr,
ecs_table_diff_t *diff);
void flecs_table_mark_dirty(
ecs_world_t *world,
ecs_table_t *table,
ecs_entity_t component);
void flecs_table_notify(
ecs_world_t *world,
ecs_table_t *table,
ecs_table_event_t *event);
void flecs_table_clear_edges(
ecs_world_t *world,
ecs_table_t *table);
void flecs_table_delete_entities(
ecs_world_t *world,
ecs_table_t *table);
ecs_vec_t *ecs_table_column_for_id(
const ecs_world_t *world,
const ecs_table_t *table,
ecs_id_t id);
int32_t flecs_table_column_to_union_index(
const ecs_table_t *table,
int32_t column);
/* Increase refcount of table (prevents deletion) */
void flecs_table_claim(
ecs_world_t *world,
ecs_table_t *table);
/* Decreases refcount of table (may delete) */
bool flecs_table_release(
ecs_world_t *world,
ecs_table_t *table);
/* Increase observer count of table */
void flecs_table_observer_add(
ecs_table_t *table,
int32_t value);
/* Table diff builder, used to build id lists that indicate the difference in
* ids between two tables. */
void flecs_table_diff_builder_init(
ecs_world_t *world,
ecs_table_diff_builder_t *builder);
void flecs_table_diff_builder_fini(
ecs_world_t *world,
ecs_table_diff_builder_t *builder);
void flecs_table_diff_builder_clear(
ecs_table_diff_builder_t *builder);
void flecs_table_diff_build_append_table(
ecs_world_t *world,
ecs_table_diff_builder_t *dst,
ecs_table_diff_t *src);
void flecs_table_diff_build(
ecs_world_t *world,
ecs_table_diff_builder_t *builder,
ecs_table_diff_t *diff,
int32_t added_offset,
int32_t removed_offset);
void flecs_table_diff_build_noalloc(
ecs_table_diff_builder_t *builder,
ecs_table_diff_t *diff);
#endif