Flecs: include/flecs/addons/meta.h 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
meta.h
Go to the documentation of this file.
1
56
57#ifdef FLECS_META
58
66
67#ifndef FLECS_MODULE
68#define FLECS_MODULE
69#endif
70
71#ifndef FLECS_META_H
72#define FLECS_META_H
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
79#define ECS_MEMBER_DESC_CACHE_SIZE (32)
80
94
95 typedef bool ecs_bool_t;
96 typedef char ecs_char_t;
97 typedef unsigned char ecs_byte_t;
98 typedef uint8_t ecs_u8_t;
99 typedef uint16_t ecs_u16_t;
100 typedef uint32_t ecs_u32_t;
101 typedef uint64_t ecs_u64_t;
102 typedef uintptr_t ecs_uptr_t;
103 typedef int8_t ecs_i8_t;
104 typedef int16_t ecs_i16_t;
105 typedef int32_t ecs_i32_t;
106 typedef int64_t ecs_i64_t;
107 typedef intptr_t ecs_iptr_t;
108 typedef float ecs_f32_t;
109 typedef double ecs_f64_t;
110 typedef char* ecs_string_t;
111
112/* Meta module component IDs */
113FLECS_API extern const ecs_entity_t ecs_id(EcsType);
114FLECS_API extern const ecs_entity_t ecs_id(EcsTypeSerializer);
115FLECS_API extern const ecs_entity_t ecs_id(EcsPrimitive);
116FLECS_API extern const ecs_entity_t ecs_id(EcsEnum);
117FLECS_API extern const ecs_entity_t ecs_id(EcsBitmask);
118FLECS_API extern const ecs_entity_t ecs_id(EcsConstants);
119FLECS_API extern const ecs_entity_t ecs_id(EcsMember);
120FLECS_API extern const ecs_entity_t ecs_id(EcsMemberRanges);
121FLECS_API extern const ecs_entity_t ecs_id(EcsStruct);
122FLECS_API extern const ecs_entity_t ecs_id(EcsArray);
123FLECS_API extern const ecs_entity_t ecs_id(EcsVector);
124FLECS_API extern const ecs_entity_t ecs_id(EcsOpaque);
125FLECS_API extern const ecs_entity_t ecs_id(EcsUnit);
126FLECS_API extern const ecs_entity_t ecs_id(EcsUnitPrefix);
127FLECS_API extern const ecs_entity_t EcsQuantity;
128
129/* Primitive type component IDs */
130
131FLECS_API extern const ecs_entity_t ecs_id(ecs_bool_t);
132FLECS_API extern const ecs_entity_t ecs_id(ecs_char_t);
133FLECS_API extern const ecs_entity_t ecs_id(ecs_byte_t);
134FLECS_API extern const ecs_entity_t ecs_id(ecs_u8_t);
135FLECS_API extern const ecs_entity_t ecs_id(ecs_u16_t);
136FLECS_API extern const ecs_entity_t ecs_id(ecs_u32_t);
137FLECS_API extern const ecs_entity_t ecs_id(ecs_u64_t);
138FLECS_API extern const ecs_entity_t ecs_id(ecs_uptr_t);
139FLECS_API extern const ecs_entity_t ecs_id(ecs_i8_t);
140FLECS_API extern const ecs_entity_t ecs_id(ecs_i16_t);
141FLECS_API extern const ecs_entity_t ecs_id(ecs_i32_t);
142FLECS_API extern const ecs_entity_t ecs_id(ecs_i64_t);
143FLECS_API extern const ecs_entity_t ecs_id(ecs_iptr_t);
144FLECS_API extern const ecs_entity_t ecs_id(ecs_f32_t);
145FLECS_API extern const ecs_entity_t ecs_id(ecs_f64_t);
146FLECS_API extern const ecs_entity_t ecs_id(ecs_string_t);
147FLECS_API extern const ecs_entity_t ecs_id(ecs_entity_t);
148FLECS_API extern const ecs_entity_t ecs_id(ecs_id_t);
149
151 typedef enum ecs_type_kind_t {
152 EcsPrimitiveType,
153 EcsBitmaskType,
154 EcsEnumType,
155 EcsStructType,
156 EcsArrayType,
157 EcsVectorType,
158 EcsOpaqueType,
159 EcsTypeKindLast = EcsOpaqueType
160} ecs_type_kind_t;
161
163 typedef struct EcsType {
164 ecs_type_kind_t kind;
165 bool existing;
166 bool partial;
167} EcsType;
168
170 typedef enum ecs_primitive_kind_t {
171 EcsBool = 1,
172 EcsChar,
173 EcsByte,
174 EcsU8,
175 EcsU16,
176 EcsU32,
177 EcsU64,
178 EcsI8,
179 EcsI16,
180 EcsI32,
181 EcsI64,
182 EcsF32,
183 EcsF64,
184 EcsUPtr,
185 EcsIPtr,
186 EcsString,
187 EcsEntity,
188 EcsId,
189 EcsPrimitiveKindLast = EcsId
190} ecs_primitive_kind_t;
191
193 typedef struct EcsPrimitive {
194 ecs_primitive_kind_t kind;
195} EcsPrimitive;
196
198 typedef struct EcsMember {
199 ecs_entity_t type;
200 int32_t count;
201 ecs_entity_t unit;
202 int32_t offset;
203 bool use_offset;
204} EcsMember;
205
207 typedef struct ecs_member_value_range_t {
208 double min;
209 double max;
210} ecs_member_value_range_t;
211
213 typedef struct EcsMemberRanges {
214 ecs_member_value_range_t value;
215 ecs_member_value_range_t warning;
216 ecs_member_value_range_t error;
217} EcsMemberRanges;
218
220 typedef struct ecs_member_t {
222 const char *name;
223
225 ecs_entity_t type;
226
229 int32_t count;
230
232 int32_t offset;
233
236 ecs_entity_t unit;
237
241 bool use_offset;
242
246 ecs_member_value_range_t range;
247
250 ecs_member_value_range_t error_range;
251
254 ecs_member_value_range_t warning_range;
255
257 ecs_size_t size;
258
260 ecs_entity_t member;
261} ecs_member_t;
262
264 typedef struct EcsStruct {
266 ecs_vec_t members; /* vector<ecs_member_t> */
267} EcsStruct;
268
270 typedef struct ecs_enum_constant_t {
272 const char *name;
273
275 int64_t value;
276
278 uint64_t value_unsigned;
279
281 ecs_entity_t constant;
282} ecs_enum_constant_t;
283
285 typedef struct EcsEnum {
286 ecs_entity_t underlying_type;
287} EcsEnum;
288
290 typedef struct ecs_bitmask_constant_t {
292 const char *name;
293
295 ecs_flags64_t value;
296
298 int64_t _unused;
299
301 ecs_entity_t constant;
302} ecs_bitmask_constant_t;
303
305 typedef struct EcsBitmask {
306 int32_t dummy_;
307} EcsBitmask;
308
310 typedef struct EcsConstants {
312 ecs_map_t *constants;
313
315 ecs_vec_t ordered_constants;
316} EcsConstants;
317
319 typedef struct EcsArray {
320 ecs_entity_t type;
321 int32_t count;
322} EcsArray;
323
325 typedef struct EcsVector {
326 ecs_entity_t type;
327} EcsVector;
328
329
330/* Opaque type support */
331
332#if !defined(__cplusplus) || !defined(FLECS_CPP)
333
335 typedef struct ecs_serializer_t {
337 int (*value)(
338 const struct ecs_serializer_t *ser,
339 ecs_entity_t type,
340 const void *value);
341
343 int (*member)(
344 const struct ecs_serializer_t *ser,
345 const char *member);
346
347 const ecs_world_t *world;
348 void *ctx;
349} ecs_serializer_t;
350
351#elif defined(__cplusplus)
352
353} /* extern "C" { */
354
356typedef struct ecs_serializer_t {
357 /* Serialize value */
358 int (*value_)(
359 const struct ecs_serializer_t *ser,
360 ecs_entity_t type,
361 const void *value);
362
363 /* Serialize member */
364 int (*member_)(
365 const struct ecs_serializer_t *ser,
366 const char *name);
367
368 /* Serialize value */
369 int value(ecs_entity_t type, const void *value) const;
370
371 /* Serialize value */
372 template <typename T>
373 int value(const T& value) const;
374
375 /* Serialize member */
376 int member(const char *name) const;
377
378 const ecs_world_t *world;
379 void *ctx;
380} ecs_serializer_t;
381
382extern "C" {
383#endif
384
386 typedef int (*ecs_meta_serialize_t)(
387 const ecs_serializer_t *ser,
388 const void *src);
389
390
392 typedef int (*ecs_meta_serialize_member_t)(
393 const ecs_serializer_t *ser,
394 const void *src,
395 const char* name);
396
398 typedef int (*ecs_meta_serialize_element_t)(
399 const ecs_serializer_t *ser,
400 const void *src,
401 size_t elem);
402
403
408 typedef struct EcsOpaque {
409 ecs_entity_t as_type;
410 ecs_meta_serialize_t serialize;
411 ecs_meta_serialize_member_t serialize_member;
412 ecs_meta_serialize_element_t serialize_element;
413
414 /* Deserializer interface
415 * Only override the callbacks that are valid for the opaque type. If a
416 * deserializer attempts to assign a value type that is not supported by the
417 * interface, a conversion error is thrown.
418 */
419
421 void (*assign_bool)(
422 void *dst,
423 bool value);
424
426 void (*assign_char)(
427 void *dst,
428 char value);
429
431 void (*assign_int)(
432 void *dst,
433 int64_t value);
434
436 void (*assign_uint)(
437 void *dst,
438 uint64_t value);
439
441 void (*assign_float)(
442 void *dst,
443 double value);
444
446 void (*assign_string)(
447 void *dst,
448 const char *value);
449
451 void (*assign_entity)(
452 void *dst,
453 ecs_world_t *world,
454 ecs_entity_t entity);
455
457 void (*assign_id)(
458 void *dst,
459 ecs_world_t *world,
460 ecs_id_t id);
461
463 void (*assign_null)(
464 void *dst);
465
467 void (*clear)(
468 void *dst);
469
471 void* (*ensure_element)(
472 void *dst,
473 size_t elem);
474
476 void* (*ensure_member)(
477 void *dst,
478 const char *member);
479
481 size_t (*count)(
482 const void *dst);
483
485 void (*resize)(
486 void *dst,
487 size_t count);
488} EcsOpaque;
489
490
491/* Units */
492
500 typedef struct ecs_unit_translation_t {
501 int32_t factor;
502 int32_t power;
503} ecs_unit_translation_t;
504
506 typedef struct EcsUnit {
507 char *symbol;
508 ecs_entity_t prefix;
509 ecs_entity_t base;
510 ecs_entity_t over;
511 ecs_unit_translation_t translation;
512} EcsUnit;
513
515 typedef struct EcsUnitPrefix {
516 char *symbol;
517 ecs_unit_translation_t translation;
518} EcsUnitPrefix;
519
520
521/* Serializer utilities */
522
528 typedef enum ecs_meta_op_kind_t {
529 EcsOpPushStruct,
530 EcsOpPushArray,
531 EcsOpPushVector,
532 EcsOpPop,
533
534 EcsOpOpaqueStruct,
535 EcsOpOpaqueArray,
536 EcsOpOpaqueVector,
537 EcsOpForward,
538
539 EcsOpScope,
540
541 EcsOpOpaqueValue,
542 EcsOpEnum,
543 EcsOpBitmask,
544
545 EcsOpPrimitive,
546
547 EcsOpBool,
548 EcsOpChar,
549 EcsOpByte,
550 EcsOpU8,
551 EcsOpU16,
552 EcsOpU32,
553 EcsOpU64,
554 EcsOpI8,
555 EcsOpI16,
556 EcsOpI32,
557 EcsOpI64,
558 EcsOpF32,
559 EcsOpF64,
560 EcsOpUPtr,
561 EcsOpIPtr,
562 EcsOpString,
563 EcsOpEntity,
564 EcsOpId,
565 EcsMetaTypeOpKindLast = EcsOpId
566} ecs_meta_op_kind_t;
567
569 typedef struct ecs_meta_op_t {
570 ecs_meta_op_kind_t kind;
571 ecs_meta_op_kind_t underlying_kind;
572 ecs_size_t offset;
573 const char *name;
574 ecs_size_t elem_size;
575 int16_t op_count;
576 int16_t member_index;
577 ecs_entity_t type;
578 const ecs_type_info_t *type_info;
579 union {
580 ecs_hashmap_t *members;
581 ecs_map_t *constants;
582 ecs_meta_serialize_t opaque;
583 } is;
584} ecs_meta_op_t;
585
588 typedef struct EcsTypeSerializer {
589 ecs_type_kind_t kind;
590 ecs_vec_t ops;
591} EcsTypeSerializer;
592
593
594/* Deserializer utilities */
595
599#define ECS_META_MAX_SCOPE_DEPTH (32)
600
602 typedef struct ecs_meta_scope_t {
603 ecs_entity_t type;
604 ecs_meta_op_t *ops;
605 int16_t ops_count;
606 int16_t ops_cur;
607 int16_t prev_depth;
608 void *ptr;
609 const EcsOpaque *opaque;
610 ecs_hashmap_t *members;
611 bool is_collection;
612 bool is_empty_scope;
613 bool is_moved_scope;
614 int32_t elem, elem_count;
615} ecs_meta_scope_t;
616
618 typedef struct ecs_meta_cursor_t {
619 const ecs_world_t *world;
620 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
621 int16_t depth;
622 bool valid;
623 bool is_primitive_scope;
624
626 ecs_entity_t (*lookup_action)(ecs_world_t*, const char*, void*);
627 void *lookup_ctx;
628} ecs_meta_cursor_t;
629
636FLECS_API
637 char* ecs_meta_serializer_to_str(
638 ecs_world_t *world,
639 ecs_entity_t type);
640
655FLECS_API
656 ecs_meta_cursor_t ecs_meta_cursor(
657 const ecs_world_t *world,
658 ecs_entity_t type,
659 void *ptr);
660
666FLECS_API
667 void* ecs_meta_get_ptr(
668 ecs_meta_cursor_t *cursor);
669
675FLECS_API
676 int ecs_meta_next(
677 ecs_meta_cursor_t *cursor);
678
684FLECS_API
685 int ecs_meta_elem(
686 ecs_meta_cursor_t *cursor,
687 int32_t elem);
688
695FLECS_API
696 int ecs_meta_member(
697 ecs_meta_cursor_t *cursor,
698 const char *name);
699
707FLECS_API
708 int ecs_meta_try_member(
709 ecs_meta_cursor_t *cursor,
710 const char *name);
711
720FLECS_API
721 int ecs_meta_dotmember(
722 ecs_meta_cursor_t *cursor,
723 const char *name);
724
732FLECS_API
733 int ecs_meta_try_dotmember(
734 ecs_meta_cursor_t *cursor,
735 const char *name);
736
742FLECS_API
743 int ecs_meta_push(
744 ecs_meta_cursor_t *cursor);
745
751FLECS_API
752 int ecs_meta_pop(
753 ecs_meta_cursor_t *cursor);
754
760FLECS_API
761 bool ecs_meta_is_collection(
762 const ecs_meta_cursor_t *cursor);
763
769FLECS_API
770 ecs_entity_t ecs_meta_get_type(
771 const ecs_meta_cursor_t *cursor);
772
778FLECS_API
779 ecs_entity_t ecs_meta_get_unit(
780 const ecs_meta_cursor_t *cursor);
781
787FLECS_API
788 const char* ecs_meta_get_member(
789 const ecs_meta_cursor_t *cursor);
790
796FLECS_API
797 ecs_entity_t ecs_meta_get_member_id(
798 const ecs_meta_cursor_t *cursor);
799
800/* The set functions assign the field with the specified value. If the value
801 * does not have the same type as the field, it will be cast to the field type.
802 * If no valid conversion is available, the operation will fail. */
803
810FLECS_API
811 int ecs_meta_set_bool(
812 ecs_meta_cursor_t *cursor,
813 bool value);
814
821FLECS_API
822 int ecs_meta_set_char(
823 ecs_meta_cursor_t *cursor,
824 char value);
825
832FLECS_API
833 int ecs_meta_set_int(
834 ecs_meta_cursor_t *cursor,
835 int64_t value);
836
843FLECS_API
844 int ecs_meta_set_uint(
845 ecs_meta_cursor_t *cursor,
846 uint64_t value);
847
854FLECS_API
855 int ecs_meta_set_float(
856 ecs_meta_cursor_t *cursor,
857 double value);
858
865FLECS_API
866 int ecs_meta_set_string(
867 ecs_meta_cursor_t *cursor,
868 const char *value);
869
876FLECS_API
877 int ecs_meta_set_string_literal(
878 ecs_meta_cursor_t *cursor,
879 const char *value);
880
887FLECS_API
888 int ecs_meta_set_entity(
889 ecs_meta_cursor_t *cursor,
890 ecs_entity_t value);
891
898FLECS_API
899 int ecs_meta_set_id(
900 ecs_meta_cursor_t *cursor,
901 ecs_id_t value);
902
908FLECS_API
909 int ecs_meta_set_null(
910 ecs_meta_cursor_t *cursor);
911
918FLECS_API
919 int ecs_meta_set_value(
920 ecs_meta_cursor_t *cursor,
921 const ecs_value_t *value);
922
923/* Functions for getting members. */
924
930FLECS_API
931 bool ecs_meta_get_bool(
932 const ecs_meta_cursor_t *cursor);
933
939FLECS_API
940 char ecs_meta_get_char(
941 const ecs_meta_cursor_t *cursor);
942
948FLECS_API
949int64_t ecs_meta_get_int(
950 const ecs_meta_cursor_t *cursor);
951
957FLECS_API
958uint64_t ecs_meta_get_uint(
959 const ecs_meta_cursor_t *cursor);
960
966FLECS_API
967 double ecs_meta_get_float(
968 const ecs_meta_cursor_t *cursor);
969
977FLECS_API
978 const char* ecs_meta_get_string(
979 const ecs_meta_cursor_t *cursor);
980
987FLECS_API
988 ecs_entity_t ecs_meta_get_entity(
989 const ecs_meta_cursor_t *cursor);
990
997FLECS_API
998 ecs_id_t ecs_meta_get_id(
999 const ecs_meta_cursor_t *cursor);
1000
1007FLECS_API
1008 double ecs_meta_ptr_to_float(
1009 ecs_primitive_kind_t type_kind,
1010 const void *ptr);
1011
1020FLECS_API
1021ecs_size_t ecs_meta_op_get_elem_count(
1022 const ecs_meta_op_t *op,
1023 const void *ptr);
1024
1025/* API functions for creating meta types */
1026
1028 typedef struct ecs_primitive_desc_t {
1029 ecs_entity_t entity;
1030 ecs_primitive_kind_t kind;
1031} ecs_primitive_desc_t;
1032
1039FLECS_API
1040 ecs_entity_t ecs_primitive_init(
1041 ecs_world_t *world,
1042 const ecs_primitive_desc_t *desc);
1043
1044
1046 typedef struct ecs_enum_desc_t {
1047 ecs_entity_t entity;
1048 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1049 ecs_entity_t underlying_type;
1050} ecs_enum_desc_t;
1051
1058FLECS_API
1059 ecs_entity_t ecs_enum_init(
1060 ecs_world_t *world,
1061 const ecs_enum_desc_t *desc);
1062
1063
1065 typedef struct ecs_bitmask_desc_t {
1066 ecs_entity_t entity;
1067 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1068} ecs_bitmask_desc_t;
1069
1076FLECS_API
1077 ecs_entity_t ecs_bitmask_init(
1078 ecs_world_t *world,
1079 const ecs_bitmask_desc_t *desc);
1080
1081
1083 typedef struct ecs_array_desc_t {
1084 ecs_entity_t entity;
1085 ecs_entity_t type;
1086 int32_t count;
1087} ecs_array_desc_t;
1088
1095FLECS_API
1096 ecs_entity_t ecs_array_init(
1097 ecs_world_t *world,
1098 const ecs_array_desc_t *desc);
1099
1100
1102 typedef struct ecs_vector_desc_t {
1103 ecs_entity_t entity;
1104 ecs_entity_t type;
1105} ecs_vector_desc_t;
1106
1113FLECS_API
1114 ecs_entity_t ecs_vector_init(
1115 ecs_world_t *world,
1116 const ecs_vector_desc_t *desc);
1117
1118
1120 typedef struct ecs_struct_desc_t {
1121 ecs_entity_t entity;
1122 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
1123 bool create_member_entities;
1124} ecs_struct_desc_t;
1125
1132FLECS_API
1133 ecs_entity_t ecs_struct_init(
1134 ecs_world_t *world,
1135 const ecs_struct_desc_t *desc);
1136
1145FLECS_API
1146 int ecs_struct_add_member(
1147 ecs_world_t *world,
1148 ecs_entity_t type,
1149 const ecs_member_t *member);
1150
1158FLECS_API
1159 ecs_member_t* ecs_struct_get_member(
1160 ecs_world_t *world,
1161 ecs_entity_t type,
1162 const char *name);
1163
1171FLECS_API
1172 ecs_member_t* ecs_struct_get_nth_member(
1173 ecs_world_t *world,
1174 ecs_entity_t type,
1175 int32_t i);
1176
1178 typedef struct ecs_opaque_desc_t {
1179 ecs_entity_t entity;
1180 EcsOpaque type;
1181} ecs_opaque_desc_t;
1182
1205FLECS_API
1206 ecs_entity_t ecs_opaque_init(
1207 ecs_world_t *world,
1208 const ecs_opaque_desc_t *desc);
1209
1210
1212 typedef struct ecs_unit_desc_t {
1214 ecs_entity_t entity;
1215
1217 const char *symbol;
1218
1220 ecs_entity_t quantity;
1221
1223 ecs_entity_t base;
1224
1226 ecs_entity_t over;
1227
1229 ecs_unit_translation_t translation;
1230
1237 ecs_entity_t prefix;
1238} ecs_unit_desc_t;
1239
1246FLECS_API
1247 ecs_entity_t ecs_unit_init(
1248 ecs_world_t *world,
1249 const ecs_unit_desc_t *desc);
1250
1251
1253 typedef struct ecs_unit_prefix_desc_t {
1255 ecs_entity_t entity;
1256
1258 const char *symbol;
1259
1261 ecs_unit_translation_t translation;
1262} ecs_unit_prefix_desc_t;
1263
1270FLECS_API
1271 ecs_entity_t ecs_unit_prefix_init(
1272 ecs_world_t *world,
1273 const ecs_unit_prefix_desc_t *desc);
1274
1275
1282FLECS_API
1283 ecs_entity_t ecs_quantity_init(
1284 ecs_world_t *world,
1285 const ecs_entity_desc_t *desc);
1286
1287/* Convenience macros */
1288
1290#define ecs_primitive(world, ...)\
1291 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
1292
1294#define ecs_enum(world, ...)\
1295 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
1296
1298#define ecs_bitmask(world, ...)\
1299 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
1300
1302#define ecs_array(world, ...)\
1303 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
1304
1306#define ecs_vector(world, ...)\
1307 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
1308
1310#define ecs_opaque(world, ...)\
1311 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
1312
1314#define ecs_struct(world, ...)\
1315 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
1316
1318#define ecs_unit(world, ...)\
1319 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
1320
1322#define ecs_unit_prefix(world, ...)\
1323 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
1324
1326#define ecs_quantity(world, ...)\
1327 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
1328
1329
1338FLECS_API
1339 void FlecsMetaImport(
1340 ecs_world_t *world);
1341
1342#ifdef __cplusplus
1343}
1344#endif
1345
1346#include "meta_c.h"
1347
1348#endif
1349
1351
1352#endif
ecs_meta_set_int
FLECS_API int ecs_meta_set_int(ecs_meta_cursor_t *cursor, int64_t value)
Set field with int value.
ecs_meta_next
FLECS_API int ecs_meta_next(ecs_meta_cursor_t *cursor)
Move cursor to next field.
ecs_meta_set_uint
FLECS_API int ecs_meta_set_uint(ecs_meta_cursor_t *cursor, uint64_t value)
Set field with uint value.
ecs_meta_get_bool
FLECS_API bool ecs_meta_get_bool(const ecs_meta_cursor_t *cursor)
Get field value as boolean.
ecs_bool_t
bool ecs_bool_t
Primitive type definitions.
Definition meta.h:95
ecs_id
FLECS_API const ecs_entity_t ecs_id(EcsType)
ID for component added to all types with reflection data.
ecs_meta_serialize_member_t
int(* ecs_meta_serialize_member_t)(const ecs_serializer_t *ser, const void *src, const char *name)
Callback invoked to serialize an opaque struct member.
Definition meta.h:392
ecs_bitmask_init
FLECS_API ecs_entity_t ecs_bitmask_init(ecs_world_t *world, const ecs_bitmask_desc_t *desc)
Create a new bitmask type.
ecs_u32_t
uint32_t ecs_u32_t
Built-in u32 type.
Definition meta.h:100
ecs_meta_ptr_to_float
FLECS_API double ecs_meta_ptr_to_float(ecs_primitive_kind_t type_kind, const void *ptr)
Convert pointer of primitive kind to float.
ecs_i16_t
int16_t ecs_i16_t
Built-in i16 type.
Definition meta.h:104
ecs_meta_op_kind_t
ecs_meta_op_kind_t
Serializer instruction opcodes.
Definition meta.h:528
ecs_meta_set_string_literal
FLECS_API int ecs_meta_set_string_literal(ecs_meta_cursor_t *cursor, const char *value)
Set field with string literal value (has enclosing "").
ecs_opaque_init
FLECS_API ecs_entity_t ecs_opaque_init(ecs_world_t *world, const ecs_opaque_desc_t *desc)
Create a new opaque type.
ecs_meta_set_float
FLECS_API int ecs_meta_set_float(ecs_meta_cursor_t *cursor, double value)
Set field with float value.
ecs_meta_dotmember
FLECS_API int ecs_meta_dotmember(ecs_meta_cursor_t *cursor, const char *name)
Move cursor to member.
ecs_meta_get_entity
FLECS_API ecs_entity_t ecs_meta_get_entity(const ecs_meta_cursor_t *cursor)
Get field value as entity.
ecs_u8_t
uint8_t ecs_u8_t
Built-in u8 type.
Definition meta.h:98
ecs_meta_serialize_element_t
int(* ecs_meta_serialize_element_t)(const ecs_serializer_t *ser, const void *src, size_t elem)
Callback invoked to serialize an opaque vector or array element.
Definition meta.h:398
ecs_i64_t
int64_t ecs_i64_t
Built-in i64 type.
Definition meta.h:106
ecs_meta_serializer_to_str
FLECS_API char * ecs_meta_serializer_to_str(ecs_world_t *world, ecs_entity_t type)
Convert serializer to string.
ecs_meta_is_collection
FLECS_API bool ecs_meta_is_collection(const ecs_meta_cursor_t *cursor)
Is the current scope a collection?
ecs_struct_add_member
FLECS_API int ecs_struct_add_member(ecs_world_t *world, ecs_entity_t type, const ecs_member_t *member)
Add member to struct.
ecs_serializer_t
struct ecs_serializer_t ecs_serializer_t
Serializer interface.
ecs_string_t
char * ecs_string_t
Built-in string type.
Definition meta.h:110
ecs_u64_t
uint64_t ecs_u64_t
Built-in u64 type.
Definition meta.h:101
ecs_iptr_t
intptr_t ecs_iptr_t
Built-in iptr type.
Definition meta.h:107
ecs_quantity_init
FLECS_API ecs_entity_t ecs_quantity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Create a new quantity.
ecs_meta_op_get_elem_count
FLECS_API ecs_size_t ecs_meta_op_get_elem_count(const ecs_meta_op_t *op, const void *ptr)
Get element count for array or vector operations.
ecs_meta_set_id
FLECS_API int ecs_meta_set_id(ecs_meta_cursor_t *cursor, ecs_id_t value)
Set field with (component) ID value.
ecs_uptr_t
uintptr_t ecs_uptr_t
Built-in uptr type.
Definition meta.h:102
ecs_meta_cursor
FLECS_API ecs_meta_cursor_t ecs_meta_cursor(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Create meta cursor.
ecs_meta_get_unit
FLECS_API ecs_entity_t ecs_meta_get_unit(const ecs_meta_cursor_t *cursor)
Get unit of current field.
EcsQuantity
FLECS_API const ecs_entity_t EcsQuantity
Tag added to unit quantities.
ecs_f32_t
float ecs_f32_t
Built-in f32 type.
Definition meta.h:108
FlecsMetaImport
FLECS_API void FlecsMetaImport(ecs_world_t *world)
Meta module import function.
ecs_primitive_kind_t
ecs_primitive_kind_t
Primitive type kinds supported by meta addon.
Definition meta.h:170
ecs_meta_get_member_id
FLECS_API ecs_entity_t ecs_meta_get_member_id(const ecs_meta_cursor_t *cursor)
Get member entity of current field.
ecs_meta_get_string
FLECS_API const char * ecs_meta_get_string(const ecs_meta_cursor_t *cursor)
Get field value as string.
ecs_meta_get_member
FLECS_API const char * ecs_meta_get_member(const ecs_meta_cursor_t *cursor)
Get member name of current field.
ecs_struct_get_member
FLECS_API ecs_member_t * ecs_struct_get_member(ecs_world_t *world, ecs_entity_t type, const char *name)
Get member by name from struct.
ecs_struct_get_nth_member
FLECS_API ecs_member_t * ecs_struct_get_nth_member(ecs_world_t *world, ecs_entity_t type, int32_t i)
Get member by index from struct.
ecs_meta_get_float
FLECS_API double ecs_meta_get_float(const ecs_meta_cursor_t *cursor)
Get field value as float.
ecs_meta_pop
FLECS_API int ecs_meta_pop(ecs_meta_cursor_t *cursor)
Pop a struct or collection scope (must follow a push).
ecs_meta_get_type
FLECS_API ecs_entity_t ecs_meta_get_type(const ecs_meta_cursor_t *cursor)
Get type of current field.
ecs_meta_get_uint
FLECS_API uint64_t ecs_meta_get_uint(const ecs_meta_cursor_t *cursor)
Get field value as unsigned integer.
ecs_vector_init
FLECS_API ecs_entity_t ecs_vector_init(ecs_world_t *world, const ecs_vector_desc_t *desc)
Create a new vector type.
ecs_meta_get_char
FLECS_API char ecs_meta_get_char(const ecs_meta_cursor_t *cursor)
Get field value as char.
ecs_f64_t
double ecs_f64_t
Built-in f64 type.
Definition meta.h:109
ecs_char_t
char ecs_char_t
Built-in char type.
Definition meta.h:96
ecs_unit_prefix_init
FLECS_API ecs_entity_t ecs_unit_prefix_init(ecs_world_t *world, const ecs_unit_prefix_desc_t *desc)
Create a new unit prefix.
ecs_meta_elem
FLECS_API int ecs_meta_elem(ecs_meta_cursor_t *cursor, int32_t elem)
Move cursor to a field.
ecs_meta_get_int
FLECS_API int64_t ecs_meta_get_int(const ecs_meta_cursor_t *cursor)
Get field value as signed integer.
ecs_type_kind_t
ecs_type_kind_t
Type kinds supported by meta addon.
Definition meta.h:151
ecs_primitive_init
FLECS_API ecs_entity_t ecs_primitive_init(ecs_world_t *world, const ecs_primitive_desc_t *desc)
Create a new primitive type.
ecs_unit_init
FLECS_API ecs_entity_t ecs_unit_init(ecs_world_t *world, const ecs_unit_desc_t *desc)
Create a new unit.
ecs_u16_t
uint16_t ecs_u16_t
Built-in u16 type.
Definition meta.h:99
ecs_meta_serialize_t
int(* ecs_meta_serialize_t)(const ecs_serializer_t *ser, const void *src)
Callback invoked serializing an opaque type.
Definition meta.h:386
ecs_meta_set_string
FLECS_API int ecs_meta_set_string(ecs_meta_cursor_t *cursor, const char *value)
Set field with string value.
ECS_META_MAX_SCOPE_DEPTH
#define ECS_META_MAX_SCOPE_DEPTH
Maximum level of type nesting.
Definition meta.h:599
ecs_i32_t
int32_t ecs_i32_t
Built-in i32 type.
Definition meta.h:105
ecs_meta_member
FLECS_API int ecs_meta_member(ecs_meta_cursor_t *cursor, const char *name)
Move cursor to member.
ecs_enum_init
FLECS_API ecs_entity_t ecs_enum_init(ecs_world_t *world, const ecs_enum_desc_t *desc)
Create a new enum type.
ecs_struct_init
FLECS_API ecs_entity_t ecs_struct_init(ecs_world_t *world, const ecs_struct_desc_t *desc)
Create a new struct type.
ecs_meta_try_member
FLECS_API int ecs_meta_try_member(ecs_meta_cursor_t *cursor, const char *name)
Same as ecs_meta_member(), but doesn't throw an error.
ecs_meta_set_bool
FLECS_API int ecs_meta_set_bool(ecs_meta_cursor_t *cursor, bool value)
Set field with boolean value.
ecs_i8_t
int8_t ecs_i8_t
Built-in i8 type.
Definition meta.h:103
ecs_byte_t
unsigned char ecs_byte_t
Built-in ecs_byte type.
Definition meta.h:97
ecs_meta_set_char
FLECS_API int ecs_meta_set_char(ecs_meta_cursor_t *cursor, char value)
Set field with char value.
ECS_MEMBER_DESC_CACHE_SIZE
#define ECS_MEMBER_DESC_CACHE_SIZE
Max number of constants and members that can be specified in desc structs.
Definition meta.h:79
ecs_meta_try_dotmember
FLECS_API int ecs_meta_try_dotmember(ecs_meta_cursor_t *cursor, const char *name)
Same as ecs_meta_dotmember(), but doesn't throw an error.
ecs_meta_get_ptr
FLECS_API void * ecs_meta_get_ptr(ecs_meta_cursor_t *cursor)
Get pointer to current field.
ecs_meta_set_value
FLECS_API int ecs_meta_set_value(ecs_meta_cursor_t *cursor, const ecs_value_t *value)
Set field with dynamic value.
ecs_meta_set_null
FLECS_API int ecs_meta_set_null(ecs_meta_cursor_t *cursor)
Set field with null value.
ecs_array_init
FLECS_API ecs_entity_t ecs_array_init(ecs_world_t *world, const ecs_array_desc_t *desc)
Create a new array type.
ecs_meta_set_entity
FLECS_API int ecs_meta_set_entity(ecs_meta_cursor_t *cursor, ecs_entity_t value)
Set field with entity value.
ecs_meta_get_id
FLECS_API ecs_id_t ecs_meta_get_id(const ecs_meta_cursor_t *cursor)
Get field value as (component) ID.
ecs_meta_push
FLECS_API int ecs_meta_push(ecs_meta_cursor_t *cursor)
Push a scope (required and only valid for structs and collections).
EcsOpPrimitive
@ EcsOpPrimitive
Marks first constant that's a primitive.
Definition meta.h:545
EcsOpOpaqueArray
@ EcsOpOpaqueArray
Opaque array.
Definition meta.h:535
EcsOpOpaqueStruct
@ EcsOpOpaqueStruct
Opaque struct.
Definition meta.h:534
EcsOpScope
@ EcsOpScope
Marks last constant that can open or close a scope.
Definition meta.h:539
EcsOpPop
@ EcsOpPop
Pop scope.
Definition meta.h:532
EcsOpPushVector
@ EcsOpPushVector
Push vector.
Definition meta.h:531
EcsOpOpaqueVector
@ EcsOpOpaqueVector
Opaque vector.
Definition meta.h:536
EcsOpPushStruct
@ EcsOpPushStruct
Push struct.
Definition meta.h:529
EcsOpOpaqueValue
@ EcsOpOpaqueValue
Opaque value.
Definition meta.h:541
EcsOpPushArray
@ EcsOpPushArray
Push array.
Definition meta.h:530
EcsOpForward
@ EcsOpForward
Forward to type.
Definition meta.h:537
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:385
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
meta_c.h
Utility macros for populating reflection data in C.
EcsArray
Component added to array type entities.
Definition meta.h:319
EcsArray::count
int32_t count
Number of elements.
Definition meta.h:321
EcsArray::type
ecs_entity_t type
Element type.
Definition meta.h:320
EcsBitmask
Component added to bitmask type entities.
Definition meta.h:305
EcsBitmask::dummy_
int32_t dummy_
Unused.
Definition meta.h:306
EcsConstants
Component with data structures for looking up enum or bitmask constants.
Definition meta.h:310
EcsConstants::ordered_constants
ecs_vec_t ordered_constants
Stores the constants in registration order.
Definition meta.h:315
EcsConstants::constants
ecs_map_t * constants
Populated from child entities with Constant component.
Definition meta.h:312
EcsEnum
Component added to enum type entities.
Definition meta.h:285
EcsEnum::underlying_type
ecs_entity_t underlying_type
Underlying type for enum.
Definition meta.h:286
EcsMemberRanges
Component added to member entities to express valid value ranges.
Definition meta.h:213
EcsMemberRanges::warning
ecs_member_value_range_t warning
Member value warning range.
Definition meta.h:215
EcsMemberRanges::value
ecs_member_value_range_t value
Member value range.
Definition meta.h:214
EcsMemberRanges::error
ecs_member_value_range_t error
Member value error range.
Definition meta.h:216
EcsMember
Component added to member entities.
Definition meta.h:198
EcsMember::unit
ecs_entity_t unit
Member unit.
Definition meta.h:201
EcsMember::use_offset
bool use_offset
If offset should be explicitly used.
Definition meta.h:203
EcsMember::type
ecs_entity_t type
Member type.
Definition meta.h:199
EcsMember::offset
int32_t offset
Member offset.
Definition meta.h:202
EcsMember::count
int32_t count
Number of elements for inline arrays.
Definition meta.h:200
EcsOpaque
Opaque type reflection data.
Definition meta.h:408
EcsOpaque::count
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:481
EcsOpaque::assign_null
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:463
EcsOpaque::serialize_member
ecs_meta_serialize_member_t serialize_member
Serialize member action.
Definition meta.h:411
EcsOpaque::clear
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:467
EcsOpaque::assign_uint
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:436
EcsOpaque::serialize
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:410
EcsOpaque::assign_char
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:426
EcsOpaque::as_type
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:409
EcsOpaque::assign_bool
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:421
EcsOpaque::assign_string
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:446
EcsOpaque::resize
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:485
EcsOpaque::assign_int
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:431
EcsOpaque::assign_float
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:441
EcsOpaque::assign_entity
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:451
EcsOpaque::assign_id
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) ID value.
Definition meta.h:457
EcsOpaque::serialize_element
ecs_meta_serialize_element_t serialize_element
Serialize element action.
Definition meta.h:412
EcsPrimitive
Component added to primitive types.
Definition meta.h:193
EcsPrimitive::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:194
EcsStruct
Component added to struct type entities.
Definition meta.h:264
EcsStruct::members
ecs_vec_t members
Populated from child entities with Member component.
Definition meta.h:266
EcsTypeSerializer
Component that stores the type serializer.
Definition meta.h:588
EcsTypeSerializer::kind
ecs_type_kind_t kind
Quick access to type kind (same as EcsType).
Definition meta.h:589
EcsTypeSerializer::ops
ecs_vec_t ops
vector<ecs_meta_op_t>
Definition meta.h:590
EcsType
Component that is automatically added to every type with the right kind.
Definition meta.h:163
EcsType::existing
bool existing
Whether the type existed or was populated from reflection.
Definition meta.h:165
EcsType::partial
bool partial
Whether the reflection data is a partial type description.
Definition meta.h:166
EcsType::kind
ecs_type_kind_t kind
Type kind.
Definition meta.h:164
EcsUnitPrefix
Component that stores unit prefix data.
Definition meta.h:515
EcsUnitPrefix::translation
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:517
EcsUnitPrefix::symbol
char * symbol
Symbol of prefix (e.g., "K", "M", "Ki").
Definition meta.h:516
EcsUnit
Component that stores unit data.
Definition meta.h:506
EcsUnit::translation
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:511
EcsUnit::prefix
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:508
EcsUnit::symbol
char * symbol
Unit symbol.
Definition meta.h:507
EcsUnit::base
ecs_entity_t base
Base unit (e.g., "meters").
Definition meta.h:509
EcsUnit::over
ecs_entity_t over
Over unit (e.g., "per second").
Definition meta.h:510
EcsVector
Component added to vector type entities.
Definition meta.h:325
EcsVector::type
ecs_entity_t type
Element type.
Definition meta.h:326
ecs_array_desc_t
Used with ecs_array_init().
Definition meta.h:1083
ecs_array_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1084
ecs_array_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1085
ecs_array_desc_t::count
int32_t count
Number of elements.
Definition meta.h:1086
ecs_bitmask_constant_t
Type that describes a bitmask constant.
Definition meta.h:290
ecs_bitmask_constant_t::value
ecs_flags64_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:295
ecs_bitmask_constant_t::_unused
int64_t _unused
Keep layout the same with ecs_enum_constant_t.
Definition meta.h:298
ecs_bitmask_constant_t::constant
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:301
ecs_bitmask_constant_t::name
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:292
ecs_bitmask_desc_t
Used with ecs_bitmask_init().
Definition meta.h:1065
ecs_bitmask_desc_t::constants
ecs_bitmask_constant_t constants[(32)]
Bitmask constants.
Definition meta.h:1067
ecs_bitmask_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1066
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1046
ecs_enum_constant_t
Type that describes an enum constant.
Definition meta.h:270
ecs_enum_constant_t::constant
ecs_entity_t constant
Should not be set by ecs_enum_desc_t.
Definition meta.h:281
ecs_enum_constant_t::value_unsigned
uint64_t value_unsigned
For when the underlying type is unsigned.
Definition meta.h:278
ecs_enum_constant_t::value
int64_t value
May be set when used with ecs_enum_desc_t.
Definition meta.h:275
ecs_enum_constant_t::name
const char * name
Must be set when used with ecs_enum_desc_t.
Definition meta.h:272
ecs_enum_desc_t
Used with ecs_enum_init().
Definition meta.h:1046
ecs_enum_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1047
ecs_enum_desc_t::underlying_type
ecs_entity_t underlying_type
Underlying type for enum.
Definition meta.h:1049
ecs_enum_desc_t::constants
ecs_enum_constant_t constants[(32)]
Enum constants.
Definition meta.h:1048
ecs_member_t
Element type of members vector in EcsStruct.
Definition meta.h:220
ecs_member_t::warning_range
ecs_member_value_range_t warning_range
Numerical range outside of which the value represents a warning.
Definition meta.h:254
ecs_member_t::name
const char * name
Must be set when used with ecs_struct_desc_t.
Definition meta.h:222
ecs_member_t::size
ecs_size_t size
Should not be set by ecs_struct_desc_t.
Definition meta.h:257
ecs_member_t::use_offset
bool use_offset
Set to true to prevent automatic offset computation.
Definition meta.h:241
ecs_member_t::type
ecs_entity_t type
Member type.
Definition meta.h:225
ecs_member_t::member
ecs_entity_t member
Should not be set by ecs_struct_desc_t.
Definition meta.h:260
ecs_member_t::offset
int32_t offset
May be set when used with ecs_struct_desc_t.
Definition meta.h:232
ecs_member_t::unit
ecs_entity_t unit
May be set when used with ecs_struct_desc_t.
Definition meta.h:236
ecs_member_t::range
ecs_member_value_range_t range
Numerical range that specifies which values member can assume.
Definition meta.h:246
ecs_member_t::count
int32_t count
Element count (for inline arrays).
Definition meta.h:229
ecs_member_t::error_range
ecs_member_value_range_t error_range
Numerical range outside of which the value represents an error.
Definition meta.h:250
ecs_member_value_range_t
Type expressing a range for a member value.
Definition meta.h:207
ecs_member_value_range_t::min
double min
Min member value.
Definition meta.h:208
ecs_member_value_range_t::max
double max
Max member value.
Definition meta.h:209
ecs_meta_cursor_t
Type that enables iterating and populating a value using reflection data.
Definition meta.h:618
ecs_meta_cursor_t::scope
ecs_meta_scope_t scope[(32)]
Cursor scope stack.
Definition meta.h:620
ecs_meta_cursor_t::valid
bool valid
Whether the cursor points to a valid field.
Definition meta.h:622
ecs_meta_cursor_t::world
const ecs_world_t * world
The world.
Definition meta.h:619
ecs_meta_cursor_t::lookup_ctx
void * lookup_ctx
Context for lookup_action.
Definition meta.h:627
ecs_meta_cursor_t::depth
int16_t depth
Current scope depth.
Definition meta.h:621
ecs_meta_cursor_t::lookup_action
ecs_entity_t(* lookup_action)(ecs_world_t *, const char *, void *)
Custom entity lookup action for overriding default ecs_lookup().
Definition meta.h:626
ecs_meta_cursor_t::is_primitive_scope
bool is_primitive_scope
If in root scope, this allows for a push for primitive types.
Definition meta.h:623
ecs_meta_op_t
Meta type serializer instruction data.
Definition meta.h:569
ecs_meta_op_t::name
const char * name
Name of value (only used for struct members).
Definition meta.h:573
ecs_meta_op_t::kind
ecs_meta_op_kind_t kind
Instruction opcode.
Definition meta.h:570
ecs_meta_op_t::members
ecs_hashmap_t * members
string -> member index (structs).
Definition meta.h:580
ecs_meta_op_t::opaque
ecs_meta_serialize_t opaque
Serialize callback for opaque types.
Definition meta.h:582
ecs_meta_op_t::type_info
const ecs_type_info_t * type_info
Type info.
Definition meta.h:578
ecs_meta_op_t::constants
ecs_map_t * constants
(u)int -> constant entity (enums and bitmasks).
Definition meta.h:581
ecs_meta_op_t::member_index
int16_t member_index
Index of member in struct.
Definition meta.h:576
ecs_meta_op_t::type
ecs_entity_t type
Type entity.
Definition meta.h:577
ecs_meta_op_t::op_count
int16_t op_count
Number of operations until next field or end.
Definition meta.h:575
ecs_meta_op_t::underlying_kind
ecs_meta_op_kind_t underlying_kind
Underlying type kind (for enums).
Definition meta.h:571
ecs_meta_op_t::elem_size
ecs_size_t elem_size
Element size (for PushArray or PushVector) and element count (for PopArray).
Definition meta.h:574
ecs_meta_op_t::offset
ecs_size_t offset
Offset of current field.
Definition meta.h:572
ecs_meta_scope_t
Type with information about the currently iterated scope.
Definition meta.h:602
ecs_meta_scope_t::is_moved_scope
bool is_moved_scope
Whether the scope was moved in (with ecs_meta_elem(), for vectors).
Definition meta.h:613
ecs_meta_scope_t::ops_cur
int16_t ops_cur
Current element in ops.
Definition meta.h:606
ecs_meta_scope_t::opaque
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:609
ecs_meta_scope_t::elem_count
int32_t elem_count
Set for collections.
Definition meta.h:614
ecs_meta_scope_t::ptr
void * ptr
Pointer to ops[0].
Definition meta.h:608
ecs_meta_scope_t::is_empty_scope
bool is_empty_scope
Whether the scope was populated (for vectors).
Definition meta.h:612
ecs_meta_scope_t::ops_count
int16_t ops_count
Number of elements in ops.
Definition meta.h:605
ecs_meta_scope_t::ops
ecs_meta_op_t * ops
The type operations (see ecs_meta_op_t).
Definition meta.h:604
ecs_meta_scope_t::members
ecs_hashmap_t * members
string -> member index.
Definition meta.h:610
ecs_meta_scope_t::prev_depth
int16_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:607
ecs_meta_scope_t::type
ecs_entity_t type
The type being iterated.
Definition meta.h:603
ecs_meta_scope_t::is_collection
bool is_collection
Whether the scope is iterating elements.
Definition meta.h:611
ecs_opaque_desc_t
Used with ecs_opaque_init().
Definition meta.h:1178
ecs_opaque_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1179
ecs_opaque_desc_t::type
EcsOpaque type
Type that the opaque type maps to.
Definition meta.h:1180
ecs_primitive_desc_t
Used with ecs_primitive_init().
Definition meta.h:1028
ecs_primitive_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1029
ecs_primitive_desc_t::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:1030
ecs_serializer_t
Serializer interface.
Definition meta.h:335
ecs_serializer_t::ctx
void * ctx
Serializer context.
Definition meta.h:348
ecs_serializer_t::value
int(* value)(const struct ecs_serializer_t *ser, ecs_entity_t type, const void *value)
Serialize value.
Definition meta.h:337
ecs_serializer_t::member
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Serialize member.
Definition meta.h:343
ecs_serializer_t::world
const ecs_world_t * world
The world.
Definition meta.h:347
ecs_struct_desc_t
Used with ecs_struct_init().
Definition meta.h:1120
ecs_struct_desc_t::members
ecs_member_t members[(32)]
Struct members.
Definition meta.h:1122
ecs_struct_desc_t::create_member_entities
bool create_member_entities
Create entities for members.
Definition meta.h:1123
ecs_struct_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1121
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:1023
ecs_unit_desc_t
Used with ecs_unit_init().
Definition meta.h:1212
ecs_unit_desc_t::base
ecs_entity_t base
Base unit, e.g., "meters" (optional).
Definition meta.h:1223
ecs_unit_desc_t::over
ecs_entity_t over
Over unit, e.g., "per second" (optional).
Definition meta.h:1226
ecs_unit_desc_t::symbol
const char * symbol
Unit symbol, e.g., "m", "%", "g".
Definition meta.h:1217
ecs_unit_desc_t::prefix
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:1237
ecs_unit_desc_t::quantity
ecs_entity_t quantity
Unit quantity, e.g., distance, percentage, weight.
Definition meta.h:1220
ecs_unit_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1229
ecs_unit_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit (optional).
Definition meta.h:1214
ecs_unit_prefix_desc_t
Used with ecs_unit_prefix_init().
Definition meta.h:1253
ecs_unit_prefix_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit prefix (optional).
Definition meta.h:1255
ecs_unit_prefix_desc_t::symbol
const char * symbol
Unit prefix symbol, e.g., "K", "M", "Ki".
Definition meta.h:1258
ecs_unit_prefix_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1261
ecs_unit_translation_t
Helper type to describe translation between two units.
Definition meta.h:500
ecs_unit_translation_t::power
int32_t power
Power to apply to factor (e.g., "1", "3", "-9").
Definition meta.h:502
ecs_unit_translation_t::factor
int32_t factor
Factor to apply (e.g., "1000", "1000000", "1024").
Definition meta.h:501
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1037
ecs_vector_desc_t
Used with ecs_vector_init().
Definition meta.h:1102
ecs_vector_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1103
ecs_vector_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1104