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 {
336 /* Serialize value */
337 int (*value)(
338 const struct ecs_serializer_t *ser,
339 ecs_entity_t type,
340 const void *value);
341
342 /* Serialize member */
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
407 typedef struct EcsOpaque {
408 ecs_entity_t as_type;
409 ecs_meta_serialize_t serialize;
410 ecs_meta_serialize_member_t serialize_member;
411 ecs_meta_serialize_element_t serialize_element;
412
413 /* Deserializer interface
414 * Only override the callbacks that are valid for the opaque type. If a
415 * deserializer attempts to assign a value type that is not supported by the
416 * interface, a conversion error is thrown.
417 */
418
420 void (*assign_bool)(
421 void *dst,
422 bool value);
423
425 void (*assign_char)(
426 void *dst,
427 char value);
428
430 void (*assign_int)(
431 void *dst,
432 int64_t value);
433
435 void (*assign_uint)(
436 void *dst,
437 uint64_t value);
438
440 void (*assign_float)(
441 void *dst,
442 double value);
443
445 void (*assign_string)(
446 void *dst,
447 const char *value);
448
450 void (*assign_entity)(
451 void *dst,
452 ecs_world_t *world,
453 ecs_entity_t entity);
454
456 void (*assign_id)(
457 void *dst,
458 ecs_world_t *world,
459 ecs_id_t id);
460
462 void (*assign_null)(
463 void *dst);
464
466 void (*clear)(
467 void *dst);
468
470 void* (*ensure_element)(
471 void *dst,
472 size_t elem);
473
475 void* (*ensure_member)(
476 void *dst,
477 const char *member);
478
480 size_t (*count)(
481 const void *dst);
482
484 void (*resize)(
485 void *dst,
486 size_t count);
487} EcsOpaque;
488
489
490/* Units */
491
499 typedef struct ecs_unit_translation_t {
500 int32_t factor;
501 int32_t power;
502} ecs_unit_translation_t;
503
505 typedef struct EcsUnit {
506 char *symbol;
507 ecs_entity_t prefix;
508 ecs_entity_t base;
509 ecs_entity_t over;
510 ecs_unit_translation_t translation;
511} EcsUnit;
512
514 typedef struct EcsUnitPrefix {
515 char *symbol;
516 ecs_unit_translation_t translation;
517} EcsUnitPrefix;
518
519
520/* Serializer utilities */
521
527 typedef enum ecs_meta_op_kind_t {
528 EcsOpPushStruct,
529 EcsOpPushArray,
530 EcsOpPushVector,
531 EcsOpPop,
532
533 EcsOpOpaqueStruct,
534 EcsOpOpaqueArray,
535 EcsOpOpaqueVector,
536 EcsOpForward,
537
538 EcsOpScope,
539
540 EcsOpOpaqueValue,
541 EcsOpEnum,
542 EcsOpBitmask,
543
544 EcsOpPrimitive,
545
546 EcsOpBool,
547 EcsOpChar,
548 EcsOpByte,
549 EcsOpU8,
550 EcsOpU16,
551 EcsOpU32,
552 EcsOpU64,
553 EcsOpI8,
554 EcsOpI16,
555 EcsOpI32,
556 EcsOpI64,
557 EcsOpF32,
558 EcsOpF64,
559 EcsOpUPtr,
560 EcsOpIPtr,
561 EcsOpString,
562 EcsOpEntity,
563 EcsOpId,
564 EcsMetaTypeOpKindLast = EcsOpId
565} ecs_meta_op_kind_t;
566
568 typedef struct ecs_meta_op_t {
569 ecs_meta_op_kind_t kind;
570 ecs_meta_op_kind_t underlying_kind;
571 ecs_size_t offset;
572 const char *name;
573 ecs_size_t elem_size;
574 int16_t op_count;
575 int16_t member_index;
576 ecs_entity_t type;
577 const ecs_type_info_t *type_info;
578 union {
579 ecs_hashmap_t *members;
580 ecs_map_t *constants;
581 ecs_meta_serialize_t opaque;
582 } is;
583} ecs_meta_op_t;
584
587 typedef struct EcsTypeSerializer {
588 ecs_type_kind_t kind;
589 ecs_vec_t ops;
590} EcsTypeSerializer;
591
592
593/* Deserializer utilities */
594
598#define ECS_META_MAX_SCOPE_DEPTH (32)
599
601 typedef struct ecs_meta_scope_t {
602 ecs_entity_t type;
603 ecs_meta_op_t *ops;
604 int16_t ops_count;
605 int16_t ops_cur;
606 int16_t prev_depth;
607 void *ptr;
608 const EcsOpaque *opaque;
609 ecs_hashmap_t *members;
610 bool is_collection;
611 bool is_empty_scope;
612 bool is_moved_scope;
613 int32_t elem, elem_count;
614} ecs_meta_scope_t;
615
617 typedef struct ecs_meta_cursor_t {
618 const ecs_world_t *world;
619 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
620 int16_t depth;
621 bool valid;
622 bool is_primitive_scope;
623
625 ecs_entity_t (*lookup_action)(ecs_world_t*, const char*, void*);
626 void *lookup_ctx;
627} ecs_meta_cursor_t;
628
630FLECS_API
631 char* ecs_meta_serializer_to_str(
632 ecs_world_t *world,
633 ecs_entity_t type);
634
649FLECS_API
650 ecs_meta_cursor_t ecs_meta_cursor(
651 const ecs_world_t *world,
652 ecs_entity_t type,
653 void *ptr);
654
660FLECS_API
661 void* ecs_meta_get_ptr(
662 ecs_meta_cursor_t *cursor);
663
669FLECS_API
670 int ecs_meta_next(
671 ecs_meta_cursor_t *cursor);
672
678FLECS_API
679 int ecs_meta_elem(
680 ecs_meta_cursor_t *cursor,
681 int32_t elem);
682
689FLECS_API
690 int ecs_meta_member(
691 ecs_meta_cursor_t *cursor,
692 const char *name);
693
701FLECS_API
702 int ecs_meta_try_member(
703 ecs_meta_cursor_t *cursor,
704 const char *name);
705
714FLECS_API
715 int ecs_meta_dotmember(
716 ecs_meta_cursor_t *cursor,
717 const char *name);
718
726FLECS_API
727 int ecs_meta_try_dotmember(
728 ecs_meta_cursor_t *cursor,
729 const char *name);
730
736FLECS_API
737 int ecs_meta_push(
738 ecs_meta_cursor_t *cursor);
739
745FLECS_API
746 int ecs_meta_pop(
747 ecs_meta_cursor_t *cursor);
748
754FLECS_API
755 bool ecs_meta_is_collection(
756 const ecs_meta_cursor_t *cursor);
757
763FLECS_API
764 ecs_entity_t ecs_meta_get_type(
765 const ecs_meta_cursor_t *cursor);
766
772FLECS_API
773 ecs_entity_t ecs_meta_get_unit(
774 const ecs_meta_cursor_t *cursor);
775
781FLECS_API
782 const char* ecs_meta_get_member(
783 const ecs_meta_cursor_t *cursor);
784
790FLECS_API
791 ecs_entity_t ecs_meta_get_member_id(
792 const ecs_meta_cursor_t *cursor);
793
794/* The set functions assign the field with the specified value. If the value
795 * does not have the same type as the field, it will be cased to the field type.
796 * If no valid conversion is available, the operation will fail. */
797
804FLECS_API
805 int ecs_meta_set_bool(
806 ecs_meta_cursor_t *cursor,
807 bool value);
808
815FLECS_API
816 int ecs_meta_set_char(
817 ecs_meta_cursor_t *cursor,
818 char value);
819
826FLECS_API
827 int ecs_meta_set_int(
828 ecs_meta_cursor_t *cursor,
829 int64_t value);
830
837FLECS_API
838 int ecs_meta_set_uint(
839 ecs_meta_cursor_t *cursor,
840 uint64_t value);
841
848FLECS_API
849 int ecs_meta_set_float(
850 ecs_meta_cursor_t *cursor,
851 double value);
852
859FLECS_API
860 int ecs_meta_set_string(
861 ecs_meta_cursor_t *cursor,
862 const char *value);
863
870FLECS_API
871 int ecs_meta_set_string_literal(
872 ecs_meta_cursor_t *cursor,
873 const char *value);
874
881FLECS_API
882 int ecs_meta_set_entity(
883 ecs_meta_cursor_t *cursor,
884 ecs_entity_t value);
885
892FLECS_API
893 int ecs_meta_set_id(
894 ecs_meta_cursor_t *cursor,
895 ecs_id_t value);
896
902FLECS_API
903 int ecs_meta_set_null(
904 ecs_meta_cursor_t *cursor);
905
912FLECS_API
913 int ecs_meta_set_value(
914 ecs_meta_cursor_t *cursor,
915 const ecs_value_t *value);
916
917/* Functions for getting members. */
918
924FLECS_API
925 bool ecs_meta_get_bool(
926 const ecs_meta_cursor_t *cursor);
927
933FLECS_API
934 char ecs_meta_get_char(
935 const ecs_meta_cursor_t *cursor);
936
942FLECS_API
943int64_t ecs_meta_get_int(
944 const ecs_meta_cursor_t *cursor);
945
951FLECS_API
952uint64_t ecs_meta_get_uint(
953 const ecs_meta_cursor_t *cursor);
954
960FLECS_API
961 double ecs_meta_get_float(
962 const ecs_meta_cursor_t *cursor);
963
971FLECS_API
972 const char* ecs_meta_get_string(
973 const ecs_meta_cursor_t *cursor);
974
981FLECS_API
982 ecs_entity_t ecs_meta_get_entity(
983 const ecs_meta_cursor_t *cursor);
984
991FLECS_API
992 ecs_id_t ecs_meta_get_id(
993 const ecs_meta_cursor_t *cursor);
994
1001FLECS_API
1002 double ecs_meta_ptr_to_float(
1003 ecs_primitive_kind_t type_kind,
1004 const void *ptr);
1005
1014FLECS_API
1015ecs_size_t ecs_meta_op_get_elem_count(
1016 const ecs_meta_op_t *op,
1017 const void *ptr);
1018
1019/* API functions for creating meta types */
1020
1022 typedef struct ecs_primitive_desc_t {
1023 ecs_entity_t entity;
1024 ecs_primitive_kind_t kind;
1025} ecs_primitive_desc_t;
1026
1033FLECS_API
1034 ecs_entity_t ecs_primitive_init(
1035 ecs_world_t *world,
1036 const ecs_primitive_desc_t *desc);
1037
1038
1040 typedef struct ecs_enum_desc_t {
1041 ecs_entity_t entity;
1042 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1043 ecs_entity_t underlying_type;
1044} ecs_enum_desc_t;
1045
1052FLECS_API
1053 ecs_entity_t ecs_enum_init(
1054 ecs_world_t *world,
1055 const ecs_enum_desc_t *desc);
1056
1057
1059 typedef struct ecs_bitmask_desc_t {
1060 ecs_entity_t entity;
1061 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1062} ecs_bitmask_desc_t;
1063
1070FLECS_API
1071 ecs_entity_t ecs_bitmask_init(
1072 ecs_world_t *world,
1073 const ecs_bitmask_desc_t *desc);
1074
1075
1077 typedef struct ecs_array_desc_t {
1078 ecs_entity_t entity;
1079 ecs_entity_t type;
1080 int32_t count;
1081} ecs_array_desc_t;
1082
1089FLECS_API
1090 ecs_entity_t ecs_array_init(
1091 ecs_world_t *world,
1092 const ecs_array_desc_t *desc);
1093
1094
1096 typedef struct ecs_vector_desc_t {
1097 ecs_entity_t entity;
1098 ecs_entity_t type;
1099} ecs_vector_desc_t;
1100
1107FLECS_API
1108 ecs_entity_t ecs_vector_init(
1109 ecs_world_t *world,
1110 const ecs_vector_desc_t *desc);
1111
1112
1114 typedef struct ecs_struct_desc_t {
1115 ecs_entity_t entity;
1116 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
1117} ecs_struct_desc_t;
1118
1125FLECS_API
1126 ecs_entity_t ecs_struct_init(
1127 ecs_world_t *world,
1128 const ecs_struct_desc_t *desc);
1129
1130
1132 typedef struct ecs_opaque_desc_t {
1133 ecs_entity_t entity;
1134 EcsOpaque type;
1135} ecs_opaque_desc_t;
1136
1159FLECS_API
1160 ecs_entity_t ecs_opaque_init(
1161 ecs_world_t *world,
1162 const ecs_opaque_desc_t *desc);
1163
1164
1166 typedef struct ecs_unit_desc_t {
1168 ecs_entity_t entity;
1169
1171 const char *symbol;
1172
1174 ecs_entity_t quantity;
1175
1177 ecs_entity_t base;
1178
1180 ecs_entity_t over;
1181
1183 ecs_unit_translation_t translation;
1184
1191 ecs_entity_t prefix;
1192} ecs_unit_desc_t;
1193
1200FLECS_API
1201 ecs_entity_t ecs_unit_init(
1202 ecs_world_t *world,
1203 const ecs_unit_desc_t *desc);
1204
1205
1207 typedef struct ecs_unit_prefix_desc_t {
1209 ecs_entity_t entity;
1210
1212 const char *symbol;
1213
1215 ecs_unit_translation_t translation;
1216} ecs_unit_prefix_desc_t;
1217
1224FLECS_API
1225 ecs_entity_t ecs_unit_prefix_init(
1226 ecs_world_t *world,
1227 const ecs_unit_prefix_desc_t *desc);
1228
1229
1236FLECS_API
1237 ecs_entity_t ecs_quantity_init(
1238 ecs_world_t *world,
1239 const ecs_entity_desc_t *desc);
1240
1241/* Convenience macros */
1242
1244#define ecs_primitive(world, ...)\
1245 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
1246
1248#define ecs_enum(world, ...)\
1249 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
1250
1252#define ecs_bitmask(world, ...)\
1253 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
1254
1256#define ecs_array(world, ...)\
1257 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
1258
1260#define ecs_vector(world, ...)\
1261 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
1262
1264#define ecs_opaque(world, ...)\
1265 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
1266
1268#define ecs_struct(world, ...)\
1269 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
1270
1272#define ecs_unit(world, ...)\
1273 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
1274
1276#define ecs_unit_prefix(world, ...)\
1277 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
1278
1280#define ecs_quantity(world, ...)\
1281 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
1282
1283
1292FLECS_API
1293 void FlecsMetaImport(
1294 ecs_world_t *world);
1295
1296#ifdef __cplusplus
1297}
1298#endif
1299
1300#include "meta_c.h"
1301
1302#endif
1303
1305
1306#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
Builtin 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
Builtin i16 type.
Definition meta.h:104
ecs_meta_op_kind_t
ecs_meta_op_kind_t
Serializer instruction opcodes.
Definition meta.h:527
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
Builtin 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/array element.
Definition meta.h:398
ecs_i64_t
int64_t ecs_i64_t
Builtin 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_serializer_t
struct ecs_serializer_t ecs_serializer_t
Serializer interface.
ecs_string_t
char * ecs_string_t
Builtin string type.
Definition meta.h:110
ecs_u64_t
uint64_t ecs_u64_t
Builtin u64 type.
Definition meta.h:101
ecs_iptr_t
intptr_t ecs_iptr_t
Builtin 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/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
Builtin 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
Builtin 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_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
Builtin f64 type.
Definition meta.h:109
ecs_char_t
char ecs_char_t
Builtin 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
Builtin 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:598
ecs_i32_t
int32_t ecs_i32_t
Builtin 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
Builtin i8 type.
Definition meta.h:103
ecs_byte_t
unsigned char ecs_byte_t
Builtin 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/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/only valid for structs & collections).
EcsOpPrimitive
@ EcsOpPrimitive
Marks first constant that's a primitive.
Definition meta.h:544
EcsOpOpaqueArray
@ EcsOpOpaqueArray
Opaque array.
Definition meta.h:534
EcsOpOpaqueStruct
@ EcsOpOpaqueStruct
Opaque struct.
Definition meta.h:533
EcsOpScope
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition meta.h:538
EcsOpPop
@ EcsOpPop
Pop scope.
Definition meta.h:531
EcsOpPushVector
@ EcsOpPushVector
Push vector.
Definition meta.h:530
EcsOpOpaqueVector
@ EcsOpOpaqueVector
Opaque vector.
Definition meta.h:535
EcsOpPushStruct
@ EcsOpPushStruct
Push struct.
Definition meta.h:528
EcsOpOpaqueValue
@ EcsOpOpaqueValue
Opaque value.
Definition meta.h:540
EcsOpPushArray
@ EcsOpPushArray
Push array.
Definition meta.h:529
EcsOpForward
@ EcsOpForward
Forward to type.
Definition meta.h:536
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:361
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:405
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:354
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
EcsConstants
Component with datastructures for looking up enum/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
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:407
EcsOpaque::count
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:480
EcsOpaque::assign_null
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:462
EcsOpaque::serialize_member
ecs_meta_serialize_member_t serialize_member
Serialize member action.
Definition meta.h:410
EcsOpaque::clear
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:466
EcsOpaque::assign_uint
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:435
EcsOpaque::serialize
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:409
EcsOpaque::assign_char
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:425
EcsOpaque::as_type
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:408
EcsOpaque::assign_bool
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:420
EcsOpaque::assign_string
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:445
EcsOpaque::resize
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:484
EcsOpaque::assign_int
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:430
EcsOpaque::assign_float
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:440
EcsOpaque::assign_entity
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:450
EcsOpaque::assign_id
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) id value.
Definition meta.h:456
EcsOpaque::serialize_element
ecs_meta_serialize_element_t serialize_element
Serialize element action.
Definition meta.h:411
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:587
EcsTypeSerializer::kind
ecs_type_kind_t kind
Quick access to type kind (same as EcsType).
Definition meta.h:588
EcsTypeSerializer::ops
ecs_vec_t ops
vector<ecs_meta_op_t>
Definition meta.h:589
EcsType
Component that is automatically added to every type with the right kind.
Definition meta.h:163
EcsType::existing
bool existing
Did the type exist or is it populated from reflection.
Definition meta.h:165
EcsType::partial
bool partial
Is the reflection data 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:514
EcsUnitPrefix::translation
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:516
EcsUnitPrefix::symbol
char * symbol
Symbol of prefix (e.g.
Definition meta.h:515
EcsUnit
Component that stores unit data.
Definition meta.h:505
EcsUnit::translation
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:510
EcsUnit::prefix
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:507
EcsUnit::symbol
char * symbol
Unit symbol.
Definition meta.h:506
EcsUnit::base
ecs_entity_t base
Base unit (e.g.
Definition meta.h:508
EcsUnit::over
ecs_entity_t over
Over unit (e.g.
Definition meta.h:509
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:1077
ecs_array_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1078
ecs_array_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1079
ecs_array_desc_t::count
int32_t count
Number of elements.
Definition meta.h:1080
ecs_bitmask_constant_t
Type that describes an 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:1059
ecs_bitmask_desc_t::constants
ecs_bitmask_constant_t constants[(32)]
Bitmask constants.
Definition meta.h:1061
ecs_bitmask_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1060
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1018
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:1040
ecs_enum_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1041
ecs_enum_desc_t::constants
ecs_enum_constant_t constants[(32)]
Enum constants.
Definition meta.h:1042
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 an 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, will be auto-populated if type entity is also a unit.
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/populating a value using reflection data.
Definition meta.h:617
ecs_meta_cursor_t::scope
ecs_meta_scope_t scope[(32)]
Cursor scope stack.
Definition meta.h:619
ecs_meta_cursor_t::valid
bool valid
Does the cursor point to a valid field.
Definition meta.h:621
ecs_meta_cursor_t::world
const ecs_world_t * world
The world.
Definition meta.h:618
ecs_meta_cursor_t::lookup_ctx
void * lookup_ctx
Context for lookup_action.
Definition meta.h:626
ecs_meta_cursor_t::depth
int16_t depth
Current scope depth.
Definition meta.h:620
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:625
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:622
ecs_meta_op_t
Meta type serializer instruction data.
Definition meta.h:568
ecs_meta_op_t::name
const char * name
Name of value (only used for struct members).
Definition meta.h:572
ecs_meta_op_t::kind
ecs_meta_op_kind_t kind
Instruction opcode.
Definition meta.h:569
ecs_meta_op_t::members
ecs_hashmap_t * members
string -> member index (structs)
Definition meta.h:579
ecs_meta_op_t::opaque
ecs_meta_serialize_t opaque
Serialize callback for opaque types.
Definition meta.h:581
ecs_meta_op_t::type_info
const ecs_type_info_t * type_info
Type info.
Definition meta.h:577
ecs_meta_op_t::constants
ecs_map_t * constants
(u)int -> constant entity (enums/bitmasks)
Definition meta.h:580
ecs_meta_op_t::member_index
int16_t member_index
Index of member in struct.
Definition meta.h:575
ecs_meta_op_t::type
ecs_entity_t type
Type entity.
Definition meta.h:576
ecs_meta_op_t::op_count
int16_t op_count
Number of operations until next field or end.
Definition meta.h:574
ecs_meta_op_t::underlying_kind
ecs_meta_op_kind_t underlying_kind
Underlying type kind (for enums).
Definition meta.h:570
ecs_meta_op_t::elem_size
ecs_size_t elem_size
Element size (for PushArray/PushVector) and element count (for PopArray).
Definition meta.h:573
ecs_meta_op_t::offset
ecs_size_t offset
Offset of current field.
Definition meta.h:571
ecs_meta_scope_t
Type with information about currently serialized scope.
Definition meta.h:601
ecs_meta_scope_t::is_moved_scope
bool is_moved_scope
Was scope moved in (with ecs_meta_elem, for vectors).
Definition meta.h:612
ecs_meta_scope_t::ops_cur
int16_t ops_cur
Current element in ops.
Definition meta.h:605
ecs_meta_scope_t::opaque
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:608
ecs_meta_scope_t::elem_count
int32_t elem_count
Set for collections.
Definition meta.h:613
ecs_meta_scope_t::ptr
void * ptr
Pointer to ops[0].
Definition meta.h:607
ecs_meta_scope_t::is_empty_scope
bool is_empty_scope
Was scope populated (for vectors).
Definition meta.h:611
ecs_meta_scope_t::ops_count
int16_t ops_count
Number of elements in ops.
Definition meta.h:604
ecs_meta_scope_t::ops
ecs_meta_op_t * ops
The type operations (see ecs_meta_op_t).
Definition meta.h:603
ecs_meta_scope_t::members
ecs_hashmap_t * members
string -> member index
Definition meta.h:609
ecs_meta_scope_t::prev_depth
int16_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:606
ecs_meta_scope_t::type
ecs_entity_t type
The type being iterated.
Definition meta.h:602
ecs_meta_scope_t::is_collection
bool is_collection
Is the scope iterating elements?
Definition meta.h:610
ecs_opaque_desc_t
Used with ecs_opaque_init().
Definition meta.h:1132
ecs_opaque_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1133
ecs_opaque_desc_t::type
EcsOpaque type
Type that the opaque type maps to.
Definition meta.h:1134
ecs_primitive_desc_t
Used with ecs_primitive_init().
Definition meta.h:1022
ecs_primitive_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1023
ecs_primitive_desc_t::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:1024
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)
Pointer to the value to serialize.
Definition meta.h:337
ecs_serializer_t::member
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Member name.
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:1114
ecs_struct_desc_t::members
ecs_member_t members[(32)]
Struct members.
Definition meta.h:1116
ecs_struct_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1115
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:995
ecs_unit_desc_t
Used with ecs_unit_init().
Definition meta.h:1166
ecs_unit_desc_t::base
ecs_entity_t base
Base unit, e.g.
Definition meta.h:1177
ecs_unit_desc_t::over
ecs_entity_t over
Over unit, e.g.
Definition meta.h:1180
ecs_unit_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1171
ecs_unit_desc_t::prefix
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:1191
ecs_unit_desc_t::quantity
ecs_entity_t quantity
Unit quantity, e.g.
Definition meta.h:1174
ecs_unit_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1183
ecs_unit_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit (optional).
Definition meta.h:1168
ecs_unit_prefix_desc_t
Used with ecs_unit_prefix_init().
Definition meta.h:1207
ecs_unit_prefix_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit prefix (optional).
Definition meta.h:1209
ecs_unit_prefix_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1212
ecs_unit_prefix_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1215
ecs_unit_translation_t
Helper type to describe translation between two units.
Definition meta.h:499
ecs_unit_translation_t::power
int32_t power
Power to apply to factor (e.g.
Definition meta.h:501
ecs_unit_translation_t::factor
int32_t factor
Factor to apply (e.g.
Definition meta.h:500
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1009
ecs_vector_desc_t
Used with ecs_vector_init().
Definition meta.h:1096
ecs_vector_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1097
ecs_vector_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1098