Flecs: include/flecs/addons/meta.h Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 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(EcsMember);
119FLECS_API extern const ecs_entity_t ecs_id(EcsMemberRanges);
120FLECS_API extern const ecs_entity_t ecs_id(EcsStruct);
121FLECS_API extern const ecs_entity_t ecs_id(EcsArray);
122FLECS_API extern const ecs_entity_t ecs_id(EcsVector);
123FLECS_API extern const ecs_entity_t ecs_id(EcsOpaque);
124FLECS_API extern const ecs_entity_t ecs_id(EcsUnit);
125FLECS_API extern const ecs_entity_t ecs_id(EcsUnitPrefix);
126FLECS_API extern const ecs_entity_t EcsQuantity;
127
128/* Primitive type component ids */
129
130FLECS_API extern const ecs_entity_t ecs_id(ecs_bool_t);
131FLECS_API extern const ecs_entity_t ecs_id(ecs_char_t);
132FLECS_API extern const ecs_entity_t ecs_id(ecs_byte_t);
133FLECS_API extern const ecs_entity_t ecs_id(ecs_u8_t);
134FLECS_API extern const ecs_entity_t ecs_id(ecs_u16_t);
135FLECS_API extern const ecs_entity_t ecs_id(ecs_u32_t);
136FLECS_API extern const ecs_entity_t ecs_id(ecs_u64_t);
137FLECS_API extern const ecs_entity_t ecs_id(ecs_uptr_t);
138FLECS_API extern const ecs_entity_t ecs_id(ecs_i8_t);
139FLECS_API extern const ecs_entity_t ecs_id(ecs_i16_t);
140FLECS_API extern const ecs_entity_t ecs_id(ecs_i32_t);
141FLECS_API extern const ecs_entity_t ecs_id(ecs_i64_t);
142FLECS_API extern const ecs_entity_t ecs_id(ecs_iptr_t);
143FLECS_API extern const ecs_entity_t ecs_id(ecs_f32_t);
144FLECS_API extern const ecs_entity_t ecs_id(ecs_f64_t);
145FLECS_API extern const ecs_entity_t ecs_id(ecs_string_t);
146FLECS_API extern const ecs_entity_t ecs_id(ecs_entity_t);
147FLECS_API extern const ecs_entity_t ecs_id(ecs_id_t);
148
150 typedef enum ecs_type_kind_t {
151 EcsPrimitiveType,
152 EcsBitmaskType,
153 EcsEnumType,
154 EcsStructType,
155 EcsArrayType,
156 EcsVectorType,
157 EcsOpaqueType,
158 EcsTypeKindLast = EcsOpaqueType
159} ecs_type_kind_t;
160
162 typedef struct EcsType {
163 ecs_type_kind_t kind;
164 bool existing;
165 bool partial;
166} EcsType;
167
169 typedef enum ecs_primitive_kind_t {
170 EcsBool = 1,
171 EcsChar,
172 EcsByte,
173 EcsU8,
174 EcsU16,
175 EcsU32,
176 EcsU64,
177 EcsI8,
178 EcsI16,
179 EcsI32,
180 EcsI64,
181 EcsF32,
182 EcsF64,
183 EcsUPtr,
184 EcsIPtr,
185 EcsString,
186 EcsEntity,
187 EcsId,
188 EcsPrimitiveKindLast = EcsId
189} ecs_primitive_kind_t;
190
192 typedef struct EcsPrimitive {
193 ecs_primitive_kind_t kind;
194} EcsPrimitive;
195
197 typedef struct EcsMember {
198 ecs_entity_t type;
199 int32_t count;
200 ecs_entity_t unit;
201 int32_t offset;
202 bool use_offset;
203} EcsMember;
204
206 typedef struct ecs_member_value_range_t {
207 double min;
208 double max;
209} ecs_member_value_range_t;
210
212 typedef struct EcsMemberRanges {
213 ecs_member_value_range_t value;
214 ecs_member_value_range_t warning;
215 ecs_member_value_range_t error;
216} EcsMemberRanges;
217
219 typedef struct ecs_member_t {
221 const char *name;
222
224 ecs_entity_t type;
225
227 int32_t count;
228
230 int32_t offset;
231
234 ecs_entity_t unit;
235
239 bool use_offset;
240
244 ecs_member_value_range_t range;
245
248 ecs_member_value_range_t error_range;
249
252 ecs_member_value_range_t warning_range;
253
255 ecs_size_t size;
256
258 ecs_entity_t member;
259} ecs_member_t;
260
262 typedef struct EcsStruct {
264 ecs_vec_t members; /* vector<ecs_member_t> */
265} EcsStruct;
266
268 typedef struct ecs_enum_constant_t {
270 const char *name;
271
273 int64_t value;
274
276 uint64_t value_unsigned;
277
279 ecs_entity_t constant;
280} ecs_enum_constant_t;
281
283 typedef struct EcsEnum {
284 ecs_entity_t underlying_type;
285
287 ecs_map_t constants;
288
290 ecs_vec_t ordered_constants;
291} EcsEnum;
292
294 typedef struct ecs_bitmask_constant_t {
296 const char *name;
297
299 ecs_flags64_t value;
300
302 int64_t _unused;
303
305 ecs_entity_t constant;
306} ecs_bitmask_constant_t;
307
309 typedef struct EcsBitmask {
310 /* Populated from child entities with Constant component */
311 ecs_map_t constants;
313 ecs_vec_t ordered_constants;
314} EcsBitmask;
315
317 typedef struct EcsArray {
318 ecs_entity_t type;
319 int32_t count;
320} EcsArray;
321
323 typedef struct EcsVector {
324 ecs_entity_t type;
325} EcsVector;
326
327
328/* Opaque type support */
329
330#if !defined(__cplusplus) || !defined(FLECS_CPP)
331
333 typedef struct ecs_serializer_t {
334 /* Serialize value */
335 int (*value)(
336 const struct ecs_serializer_t *ser,
337 ecs_entity_t type,
338 const void *value);
339
340 /* Serialize member */
341 int (*member)(
342 const struct ecs_serializer_t *ser,
343 const char *member);
344
345 const ecs_world_t *world;
346 void *ctx;
347} ecs_serializer_t;
348
349#elif defined(__cplusplus)
350
351} /* extern "C" { */
352
354typedef struct ecs_serializer_t {
355 /* Serialize value */
356 int (*value_)(
357 const struct ecs_serializer_t *ser,
358 ecs_entity_t type,
359 const void *value);
360
361 /* Serialize member */
362 int (*member_)(
363 const struct ecs_serializer_t *ser,
364 const char *name);
365
366 /* Serialize value */
367 int value(ecs_entity_t type, const void *value) const;
368
369 /* Serialize value */
370 template <typename T>
371 int value(const T& value) const;
372
373 /* Serialize member */
374 int member(const char *name) const;
375
376 const ecs_world_t *world;
377 void *ctx;
378} ecs_serializer_t;
379
380extern "C" {
381#endif
382
384 typedef int (*ecs_meta_serialize_t)(
385 const ecs_serializer_t *ser,
386 const void *src);
387
388
390 typedef int (*ecs_meta_serialize_member_t)(
391 const ecs_serializer_t *ser,
392 const void *src,
393 const char* name);
394
396 typedef int (*ecs_meta_serialize_element_t)(
397 const ecs_serializer_t *ser,
398 const void *src,
399 size_t elem);
400
405 typedef struct EcsOpaque {
406 ecs_entity_t as_type;
407 ecs_meta_serialize_t serialize;
408 ecs_meta_serialize_member_t serialize_member;
409 ecs_meta_serialize_element_t serialize_element;
410
411 /* Deserializer interface
412 * Only override the callbacks that are valid for the opaque type. If a
413 * deserializer attempts to assign a value type that is not supported by the
414 * interface, a conversion error is thrown.
415 */
416
418 void (*assign_bool)(
419 void *dst,
420 bool value);
421
423 void (*assign_char)(
424 void *dst,
425 char value);
426
428 void (*assign_int)(
429 void *dst,
430 int64_t value);
431
433 void (*assign_uint)(
434 void *dst,
435 uint64_t value);
436
438 void (*assign_float)(
439 void *dst,
440 double value);
441
443 void (*assign_string)(
444 void *dst,
445 const char *value);
446
448 void (*assign_entity)(
449 void *dst,
450 ecs_world_t *world,
451 ecs_entity_t entity);
452
454 void (*assign_id)(
455 void *dst,
456 ecs_world_t *world,
457 ecs_id_t id);
458
460 void (*assign_null)(
461 void *dst);
462
464 void (*clear)(
465 void *dst);
466
468 void* (*ensure_element)(
469 void *dst,
470 size_t elem);
471
473 void* (*ensure_member)(
474 void *dst,
475 const char *member);
476
478 size_t (*count)(
479 const void *dst);
480
482 void (*resize)(
483 void *dst,
484 size_t count);
485} EcsOpaque;
486
487
488/* Units */
489
497 typedef struct ecs_unit_translation_t {
498 int32_t factor;
499 int32_t power;
500} ecs_unit_translation_t;
501
503 typedef struct EcsUnit {
504 char *symbol;
505 ecs_entity_t prefix;
506 ecs_entity_t base;
507 ecs_entity_t over;
508 ecs_unit_translation_t translation;
509} EcsUnit;
510
512 typedef struct EcsUnitPrefix {
513 char *symbol;
514 ecs_unit_translation_t translation;
515} EcsUnitPrefix;
516
517
518/* Serializer utilities */
519
525 typedef enum ecs_meta_type_op_kind_t {
526 EcsOpArray,
527 EcsOpVector,
528 EcsOpOpaque,
529 EcsOpPush,
530 EcsOpPop,
531
532 EcsOpScope,
533
534 EcsOpEnum,
535 EcsOpBitmask,
536
537 EcsOpPrimitive,
538
539 EcsOpBool,
540 EcsOpChar,
541 EcsOpByte,
542 EcsOpU8,
543 EcsOpU16,
544 EcsOpU32,
545 EcsOpU64,
546 EcsOpI8,
547 EcsOpI16,
548 EcsOpI32,
549 EcsOpI64,
550 EcsOpF32,
551 EcsOpF64,
552 EcsOpUPtr,
553 EcsOpIPtr,
554 EcsOpString,
555 EcsOpEntity,
556 EcsOpId,
557 EcsMetaTypeOpKindLast = EcsOpId
558} ecs_meta_type_op_kind_t;
559
561 typedef struct ecs_meta_type_op_t {
562 ecs_meta_type_op_kind_t kind;
563 ecs_size_t offset;
564 int32_t count;
565 const char *name;
566 int32_t op_count;
567 ecs_size_t size;
568 ecs_entity_t type;
569 int32_t member_index;
570 ecs_hashmap_t *members;
571} ecs_meta_type_op_t;
572
576 typedef struct EcsTypeSerializer {
577 ecs_vec_t ops;
578} EcsTypeSerializer;
579
580
581/* Deserializer utilities */
582
586#define ECS_META_MAX_SCOPE_DEPTH (32)
587
589 typedef struct ecs_meta_scope_t {
590 ecs_entity_t type;
591 ecs_meta_type_op_t *ops;
592 int32_t op_count;
593 int32_t op_cur;
594 int32_t elem_cur;
595 int32_t prev_depth;
596 void *ptr;
597 const EcsComponent *comp;
598 const EcsOpaque *opaque;
599 ecs_vec_t *vector;
600 ecs_hashmap_t *members;
601 bool is_collection;
602 bool is_inline_array;
603 bool is_empty_scope;
604} ecs_meta_scope_t;
605
607 typedef struct ecs_meta_cursor_t {
608 const ecs_world_t *world;
609 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
610 int32_t depth;
611 bool valid;
612 bool is_primitive_scope;
613
615 ecs_entity_t (*lookup_action)(const ecs_world_t*, const char*, void*);
616 void *lookup_ctx;
617} ecs_meta_cursor_t;
618
633FLECS_API
634 ecs_meta_cursor_t ecs_meta_cursor(
635 const ecs_world_t *world,
636 ecs_entity_t type,
637 void *ptr);
638
644FLECS_API
645 void* ecs_meta_get_ptr(
646 ecs_meta_cursor_t *cursor);
647
653FLECS_API
654 int ecs_meta_next(
655 ecs_meta_cursor_t *cursor);
656
662FLECS_API
663 int ecs_meta_elem(
664 ecs_meta_cursor_t *cursor,
665 int32_t elem);
666
673FLECS_API
674 int ecs_meta_member(
675 ecs_meta_cursor_t *cursor,
676 const char *name);
677
685FLECS_API
686 int ecs_meta_dotmember(
687 ecs_meta_cursor_t *cursor,
688 const char *name);
689
695FLECS_API
696 int ecs_meta_push(
697 ecs_meta_cursor_t *cursor);
698
704FLECS_API
705 int ecs_meta_pop(
706 ecs_meta_cursor_t *cursor);
707
713FLECS_API
714 bool ecs_meta_is_collection(
715 const ecs_meta_cursor_t *cursor);
716
722FLECS_API
723 ecs_entity_t ecs_meta_get_type(
724 const ecs_meta_cursor_t *cursor);
725
731FLECS_API
732 ecs_entity_t ecs_meta_get_unit(
733 const ecs_meta_cursor_t *cursor);
734
740FLECS_API
741 const char* ecs_meta_get_member(
742 const ecs_meta_cursor_t *cursor);
743
749FLECS_API
750 ecs_entity_t ecs_meta_get_member_id(
751 const ecs_meta_cursor_t *cursor);
752
753/* The set functions assign the field with the specified value. If the value
754 * does not have the same type as the field, it will be cased to the field type.
755 * If no valid conversion is available, the operation will fail. */
756
763FLECS_API
764 int ecs_meta_set_bool(
765 ecs_meta_cursor_t *cursor,
766 bool value);
767
774FLECS_API
775 int ecs_meta_set_char(
776 ecs_meta_cursor_t *cursor,
777 char value);
778
785FLECS_API
786 int ecs_meta_set_int(
787 ecs_meta_cursor_t *cursor,
788 int64_t value);
789
796FLECS_API
797 int ecs_meta_set_uint(
798 ecs_meta_cursor_t *cursor,
799 uint64_t value);
800
807FLECS_API
808 int ecs_meta_set_float(
809 ecs_meta_cursor_t *cursor,
810 double value);
811
818FLECS_API
819 int ecs_meta_set_string(
820 ecs_meta_cursor_t *cursor,
821 const char *value);
822
829FLECS_API
830 int ecs_meta_set_string_literal(
831 ecs_meta_cursor_t *cursor,
832 const char *value);
833
840FLECS_API
841 int ecs_meta_set_entity(
842 ecs_meta_cursor_t *cursor,
843 ecs_entity_t value);
844
851FLECS_API
852 int ecs_meta_set_id(
853 ecs_meta_cursor_t *cursor,
854 ecs_id_t value);
855
861FLECS_API
862 int ecs_meta_set_null(
863 ecs_meta_cursor_t *cursor);
864
871FLECS_API
872 int ecs_meta_set_value(
873 ecs_meta_cursor_t *cursor,
874 const ecs_value_t *value);
875
876/* Functions for getting members. */
877
883FLECS_API
884 bool ecs_meta_get_bool(
885 const ecs_meta_cursor_t *cursor);
886
892FLECS_API
893 char ecs_meta_get_char(
894 const ecs_meta_cursor_t *cursor);
895
901FLECS_API
902int64_t ecs_meta_get_int(
903 const ecs_meta_cursor_t *cursor);
904
910FLECS_API
911uint64_t ecs_meta_get_uint(
912 const ecs_meta_cursor_t *cursor);
913
919FLECS_API
920 double ecs_meta_get_float(
921 const ecs_meta_cursor_t *cursor);
922
930FLECS_API
931 const char* ecs_meta_get_string(
932 const ecs_meta_cursor_t *cursor);
933
940FLECS_API
941 ecs_entity_t ecs_meta_get_entity(
942 const ecs_meta_cursor_t *cursor);
943
950 ecs_id_t ecs_meta_get_id(
951 const ecs_meta_cursor_t *cursor);
952
959FLECS_API
960 double ecs_meta_ptr_to_float(
961 ecs_primitive_kind_t type_kind,
962 const void *ptr);
963
964/* API functions for creating meta types */
965
967 typedef struct ecs_primitive_desc_t {
968 ecs_entity_t entity;
969 ecs_primitive_kind_t kind;
970} ecs_primitive_desc_t;
971
978FLECS_API
979 ecs_entity_t ecs_primitive_init(
980 ecs_world_t *world,
981 const ecs_primitive_desc_t *desc);
982
983
985 typedef struct ecs_enum_desc_t {
986 ecs_entity_t entity;
987 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
988 ecs_entity_t underlying_type;
989} ecs_enum_desc_t;
990
997FLECS_API
998 ecs_entity_t ecs_enum_init(
999 ecs_world_t *world,
1000 const ecs_enum_desc_t *desc);
1001
1002
1004 typedef struct ecs_bitmask_desc_t {
1005 ecs_entity_t entity;
1006 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1007} ecs_bitmask_desc_t;
1008
1015FLECS_API
1016 ecs_entity_t ecs_bitmask_init(
1017 ecs_world_t *world,
1018 const ecs_bitmask_desc_t *desc);
1019
1020
1022 typedef struct ecs_array_desc_t {
1023 ecs_entity_t entity;
1024 ecs_entity_t type;
1025 int32_t count;
1026} ecs_array_desc_t;
1027
1034FLECS_API
1035 ecs_entity_t ecs_array_init(
1036 ecs_world_t *world,
1037 const ecs_array_desc_t *desc);
1038
1039
1041 typedef struct ecs_vector_desc_t {
1042 ecs_entity_t entity;
1043 ecs_entity_t type;
1044} ecs_vector_desc_t;
1045
1052FLECS_API
1053 ecs_entity_t ecs_vector_init(
1054 ecs_world_t *world,
1055 const ecs_vector_desc_t *desc);
1056
1057
1059 typedef struct ecs_struct_desc_t {
1060 ecs_entity_t entity;
1061 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
1062} ecs_struct_desc_t;
1063
1070FLECS_API
1071 ecs_entity_t ecs_struct_init(
1072 ecs_world_t *world,
1073 const ecs_struct_desc_t *desc);
1074
1075
1077 typedef struct ecs_opaque_desc_t {
1078 ecs_entity_t entity;
1079 EcsOpaque type;
1080} ecs_opaque_desc_t;
1081
1104FLECS_API
1105 ecs_entity_t ecs_opaque_init(
1106 ecs_world_t *world,
1107 const ecs_opaque_desc_t *desc);
1108
1109
1111 typedef struct ecs_unit_desc_t {
1113 ecs_entity_t entity;
1114
1116 const char *symbol;
1117
1119 ecs_entity_t quantity;
1120
1122 ecs_entity_t base;
1123
1125 ecs_entity_t over;
1126
1128 ecs_unit_translation_t translation;
1129
1136 ecs_entity_t prefix;
1137} ecs_unit_desc_t;
1138
1145FLECS_API
1146 ecs_entity_t ecs_unit_init(
1147 ecs_world_t *world,
1148 const ecs_unit_desc_t *desc);
1149
1150
1152 typedef struct ecs_unit_prefix_desc_t {
1154 ecs_entity_t entity;
1155
1157 const char *symbol;
1158
1160 ecs_unit_translation_t translation;
1161} ecs_unit_prefix_desc_t;
1162
1169FLECS_API
1170 ecs_entity_t ecs_unit_prefix_init(
1171 ecs_world_t *world,
1172 const ecs_unit_prefix_desc_t *desc);
1173
1174
1181FLECS_API
1182 ecs_entity_t ecs_quantity_init(
1183 ecs_world_t *world,
1184 const ecs_entity_desc_t *desc);
1185
1186/* Convenience macros */
1187
1189#define ecs_primitive(world, ...)\
1190 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
1191
1193#define ecs_enum(world, ...)\
1194 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
1195
1197#define ecs_bitmask(world, ...)\
1198 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
1199
1201#define ecs_array(world, ...)\
1202 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
1203
1205#define ecs_vector(world, ...)\
1206 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
1207
1209#define ecs_opaque(world, ...)\
1210 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
1211
1213#define ecs_struct(world, ...)\
1214 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
1215
1217#define ecs_unit(world, ...)\
1218 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
1219
1221#define ecs_unit_prefix(world, ...)\
1222 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
1223
1225#define ecs_quantity(world, ...)\
1226 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
1227
1228
1237FLECS_API
1238 void FlecsMetaImport(
1239 ecs_world_t *world);
1240
1241#ifdef __cplusplus
1242}
1243#endif
1244
1245#include "meta_c.h"
1246
1247#endif
1248
1250
1251#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_id
ecs_id_t ecs_meta_get_id(const ecs_meta_cursor_t *cursor)
Get field value as (component) id.
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:390
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_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:396
ecs_i64_t
int64_t ecs_i64_t
Builtin i64 type.
Definition meta.h:106
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_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:169
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_meta_type_op_kind_t
ecs_meta_type_op_kind_t
Serializer instruction opcodes.
Definition meta.h:525
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:150
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:384
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:586
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_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_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_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:537
EcsOpScope
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition meta.h:532
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:380
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:424
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:373
meta_c.h
Utility macros for populating reflection data in C.
EcsArray
Component added to array type entities.
Definition meta.h:317
EcsArray::count
int32_t count
Number of elements.
Definition meta.h:319
EcsArray::type
ecs_entity_t type
Element type.
Definition meta.h:318
EcsBitmask
Component added to bitmask type entities.
Definition meta.h:309
EcsBitmask::constants
ecs_map_t constants
map<u32_t, ecs_bitmask_constant_t>
Definition meta.h:311
EcsBitmask::ordered_constants
ecs_vec_t ordered_constants
Stores the constants in registration order.
Definition meta.h:313
EcsComponent
Component information.
Definition flecs.h:1532
EcsEnum
Component added to enum type entities.
Definition meta.h:283
EcsEnum::ordered_constants
ecs_vec_t ordered_constants
Stores the constants in registration order.
Definition meta.h:290
EcsEnum::constants
ecs_map_t constants
Populated from child entities with Constant component.
Definition meta.h:287
EcsMemberRanges
Component added to member entities to express valid value ranges.
Definition meta.h:212
EcsMemberRanges::warning
ecs_member_value_range_t warning
Member value warning range.
Definition meta.h:214
EcsMemberRanges::value
ecs_member_value_range_t value
Member value range.
Definition meta.h:213
EcsMemberRanges::error
ecs_member_value_range_t error
Member value error range.
Definition meta.h:215
EcsMember
Component added to member entities.
Definition meta.h:197
EcsMember::unit
ecs_entity_t unit
Member unit.
Definition meta.h:200
EcsMember::use_offset
bool use_offset
If offset should be explicitly used.
Definition meta.h:202
EcsMember::type
ecs_entity_t type
Member type.
Definition meta.h:198
EcsMember::offset
int32_t offset
Member offset.
Definition meta.h:201
EcsMember::count
int32_t count
Number of elements (for inline arrays).
Definition meta.h:199
EcsOpaque
Opaque type reflection data.
Definition meta.h:405
EcsOpaque::count
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:478
EcsOpaque::assign_null
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:460
EcsOpaque::serialize_member
ecs_meta_serialize_member_t serialize_member
Serialize member action.
Definition meta.h:408
EcsOpaque::clear
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:464
EcsOpaque::assign_uint
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:433
EcsOpaque::serialize
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:407
EcsOpaque::assign_char
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:423
EcsOpaque::as_type
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:406
EcsOpaque::assign_bool
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:418
EcsOpaque::assign_string
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:443
EcsOpaque::resize
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:482
EcsOpaque::assign_int
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:428
EcsOpaque::assign_float
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:438
EcsOpaque::assign_entity
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:448
EcsOpaque::assign_id
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) id value.
Definition meta.h:454
EcsOpaque::serialize_element
ecs_meta_serialize_element_t serialize_element
Serialize element action.
Definition meta.h:409
EcsPrimitive
Component added to primitive types.
Definition meta.h:192
EcsPrimitive::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:193
EcsStruct
Component added to struct type entities.
Definition meta.h:262
EcsStruct::members
ecs_vec_t members
Populated from child entities with Member component.
Definition meta.h:264
EcsTypeSerializer
Component that stores the type serializer.
Definition meta.h:576
EcsTypeSerializer::ops
ecs_vec_t ops
vector<ecs_meta_type_op_t>
Definition meta.h:577
EcsType
Component that is automatically added to every type with the right kind.
Definition meta.h:162
EcsType::existing
bool existing
Did the type exist or is it populated from reflection.
Definition meta.h:164
EcsType::partial
bool partial
Is the reflection data a partial type description.
Definition meta.h:165
EcsType::kind
ecs_type_kind_t kind
Type kind.
Definition meta.h:163
EcsUnitPrefix
Component that stores unit prefix data.
Definition meta.h:512
EcsUnitPrefix::translation
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:514
EcsUnitPrefix::symbol
char * symbol
Symbol of prefix (e.g.
Definition meta.h:513
EcsUnit
Component that stores unit data.
Definition meta.h:503
EcsUnit::translation
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:508
EcsUnit::prefix
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:505
EcsUnit::symbol
char * symbol
Unit symbol.
Definition meta.h:504
EcsUnit::base
ecs_entity_t base
Base unit (e.g.
Definition meta.h:506
EcsUnit::over
ecs_entity_t over
Over unit (e.g.
Definition meta.h:507
EcsVector
Component added to vector type entities.
Definition meta.h:323
EcsVector::type
ecs_entity_t type
Element type.
Definition meta.h:324
ecs_array_desc_t
Used with ecs_array_init().
Definition meta.h:1022
ecs_array_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1023
ecs_array_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1024
ecs_array_desc_t::count
int32_t count
Number of elements.
Definition meta.h:1025
ecs_bitmask_constant_t
Type that describes an bitmask constant.
Definition meta.h:294
ecs_bitmask_constant_t::value
ecs_flags64_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:299
ecs_bitmask_constant_t::_unused
int64_t _unused
Keep layout the same with ecs_enum_constant_t.
Definition meta.h:302
ecs_bitmask_constant_t::constant
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:305
ecs_bitmask_constant_t::name
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:296
ecs_bitmask_desc_t
Used with ecs_bitmask_init().
Definition meta.h:1004
ecs_bitmask_desc_t::constants
ecs_bitmask_constant_t constants[(32)]
Bitmask constants.
Definition meta.h:1006
ecs_bitmask_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1005
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1011
ecs_enum_constant_t
Type that describes an enum constant.
Definition meta.h:268
ecs_enum_constant_t::constant
ecs_entity_t constant
Should not be set by ecs_enum_desc_t.
Definition meta.h:279
ecs_enum_constant_t::value_unsigned
uint64_t value_unsigned
For when the underlying type is unsigned.
Definition meta.h:276
ecs_enum_constant_t::value
int64_t value
May be set when used with ecs_enum_desc_t.
Definition meta.h:273
ecs_enum_constant_t::name
const char * name
Must be set when used with ecs_enum_desc_t.
Definition meta.h:270
ecs_enum_desc_t
Used with ecs_enum_init().
Definition meta.h:985
ecs_enum_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:986
ecs_enum_desc_t::constants
ecs_enum_constant_t constants[(32)]
Enum constants.
Definition meta.h:987
ecs_member_t
Element type of members vector in EcsStruct.
Definition meta.h:219
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:252
ecs_member_t::name
const char * name
Must be set when used with ecs_struct_desc_t.
Definition meta.h:221
ecs_member_t::size
ecs_size_t size
Should not be set by ecs_struct_desc_t.
Definition meta.h:255
ecs_member_t::use_offset
bool use_offset
Set to true to prevent automatic offset computation.
Definition meta.h:239
ecs_member_t::type
ecs_entity_t type
Member type.
Definition meta.h:224
ecs_member_t::member
ecs_entity_t member
Should not be set by ecs_struct_desc_t.
Definition meta.h:258
ecs_member_t::offset
int32_t offset
May be set when used with ecs_struct_desc_t.
Definition meta.h:230
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:234
ecs_member_t::range
ecs_member_value_range_t range
Numerical range that specifies which values member can assume.
Definition meta.h:244
ecs_member_t::count
int32_t count
Element count (for inline arrays).
Definition meta.h:227
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:248
ecs_member_value_range_t
Type expressing a range for a member value.
Definition meta.h:206
ecs_member_value_range_t::min
double min
Min member value.
Definition meta.h:207
ecs_member_value_range_t::max
double max
Max member value.
Definition meta.h:208
ecs_meta_cursor_t
Type that enables iterating/populating a value using reflection data.
Definition meta.h:607
ecs_meta_cursor_t::scope
ecs_meta_scope_t scope[(32)]
Cursor scope stack.
Definition meta.h:609
ecs_meta_cursor_t::valid
bool valid
Does the cursor point to a valid field.
Definition meta.h:611
ecs_meta_cursor_t::world
const ecs_world_t * world
The world.
Definition meta.h:608
ecs_meta_cursor_t::lookup_ctx
void * lookup_ctx
Context for lookup_action.
Definition meta.h:616
ecs_meta_cursor_t::depth
int32_t depth
Current scope depth.
Definition meta.h:610
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:612
ecs_meta_cursor_t::lookup_action
ecs_entity_t(* lookup_action)(const ecs_world_t *, const char *, void *)
Custom entity lookup action for overriding default ecs_lookup.
Definition meta.h:615
ecs_meta_scope_t
Type with information about currently serialized scope.
Definition meta.h:589
ecs_meta_scope_t::opaque
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:598
ecs_meta_scope_t::prev_depth
int32_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:595
ecs_meta_scope_t::comp
const EcsComponent * comp
Pointer to component, in case size/alignment is needed.
Definition meta.h:597
ecs_meta_scope_t::ptr
void * ptr
Pointer to the value being iterated.
Definition meta.h:596
ecs_meta_scope_t::is_empty_scope
bool is_empty_scope
Was scope populated (for collections)
Definition meta.h:603
ecs_meta_scope_t::vector
ecs_vec_t * vector
Current vector, in case a vector is iterated.
Definition meta.h:599
ecs_meta_scope_t::elem_cur
int32_t elem_cur
Current element (for collections)
Definition meta.h:594
ecs_meta_scope_t::op_cur
int32_t op_cur
Current operation.
Definition meta.h:593
ecs_meta_scope_t::is_inline_array
bool is_inline_array
Is the scope iterating an inline array?
Definition meta.h:602
ecs_meta_scope_t::members
ecs_hashmap_t * members
string -> member index
Definition meta.h:600
ecs_meta_scope_t::ops
ecs_meta_type_op_t * ops
The type operations (see ecs_meta_type_op_t)
Definition meta.h:591
ecs_meta_scope_t::op_count
int32_t op_count
Number of operations in ops array to process.
Definition meta.h:592
ecs_meta_scope_t::type
ecs_entity_t type
The type being iterated.
Definition meta.h:590
ecs_meta_scope_t::is_collection
bool is_collection
Is the scope iterating elements?
Definition meta.h:601
ecs_meta_type_op_t
Meta type serializer instruction data.
Definition meta.h:561
ecs_meta_type_op_t::kind
ecs_meta_type_op_kind_t kind
Instruction opcode.
Definition meta.h:562
ecs_meta_type_op_t::type
ecs_entity_t type
Type entity.
Definition meta.h:568
ecs_meta_type_op_t::count
int32_t count
Number of elements (for inline arrays).
Definition meta.h:564
ecs_meta_type_op_t::size
ecs_size_t size
Size of type of operation.
Definition meta.h:567
ecs_meta_type_op_t::offset
ecs_size_t offset
Offset of current field.
Definition meta.h:563
ecs_meta_type_op_t::name
const char * name
Name of value (only used for struct members)
Definition meta.h:565
ecs_meta_type_op_t::member_index
int32_t member_index
Index of member in struct.
Definition meta.h:569
ecs_meta_type_op_t::members
ecs_hashmap_t * members
string -> member index (structs only)
Definition meta.h:570
ecs_meta_type_op_t::op_count
int32_t op_count
Number of operations until next field or end.
Definition meta.h:566
ecs_opaque_desc_t
Used with ecs_opaque_init().
Definition meta.h:1077
ecs_opaque_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1078
ecs_opaque_desc_t::type
EcsOpaque type
Type that the opaque type maps to.
Definition meta.h:1079
ecs_primitive_desc_t
Used with ecs_primitive_init().
Definition meta.h:967
ecs_primitive_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:968
ecs_primitive_desc_t::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:969
ecs_serializer_t
Serializer interface.
Definition meta.h:333
ecs_serializer_t::ctx
void * ctx
Serializer context.
Definition meta.h:346
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:335
ecs_serializer_t::member
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Member name.
Definition meta.h:341
ecs_serializer_t::world
const ecs_world_t * world
The world.
Definition meta.h:345
ecs_struct_desc_t
Used with ecs_struct_init().
Definition meta.h:1059
ecs_struct_desc_t::members
ecs_member_t members[(32)]
Struct members.
Definition meta.h:1061
ecs_struct_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1060
ecs_unit_desc_t
Used with ecs_unit_init().
Definition meta.h:1111
ecs_unit_desc_t::base
ecs_entity_t base
Base unit, e.g.
Definition meta.h:1122
ecs_unit_desc_t::over
ecs_entity_t over
Over unit, e.g.
Definition meta.h:1125
ecs_unit_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1116
ecs_unit_desc_t::prefix
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:1136
ecs_unit_desc_t::quantity
ecs_entity_t quantity
Unit quantity, e.g.
Definition meta.h:1119
ecs_unit_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1128
ecs_unit_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit (optional).
Definition meta.h:1113
ecs_unit_prefix_desc_t
Used with ecs_unit_prefix_init().
Definition meta.h:1152
ecs_unit_prefix_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit prefix (optional).
Definition meta.h:1154
ecs_unit_prefix_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1157
ecs_unit_prefix_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1160
ecs_unit_translation_t
Helper type to describe translation between two units.
Definition meta.h:497
ecs_unit_translation_t::power
int32_t power
Power to apply to factor (e.g.
Definition meta.h:499
ecs_unit_translation_t::factor
int32_t factor
Factor to apply (e.g.
Definition meta.h:498
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1002
ecs_vector_desc_t
Used with ecs_vector_init().
Definition meta.h:1041
ecs_vector_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1042
ecs_vector_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1043