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#include <stddef.h>
68
69#ifndef FLECS_MODULE
70#define FLECS_MODULE
71#endif
72
73#ifndef FLECS_META_H
74#define FLECS_META_H
75
76#ifdef __cplusplus
77extern "C" {
78#endif
79
81#define ECS_MEMBER_DESC_CACHE_SIZE (32)
82
96
97 typedef bool ecs_bool_t;
98 typedef char ecs_char_t;
99 typedef unsigned char ecs_byte_t;
100 typedef uint8_t ecs_u8_t;
101 typedef uint16_t ecs_u16_t;
102 typedef uint32_t ecs_u32_t;
103 typedef uint64_t ecs_u64_t;
104 typedef uintptr_t ecs_uptr_t;
105 typedef int8_t ecs_i8_t;
106 typedef int16_t ecs_i16_t;
107 typedef int32_t ecs_i32_t;
108 typedef int64_t ecs_i64_t;
109 typedef intptr_t ecs_iptr_t;
110 typedef float ecs_f32_t;
111 typedef double ecs_f64_t;
112 typedef char* ecs_string_t;
113
114/* Meta module component ids */
115FLECS_API extern const ecs_entity_t ecs_id(EcsType);
116FLECS_API extern const ecs_entity_t ecs_id(EcsTypeSerializer);
117FLECS_API extern const ecs_entity_t ecs_id(EcsPrimitive);
118FLECS_API extern const ecs_entity_t ecs_id(EcsEnum);
119FLECS_API extern const ecs_entity_t ecs_id(EcsBitmask);
120FLECS_API extern const ecs_entity_t ecs_id(EcsMember);
121FLECS_API extern const ecs_entity_t ecs_id(EcsMemberRanges);
122FLECS_API extern const ecs_entity_t ecs_id(EcsStruct);
123FLECS_API extern const ecs_entity_t ecs_id(EcsArray);
124FLECS_API extern const ecs_entity_t ecs_id(EcsVector);
125FLECS_API extern const ecs_entity_t ecs_id(EcsOpaque);
126FLECS_API extern const ecs_entity_t ecs_id(EcsUnit);
127FLECS_API extern const ecs_entity_t ecs_id(EcsUnitPrefix);
128FLECS_API extern const ecs_entity_t EcsQuantity;
129
130/* Primitive type component ids */
131
132FLECS_API extern const ecs_entity_t ecs_id(ecs_bool_t);
133FLECS_API extern const ecs_entity_t ecs_id(ecs_char_t);
134FLECS_API extern const ecs_entity_t ecs_id(ecs_byte_t);
135FLECS_API extern const ecs_entity_t ecs_id(ecs_u8_t);
136FLECS_API extern const ecs_entity_t ecs_id(ecs_u16_t);
137FLECS_API extern const ecs_entity_t ecs_id(ecs_u32_t);
138FLECS_API extern const ecs_entity_t ecs_id(ecs_u64_t);
139FLECS_API extern const ecs_entity_t ecs_id(ecs_uptr_t);
140FLECS_API extern const ecs_entity_t ecs_id(ecs_i8_t);
141FLECS_API extern const ecs_entity_t ecs_id(ecs_i16_t);
142FLECS_API extern const ecs_entity_t ecs_id(ecs_i32_t);
143FLECS_API extern const ecs_entity_t ecs_id(ecs_i64_t);
144FLECS_API extern const ecs_entity_t ecs_id(ecs_iptr_t);
145FLECS_API extern const ecs_entity_t ecs_id(ecs_f32_t);
146FLECS_API extern const ecs_entity_t ecs_id(ecs_f64_t);
147FLECS_API extern const ecs_entity_t ecs_id(ecs_string_t);
148FLECS_API extern const ecs_entity_t ecs_id(ecs_entity_t);
149FLECS_API extern const ecs_entity_t ecs_id(ecs_id_t);
150
152 typedef enum ecs_type_kind_t {
153 EcsPrimitiveType,
154 EcsBitmaskType,
155 EcsEnumType,
156 EcsStructType,
157 EcsArrayType,
158 EcsVectorType,
159 EcsOpaqueType,
160 EcsTypeKindLast = EcsOpaqueType
161} ecs_type_kind_t;
162
164 typedef struct EcsType {
165 ecs_type_kind_t kind;
166 bool existing;
167 bool partial;
168} EcsType;
169
171 typedef enum ecs_primitive_kind_t {
172 EcsBool = 1,
173 EcsChar,
174 EcsByte,
175 EcsU8,
176 EcsU16,
177 EcsU32,
178 EcsU64,
179 EcsI8,
180 EcsI16,
181 EcsI32,
182 EcsI64,
183 EcsF32,
184 EcsF64,
185 EcsUPtr,
186 EcsIPtr,
187 EcsString,
188 EcsEntity,
189 EcsId,
190 EcsPrimitiveKindLast = EcsId
191} ecs_primitive_kind_t;
192
194 typedef struct EcsPrimitive {
195 ecs_primitive_kind_t kind;
196} EcsPrimitive;
197
199 typedef struct EcsMember {
200 ecs_entity_t type;
201 int32_t count;
202 ecs_entity_t unit;
203 int32_t offset;
204 bool use_offset;
205} EcsMember;
206
208 typedef struct ecs_member_value_range_t {
209 double min;
210 double max;
211} ecs_member_value_range_t;
212
214 typedef struct EcsMemberRanges {
215 ecs_member_value_range_t value;
216 ecs_member_value_range_t warning;
217 ecs_member_value_range_t error;
218} EcsMemberRanges;
219
221 typedef struct ecs_member_t {
223 const char *name;
224
226 ecs_entity_t type;
227
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
289 ecs_map_t constants;
290} EcsEnum;
291
293 typedef struct ecs_bitmask_constant_t {
295 const char *name;
296
298 ecs_flags64_t value;
299
301 int64_t _unused;
302
304 ecs_entity_t constant;
305} ecs_bitmask_constant_t;
306
308 typedef struct EcsBitmask {
309 /* Populated from child entities with Constant component */
310 ecs_map_t constants;
311} EcsBitmask;
312
314 typedef struct EcsArray {
315 ecs_entity_t type;
316 int32_t count;
317} EcsArray;
318
320 typedef struct EcsVector {
321 ecs_entity_t type;
322} EcsVector;
323
324
325/* Opaque type support */
326
327#if !defined(__cplusplus) || !defined(FLECS_CPP)
328
330 typedef struct ecs_serializer_t {
331 /* Serialize value */
332 int (*value)(
333 const struct ecs_serializer_t *ser,
334 ecs_entity_t type,
335 const void *value);
336
337 /* Serialize member */
338 int (*member)(
339 const struct ecs_serializer_t *ser,
340 const char *member);
341
342 const ecs_world_t *world;
343 void *ctx;
344} ecs_serializer_t;
345
346#elif defined(__cplusplus)
347
348} /* extern "C" { */
349
351typedef struct ecs_serializer_t {
352 /* Serialize value */
353 int (*value_)(
354 const struct ecs_serializer_t *ser,
355 ecs_entity_t type,
356 const void *value);
357
358 /* Serialize member */
359 int (*member_)(
360 const struct ecs_serializer_t *ser,
361 const char *name);
362
363 /* Serialize value */
364 int value(ecs_entity_t type, const void *value) const;
365
366 /* Serialize value */
367 template <typename T>
368 int value(const T& value) const;
369
370 /* Serialize member */
371 int member(const char *name) const;
372
373 const ecs_world_t *world;
374 void *ctx;
375} ecs_serializer_t;
376
377extern "C" {
378#endif
379
381 typedef int (*ecs_meta_serialize_t)(
382 const ecs_serializer_t *ser,
383 const void *src);
384
385
387 typedef int (*ecs_meta_serialize_member_t)(
388 const ecs_serializer_t *ser,
389 const void *src,
390 const char* name);
391
393 typedef int (*ecs_meta_serialize_element_t)(
394 const ecs_serializer_t *ser,
395 const void *src,
396 size_t elem);
397
402 typedef struct EcsOpaque {
403 ecs_entity_t as_type;
404 ecs_meta_serialize_t serialize;
405 ecs_meta_serialize_member_t serialize_member;
406 ecs_meta_serialize_element_t serialize_element;
407
408 /* Deserializer interface
409 * Only override the callbacks that are valid for the opaque type. If a
410 * deserializer attempts to assign a value type that is not supported by the
411 * interface, a conversion error is thrown.
412 */
413
415 void (*assign_bool)(
416 void *dst,
417 bool value);
418
420 void (*assign_char)(
421 void *dst,
422 char value);
423
425 void (*assign_int)(
426 void *dst,
427 int64_t value);
428
430 void (*assign_uint)(
431 void *dst,
432 uint64_t value);
433
435 void (*assign_float)(
436 void *dst,
437 double value);
438
440 void (*assign_string)(
441 void *dst,
442 const char *value);
443
445 void (*assign_entity)(
446 void *dst,
447 ecs_world_t *world,
448 ecs_entity_t entity);
449
451 void (*assign_id)(
452 void *dst,
453 ecs_world_t *world,
454 ecs_id_t id);
455
457 void (*assign_null)(
458 void *dst);
459
461 void (*clear)(
462 void *dst);
463
465 void* (*ensure_element)(
466 void *dst,
467 size_t elem);
468
470 void* (*ensure_member)(
471 void *dst,
472 const char *member);
473
475 size_t (*count)(
476 const void *dst);
477
479 void (*resize)(
480 void *dst,
481 size_t count);
482} EcsOpaque;
483
484
485/* Units */
486
494 typedef struct ecs_unit_translation_t {
495 int32_t factor;
496 int32_t power;
497} ecs_unit_translation_t;
498
500 typedef struct EcsUnit {
501 char *symbol;
502 ecs_entity_t prefix;
503 ecs_entity_t base;
504 ecs_entity_t over;
505 ecs_unit_translation_t translation;
506} EcsUnit;
507
509 typedef struct EcsUnitPrefix {
510 char *symbol;
511 ecs_unit_translation_t translation;
512} EcsUnitPrefix;
513
514
515/* Serializer utilities */
516
522 typedef enum ecs_meta_type_op_kind_t {
523 EcsOpArray,
524 EcsOpVector,
525 EcsOpOpaque,
526 EcsOpPush,
527 EcsOpPop,
528
529 EcsOpScope,
530
531 EcsOpEnum,
532 EcsOpBitmask,
533
534 EcsOpPrimitive,
535
536 EcsOpBool,
537 EcsOpChar,
538 EcsOpByte,
539 EcsOpU8,
540 EcsOpU16,
541 EcsOpU32,
542 EcsOpU64,
543 EcsOpI8,
544 EcsOpI16,
545 EcsOpI32,
546 EcsOpI64,
547 EcsOpF32,
548 EcsOpF64,
549 EcsOpUPtr,
550 EcsOpIPtr,
551 EcsOpString,
552 EcsOpEntity,
553 EcsOpId,
554 EcsMetaTypeOpKindLast = EcsOpId
555} ecs_meta_type_op_kind_t;
556
558 typedef struct ecs_meta_type_op_t {
559 ecs_meta_type_op_kind_t kind;
560 ecs_size_t offset;
561 int32_t count;
562 const char *name;
563 int32_t op_count;
564 ecs_size_t size;
565 ecs_entity_t type;
566 int32_t member_index;
567 ecs_hashmap_t *members;
568} ecs_meta_type_op_t;
569
573 typedef struct EcsTypeSerializer {
574 ecs_vec_t ops;
575} EcsTypeSerializer;
576
577
578/* Deserializer utilities */
579
583#define ECS_META_MAX_SCOPE_DEPTH (32)
584
586 typedef struct ecs_meta_scope_t {
587 ecs_entity_t type;
588 ecs_meta_type_op_t *ops;
589 int32_t op_count;
590 int32_t op_cur;
591 int32_t elem_cur;
592 int32_t prev_depth;
593 void *ptr;
594 const EcsComponent *comp;
595 const EcsOpaque *opaque;
596 ecs_vec_t *vector;
597 ecs_hashmap_t *members;
598 bool is_collection;
599 bool is_inline_array;
600 bool is_empty_scope;
601} ecs_meta_scope_t;
602
604 typedef struct ecs_meta_cursor_t {
605 const ecs_world_t *world;
606 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
607 int32_t depth;
608 bool valid;
609 bool is_primitive_scope;
610
612 ecs_entity_t (*lookup_action)(const ecs_world_t*, const char*, void*);
613 void *lookup_ctx;
614} ecs_meta_cursor_t;
615
630FLECS_API
631 ecs_meta_cursor_t ecs_meta_cursor(
632 const ecs_world_t *world,
633 ecs_entity_t type,
634 void *ptr);
635
641FLECS_API
642 void* ecs_meta_get_ptr(
643 ecs_meta_cursor_t *cursor);
644
650FLECS_API
651 int ecs_meta_next(
652 ecs_meta_cursor_t *cursor);
653
659FLECS_API
660 int ecs_meta_elem(
661 ecs_meta_cursor_t *cursor,
662 int32_t elem);
663
670FLECS_API
671 int ecs_meta_member(
672 ecs_meta_cursor_t *cursor,
673 const char *name);
674
682FLECS_API
683 int ecs_meta_dotmember(
684 ecs_meta_cursor_t *cursor,
685 const char *name);
686
692FLECS_API
693 int ecs_meta_push(
694 ecs_meta_cursor_t *cursor);
695
701FLECS_API
702 int ecs_meta_pop(
703 ecs_meta_cursor_t *cursor);
704
710FLECS_API
711 bool ecs_meta_is_collection(
712 const ecs_meta_cursor_t *cursor);
713
719FLECS_API
720 ecs_entity_t ecs_meta_get_type(
721 const ecs_meta_cursor_t *cursor);
722
728FLECS_API
729 ecs_entity_t ecs_meta_get_unit(
730 const ecs_meta_cursor_t *cursor);
731
737FLECS_API
738 const char* ecs_meta_get_member(
739 const ecs_meta_cursor_t *cursor);
740
746FLECS_API
747 ecs_entity_t ecs_meta_get_member_id(
748 const ecs_meta_cursor_t *cursor);
749
750/* The set functions assign the field with the specified value. If the value
751 * does not have the same type as the field, it will be cased to the field type.
752 * If no valid conversion is available, the operation will fail. */
753
760FLECS_API
761 int ecs_meta_set_bool(
762 ecs_meta_cursor_t *cursor,
763 bool value);
764
771FLECS_API
772 int ecs_meta_set_char(
773 ecs_meta_cursor_t *cursor,
774 char value);
775
782FLECS_API
783 int ecs_meta_set_int(
784 ecs_meta_cursor_t *cursor,
785 int64_t value);
786
793FLECS_API
794 int ecs_meta_set_uint(
795 ecs_meta_cursor_t *cursor,
796 uint64_t value);
797
804FLECS_API
805 int ecs_meta_set_float(
806 ecs_meta_cursor_t *cursor,
807 double value);
808
815FLECS_API
816 int ecs_meta_set_string(
817 ecs_meta_cursor_t *cursor,
818 const char *value);
819
826FLECS_API
827 int ecs_meta_set_string_literal(
828 ecs_meta_cursor_t *cursor,
829 const char *value);
830
837FLECS_API
838 int ecs_meta_set_entity(
839 ecs_meta_cursor_t *cursor,
840 ecs_entity_t value);
841
848FLECS_API
849 int ecs_meta_set_id(
850 ecs_meta_cursor_t *cursor,
851 ecs_id_t value);
852
858FLECS_API
859 int ecs_meta_set_null(
860 ecs_meta_cursor_t *cursor);
861
868FLECS_API
869 int ecs_meta_set_value(
870 ecs_meta_cursor_t *cursor,
871 const ecs_value_t *value);
872
873/* Functions for getting members. */
874
880FLECS_API
881 bool ecs_meta_get_bool(
882 const ecs_meta_cursor_t *cursor);
883
889FLECS_API
890 char ecs_meta_get_char(
891 const ecs_meta_cursor_t *cursor);
892
898FLECS_API
899int64_t ecs_meta_get_int(
900 const ecs_meta_cursor_t *cursor);
901
907FLECS_API
908uint64_t ecs_meta_get_uint(
909 const ecs_meta_cursor_t *cursor);
910
916FLECS_API
917 double ecs_meta_get_float(
918 const ecs_meta_cursor_t *cursor);
919
927FLECS_API
928 const char* ecs_meta_get_string(
929 const ecs_meta_cursor_t *cursor);
930
937FLECS_API
938 ecs_entity_t ecs_meta_get_entity(
939 const ecs_meta_cursor_t *cursor);
940
947 ecs_id_t ecs_meta_get_id(
948 const ecs_meta_cursor_t *cursor);
949
956FLECS_API
957 double ecs_meta_ptr_to_float(
958 ecs_primitive_kind_t type_kind,
959 const void *ptr);
960
961/* API functions for creating meta types */
962
964 typedef struct ecs_primitive_desc_t {
965 ecs_entity_t entity;
966 ecs_primitive_kind_t kind;
967} ecs_primitive_desc_t;
968
975FLECS_API
976 ecs_entity_t ecs_primitive_init(
977 ecs_world_t *world,
978 const ecs_primitive_desc_t *desc);
979
980
982 typedef struct ecs_enum_desc_t {
983 ecs_entity_t entity;
984 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
985 ecs_entity_t underlying_type;
986} ecs_enum_desc_t;
987
994FLECS_API
995 ecs_entity_t ecs_enum_init(
996 ecs_world_t *world,
997 const ecs_enum_desc_t *desc);
998
999
1001 typedef struct ecs_bitmask_desc_t {
1002 ecs_entity_t entity;
1003 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
1004} ecs_bitmask_desc_t;
1005
1012FLECS_API
1013 ecs_entity_t ecs_bitmask_init(
1014 ecs_world_t *world,
1015 const ecs_bitmask_desc_t *desc);
1016
1017
1019 typedef struct ecs_array_desc_t {
1020 ecs_entity_t entity;
1021 ecs_entity_t type;
1022 int32_t count;
1023} ecs_array_desc_t;
1024
1031FLECS_API
1032 ecs_entity_t ecs_array_init(
1033 ecs_world_t *world,
1034 const ecs_array_desc_t *desc);
1035
1036
1038 typedef struct ecs_vector_desc_t {
1039 ecs_entity_t entity;
1040 ecs_entity_t type;
1041} ecs_vector_desc_t;
1042
1049FLECS_API
1050 ecs_entity_t ecs_vector_init(
1051 ecs_world_t *world,
1052 const ecs_vector_desc_t *desc);
1053
1054
1056 typedef struct ecs_struct_desc_t {
1057 ecs_entity_t entity;
1058 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
1059} ecs_struct_desc_t;
1060
1067FLECS_API
1068 ecs_entity_t ecs_struct_init(
1069 ecs_world_t *world,
1070 const ecs_struct_desc_t *desc);
1071
1072
1074 typedef struct ecs_opaque_desc_t {
1075 ecs_entity_t entity;
1076 EcsOpaque type;
1077} ecs_opaque_desc_t;
1078
1101FLECS_API
1102 ecs_entity_t ecs_opaque_init(
1103 ecs_world_t *world,
1104 const ecs_opaque_desc_t *desc);
1105
1106
1108 typedef struct ecs_unit_desc_t {
1110 ecs_entity_t entity;
1111
1113 const char *symbol;
1114
1116 ecs_entity_t quantity;
1117
1119 ecs_entity_t base;
1120
1122 ecs_entity_t over;
1123
1125 ecs_unit_translation_t translation;
1126
1133 ecs_entity_t prefix;
1134} ecs_unit_desc_t;
1135
1142FLECS_API
1143 ecs_entity_t ecs_unit_init(
1144 ecs_world_t *world,
1145 const ecs_unit_desc_t *desc);
1146
1147
1149 typedef struct ecs_unit_prefix_desc_t {
1151 ecs_entity_t entity;
1152
1154 const char *symbol;
1155
1157 ecs_unit_translation_t translation;
1158} ecs_unit_prefix_desc_t;
1159
1166FLECS_API
1167 ecs_entity_t ecs_unit_prefix_init(
1168 ecs_world_t *world,
1169 const ecs_unit_prefix_desc_t *desc);
1170
1171
1178FLECS_API
1179 ecs_entity_t ecs_quantity_init(
1180 ecs_world_t *world,
1181 const ecs_entity_desc_t *desc);
1182
1183/* Convenience macros */
1184
1186#define ecs_primitive(world, ...)\
1187 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
1188
1190#define ecs_enum(world, ...)\
1191 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
1192
1194#define ecs_bitmask(world, ...)\
1195 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
1196
1198#define ecs_array(world, ...)\
1199 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
1200
1202#define ecs_vector(world, ...)\
1203 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
1204
1206#define ecs_opaque(world, ...)\
1207 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
1208
1210#define ecs_struct(world, ...)\
1211 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
1212
1214#define ecs_unit(world, ...)\
1215 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
1216
1218#define ecs_unit_prefix(world, ...)\
1219 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
1220
1222#define ecs_quantity(world, ...)\
1223 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
1224
1225
1234FLECS_API
1235 void FlecsMetaImport(
1236 ecs_world_t *world);
1237
1238#ifdef __cplusplus
1239}
1240#endif
1241
1242#include "meta_c.h"
1243
1244#endif
1245
1247
1248#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:97
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:387
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:102
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:106
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:100
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:393
ecs_i64_t
int64_t ecs_i64_t
Builtin i64 type.
Definition meta.h:108
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:112
ecs_u64_t
uint64_t ecs_u64_t
Builtin u64 type.
Definition meta.h:103
ecs_iptr_t
intptr_t ecs_iptr_t
Builtin iptr type.
Definition meta.h:109
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:104
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:110
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:171
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:522
ecs_f64_t
double ecs_f64_t
Builtin f64 type.
Definition meta.h:111
ecs_char_t
char ecs_char_t
Builtin char type.
Definition meta.h:98
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:152
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:101
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:381
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:583
ecs_i32_t
int32_t ecs_i32_t
Builtin i32 type.
Definition meta.h:107
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:105
ecs_byte_t
unsigned char ecs_byte_t
Builtin ecs_byte type.
Definition meta.h:99
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:81
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:534
EcsOpScope
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition meta.h:529
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:381
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:425
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:374
meta_c.h
Utility macros for populating reflection data in C.
EcsArray
Component added to array type entities.
Definition meta.h:314
EcsArray::count
int32_t count
Number of elements.
Definition meta.h:316
EcsArray::type
ecs_entity_t type
Element type.
Definition meta.h:315
EcsBitmask
Component added to bitmask type entities.
Definition meta.h:308
EcsBitmask::constants
ecs_map_t constants
map<u32_t, ecs_bitmask_constant_t>
Definition meta.h:310
EcsComponent
Component information.
Definition flecs.h:1523
EcsEnum
Component added to enum type entities.
Definition meta.h:285
EcsEnum::constants
ecs_map_t constants
Populated from child entities with Constant component.
Definition meta.h:289
EcsMemberRanges
Component added to member entities to express valid value ranges.
Definition meta.h:214
EcsMemberRanges::warning
ecs_member_value_range_t warning
Member value warning range.
Definition meta.h:216
EcsMemberRanges::value
ecs_member_value_range_t value
Member value range.
Definition meta.h:215
EcsMemberRanges::error
ecs_member_value_range_t error
Member value error range.
Definition meta.h:217
EcsMember
Component added to member entities.
Definition meta.h:199
EcsMember::unit
ecs_entity_t unit
Member unit.
Definition meta.h:202
EcsMember::use_offset
bool use_offset
If offset should be explicitly used.
Definition meta.h:204
EcsMember::type
ecs_entity_t type
Member type.
Definition meta.h:200
EcsMember::offset
int32_t offset
Member offset.
Definition meta.h:203
EcsMember::count
int32_t count
Number of elements (for inline arrays).
Definition meta.h:201
EcsOpaque
Opaque type reflection data.
Definition meta.h:402
EcsOpaque::count
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:475
EcsOpaque::assign_null
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:457
EcsOpaque::serialize_member
ecs_meta_serialize_member_t serialize_member
Serialize member action.
Definition meta.h:405
EcsOpaque::clear
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:461
EcsOpaque::assign_uint
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:430
EcsOpaque::serialize
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:404
EcsOpaque::assign_char
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:420
EcsOpaque::as_type
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:403
EcsOpaque::assign_bool
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:415
EcsOpaque::assign_string
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:440
EcsOpaque::resize
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:479
EcsOpaque::assign_int
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:425
EcsOpaque::assign_float
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:435
EcsOpaque::assign_entity
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:445
EcsOpaque::assign_id
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) id value.
Definition meta.h:451
EcsOpaque::serialize_element
ecs_meta_serialize_element_t serialize_element
Serialize element action.
Definition meta.h:406
EcsPrimitive
Component added to primitive types.
Definition meta.h:194
EcsPrimitive::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:195
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:573
EcsTypeSerializer::ops
ecs_vec_t ops
vector<ecs_meta_type_op_t>
Definition meta.h:574
EcsType
Component that is automatically added to every type with the right kind.
Definition meta.h:164
EcsType::existing
bool existing
Did the type exist or is it populated from reflection.
Definition meta.h:166
EcsType::partial
bool partial
Is the reflection data a partial type description.
Definition meta.h:167
EcsType::kind
ecs_type_kind_t kind
Type kind.
Definition meta.h:165
EcsUnitPrefix
Component that stores unit prefix data.
Definition meta.h:509
EcsUnitPrefix::translation
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:511
EcsUnitPrefix::symbol
char * symbol
Symbol of prefix (e.g.
Definition meta.h:510
EcsUnit
Component that stores unit data.
Definition meta.h:500
EcsUnit::translation
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:505
EcsUnit::prefix
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:502
EcsUnit::symbol
char * symbol
Unit symbol.
Definition meta.h:501
EcsUnit::base
ecs_entity_t base
Base unit (e.g.
Definition meta.h:503
EcsUnit::over
ecs_entity_t over
Over unit (e.g.
Definition meta.h:504
EcsVector
Component added to vector type entities.
Definition meta.h:320
EcsVector::type
ecs_entity_t type
Element type.
Definition meta.h:321
ecs_array_desc_t
Used with ecs_array_init().
Definition meta.h:1019
ecs_array_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1020
ecs_array_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1021
ecs_array_desc_t::count
int32_t count
Number of elements.
Definition meta.h:1022
ecs_bitmask_constant_t
Type that describes an bitmask constant.
Definition meta.h:293
ecs_bitmask_constant_t::value
ecs_flags64_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:298
ecs_bitmask_constant_t::_unused
int64_t _unused
Keep layout the same with ecs_enum_constant_t.
Definition meta.h:301
ecs_bitmask_constant_t::constant
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:304
ecs_bitmask_constant_t::name
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:295
ecs_bitmask_desc_t
Used with ecs_bitmask_init().
Definition meta.h:1001
ecs_bitmask_desc_t::constants
ecs_bitmask_constant_t constants[(32)]
Bitmask constants.
Definition meta.h:1003
ecs_bitmask_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1002
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1012
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:982
ecs_enum_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:983
ecs_enum_desc_t::constants
ecs_enum_constant_t constants[(32)]
Enum constants.
Definition meta.h:984
ecs_member_t
Element type of members vector in EcsStruct.
Definition meta.h:221
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:223
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:226
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:208
ecs_member_value_range_t::min
double min
Min member value.
Definition meta.h:209
ecs_member_value_range_t::max
double max
Max member value.
Definition meta.h:210
ecs_meta_cursor_t
Type that enables iterating/populating a value using reflection data.
Definition meta.h:604
ecs_meta_cursor_t::scope
ecs_meta_scope_t scope[(32)]
Cursor scope stack.
Definition meta.h:606
ecs_meta_cursor_t::valid
bool valid
Does the cursor point to a valid field.
Definition meta.h:608
ecs_meta_cursor_t::world
const ecs_world_t * world
The world.
Definition meta.h:605
ecs_meta_cursor_t::lookup_ctx
void * lookup_ctx
Context for lookup_action.
Definition meta.h:613
ecs_meta_cursor_t::depth
int32_t depth
Current scope depth.
Definition meta.h:607
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:609
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:612
ecs_meta_scope_t
Type with information about currently serialized scope.
Definition meta.h:586
ecs_meta_scope_t::opaque
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:595
ecs_meta_scope_t::prev_depth
int32_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:592
ecs_meta_scope_t::comp
const EcsComponent * comp
Pointer to component, in case size/alignment is needed.
Definition meta.h:594
ecs_meta_scope_t::ptr
void * ptr
Pointer to the value being iterated.
Definition meta.h:593
ecs_meta_scope_t::is_empty_scope
bool is_empty_scope
Was scope populated (for collections)
Definition meta.h:600
ecs_meta_scope_t::vector
ecs_vec_t * vector
Current vector, in case a vector is iterated.
Definition meta.h:596
ecs_meta_scope_t::elem_cur
int32_t elem_cur
Current element (for collections)
Definition meta.h:591
ecs_meta_scope_t::op_cur
int32_t op_cur
Current operation.
Definition meta.h:590
ecs_meta_scope_t::is_inline_array
bool is_inline_array
Is the scope iterating an inline array?
Definition meta.h:599
ecs_meta_scope_t::members
ecs_hashmap_t * members
string -> member index
Definition meta.h:597
ecs_meta_scope_t::ops
ecs_meta_type_op_t * ops
The type operations (see ecs_meta_type_op_t)
Definition meta.h:588
ecs_meta_scope_t::op_count
int32_t op_count
Number of operations in ops array to process.
Definition meta.h:589
ecs_meta_scope_t::type
ecs_entity_t type
The type being iterated.
Definition meta.h:587
ecs_meta_scope_t::is_collection
bool is_collection
Is the scope iterating elements?
Definition meta.h:598
ecs_meta_type_op_t
Meta type serializer instruction data.
Definition meta.h:558
ecs_meta_type_op_t::kind
ecs_meta_type_op_kind_t kind
Instruction opcode.
Definition meta.h:559
ecs_meta_type_op_t::type
ecs_entity_t type
Type entity.
Definition meta.h:565
ecs_meta_type_op_t::count
int32_t count
Number of elements (for inline arrays).
Definition meta.h:561
ecs_meta_type_op_t::size
ecs_size_t size
Size of type of operation.
Definition meta.h:564
ecs_meta_type_op_t::offset
ecs_size_t offset
Offset of current field.
Definition meta.h:560
ecs_meta_type_op_t::name
const char * name
Name of value (only used for struct members)
Definition meta.h:562
ecs_meta_type_op_t::member_index
int32_t member_index
Index of member in struct.
Definition meta.h:566
ecs_meta_type_op_t::members
ecs_hashmap_t * members
string -> member index (structs only)
Definition meta.h:567
ecs_meta_type_op_t::op_count
int32_t op_count
Number of operations until next field or end.
Definition meta.h:563
ecs_opaque_desc_t
Used with ecs_opaque_init().
Definition meta.h:1074
ecs_opaque_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1075
ecs_opaque_desc_t::type
EcsOpaque type
Type that the opaque type maps to.
Definition meta.h:1076
ecs_primitive_desc_t
Used with ecs_primitive_init().
Definition meta.h:964
ecs_primitive_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:965
ecs_primitive_desc_t::kind
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:966
ecs_serializer_t
Serializer interface.
Definition meta.h:330
ecs_serializer_t::ctx
void * ctx
Serializer context.
Definition meta.h:343
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:332
ecs_serializer_t::member
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Member name.
Definition meta.h:338
ecs_serializer_t::world
const ecs_world_t * world
The world.
Definition meta.h:342
ecs_struct_desc_t
Used with ecs_struct_init().
Definition meta.h:1056
ecs_struct_desc_t::members
ecs_member_t members[(32)]
Struct members.
Definition meta.h:1058
ecs_struct_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1057
ecs_unit_desc_t
Used with ecs_unit_init().
Definition meta.h:1108
ecs_unit_desc_t::base
ecs_entity_t base
Base unit, e.g.
Definition meta.h:1119
ecs_unit_desc_t::over
ecs_entity_t over
Over unit, e.g.
Definition meta.h:1122
ecs_unit_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1113
ecs_unit_desc_t::prefix
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:1133
ecs_unit_desc_t::quantity
ecs_entity_t quantity
Unit quantity, e.g.
Definition meta.h:1116
ecs_unit_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1125
ecs_unit_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit (optional).
Definition meta.h:1110
ecs_unit_prefix_desc_t
Used with ecs_unit_prefix_init().
Definition meta.h:1149
ecs_unit_prefix_desc_t::entity
ecs_entity_t entity
Existing entity to associate with unit prefix (optional).
Definition meta.h:1151
ecs_unit_prefix_desc_t::symbol
const char * symbol
Unit symbol, e.g.
Definition meta.h:1154
ecs_unit_prefix_desc_t::translation
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1157
ecs_unit_translation_t
Helper type to describe translation between two units.
Definition meta.h:494
ecs_unit_translation_t::power
int32_t power
Power to apply to factor (e.g.
Definition meta.h:496
ecs_unit_translation_t::factor
int32_t factor
Factor to apply (e.g.
Definition meta.h:495
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1003
ecs_vector_desc_t
Used with ecs_vector_init().
Definition meta.h:1038
ecs_vector_desc_t::entity
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1039
ecs_vector_desc_t::type
ecs_entity_t type
Element type.
Definition meta.h:1040