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
57#ifdef FLECS_META
58
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
95typedef bool ecs_bool_t;
96typedef char ecs_char_t;
97typedef unsigned char ecs_byte_t;
98typedef uint8_t ecs_u8_t;
99typedef uint16_t ecs_u16_t;
100typedef uint32_t ecs_u32_t;
101typedef uint64_t ecs_u64_t;
102typedef uintptr_t ecs_uptr_t;
103typedef int8_t ecs_i8_t;
104typedef int16_t ecs_i16_t;
105typedef int32_t ecs_i32_t;
106typedef int64_t ecs_i64_t;
107typedef intptr_t ecs_iptr_t;
108typedef float ecs_f32_t;
109typedef double ecs_f64_t;
110typedef char* ecs_string_t;
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(EcsMap);
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;
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);
150FLECS_API extern const ecs_entity_t ecs_id(ecs_value_t);
153typedef enum ecs_type_kind_t {
154 EcsPrimitiveType,
155 EcsBitmaskType,
156 EcsEnumType,
157 EcsStructType,
158 EcsArrayType,
159 EcsVectorType,
160 EcsOpaqueType,
161 EcsMapType,
162 EcsValueType,
163 EcsTypeKindLast = EcsValueType
165
172
175 EcsBool = 1,
176 EcsChar,
177 EcsByte,
178 EcsU8,
179 EcsU16,
180 EcsU32,
181 EcsU64,
182 EcsI8,
183 EcsI16,
184 EcsI32,
185 EcsI64,
186 EcsF32,
187 EcsF64,
188 EcsUPtr,
189 EcsIPtr,
190 EcsString,
191 EcsEntity,
192 EcsId,
193 EcsPrimitiveKindLast = EcsId
195
200
209
215
222
266
268typedef struct EcsStruct {
270 ecs_vec_t members; /* vector<ecs_member_t> */
272
274typedef struct ecs_enum_constant_t {
276 const char *name;
277
279 int64_t value;
280
283
287
292
296 const char *name;
297
299 ecs_flags64_t value;
300
302 int64_t _unused;
303
307
309typedef struct EcsBitmask {
310 int32_t dummy_;
312
314typedef struct EcsConstants {
316 ecs_map_t *constants;
321
327
332
338
339
340/* Opaque type support */
341
342#if !defined(__cplusplus) || !defined(FLECS_CPP)
343
345typedef struct ecs_serializer_t {
347 int (*value)(
348 const struct ecs_serializer_t *ser,
349 ecs_entity_t type,
350 const void *value);
353 int (*member)(
354 const struct ecs_serializer_t *ser,
355 const char *member);
358 void *ctx;
360
361#elif defined(__cplusplus)
362
363} /* extern "C" { */
364
366typedef struct ecs_serializer_t {
367 /* Serialize value */
368 int (*value_)(
369 const struct ecs_serializer_t *ser,
370 ecs_entity_t type,
371 const void *value);
372
373 /* Serialize member */
374 int (*member_)(
375 const struct ecs_serializer_t *ser,
376 const char *name);
377
378 /* Serialize value */
379 int value(ecs_entity_t type, const void *value) const;
380
381 /* Serialize value */
382 template <typename T>
383 int value(const T& value) const;
384
385 /* Serialize member */
386 int member(const char *name) const;
387
388 const ecs_world_t *world;
389 void *ctx;
391
392extern "C" {
393#endif
394
396typedef int (*ecs_meta_serialize_t)(
397 const ecs_serializer_t *ser,
398 const void *src);
403 const ecs_serializer_t *ser,
404 const void *src,
405 const char* name);
409 const ecs_serializer_t *ser,
410 const void *src,
411 size_t elem);
418typedef struct EcsOpaque {
424 /* Deserializer interface
425 * Only override the callbacks that are valid for the opaque type. If a
426 * deserializer attempts to assign a value type that is not supported by the
427 * interface, a conversion error is thrown.
428 */
429
431 void (*assign_bool)(
432 void *dst,
433 bool value);
434
436 void (*assign_char)(
437 void *dst,
438 char value);
439
441 void (*assign_int)(
442 void *dst,
443 int64_t value);
444
446 void (*assign_uint)(
447 void *dst,
448 uint64_t value);
449
452 void *dst,
453 double value);
454
457 void *dst,
458 const char *value);
459
462 void *dst,
463 ecs_world_t *world,
464 ecs_entity_t entity);
465
467 void (*assign_id)(
468 void *dst,
469 ecs_world_t *world,
470 ecs_id_t id);
471
473 void (*assign_null)(
474 void *dst);
475
477 void (*clear)(
478 void *dst);
479
481 void* (*ensure_element)(
482 void *dst,
483 size_t elem);
484
486 void* (*ensure_member)(
487 void *dst,
488 const char *member);
489
491 size_t (*count)(
492 const void *dst);
493
495 void (*resize)(
496 void *dst,
497 size_t count);
499
500
501/* Units */
502
514
523
529
530
531/* Serializer utilities */
532
538typedef enum ecs_meta_op_kind_t {
554 EcsOpEnum,
555 EcsOpBitmask,
556
559 EcsOpBool,
560 EcsOpChar,
561 EcsOpByte,
562 EcsOpU8,
563 EcsOpU16,
564 EcsOpU32,
565 EcsOpU64,
566 EcsOpI8,
567 EcsOpI16,
568 EcsOpI32,
569 EcsOpI64,
570 EcsOpF32,
571 EcsOpF64,
572 EcsOpUPtr,
573 EcsOpIPtr,
574 EcsOpString,
575 EcsOpEntity,
576 EcsOpId,
577 EcsMetaTypeOpKindLast = EcsOpId
579
597
604
605
606/* Deserializer utilities */
607
611#define ECS_META_MAX_SCOPE_DEPTH (32)
612
630
643
650FLECS_API
652 ecs_world_t *world,
653 ecs_entity_t type);
654
669FLECS_API
671 const ecs_world_t *world,
672 ecs_entity_t type,
673 void *ptr);
674
680FLECS_API
682 ecs_meta_cursor_t *cursor);
683
689FLECS_API
691 ecs_meta_cursor_t *cursor);
692
698FLECS_API
700 ecs_meta_cursor_t *cursor,
701 int32_t elem);
702
709FLECS_API
711 ecs_meta_cursor_t *cursor,
712 const char *name);
713
720FLECS_API
722 ecs_meta_cursor_t *cursor,
723 const ecs_value_t *key);
724
732FLECS_API
734 ecs_meta_cursor_t *cursor,
735 const char *name);
736
745FLECS_API
747 ecs_meta_cursor_t *cursor,
748 const char *name);
749
757FLECS_API
759 ecs_meta_cursor_t *cursor,
760 const char *name);
761
767FLECS_API
769 ecs_meta_cursor_t *cursor);
770
776FLECS_API
778 ecs_meta_cursor_t *cursor);
779
785FLECS_API
787 const ecs_meta_cursor_t *cursor);
788
797FLECS_API
799 const ecs_meta_cursor_t *cursor);
800
806FLECS_API
808 const ecs_meta_cursor_t *cursor);
809
815FLECS_API
817 const ecs_meta_cursor_t *cursor);
818
824FLECS_API
826 const ecs_meta_cursor_t *cursor);
827
833FLECS_API
835 const ecs_meta_cursor_t *cursor);
836
837/* The set functions assign the field with the specified value. If the value
838 * does not have the same type as the field, it will be cast to the field type.
839 * If no valid conversion is available, the operation will fail. */
840
847FLECS_API
849 ecs_meta_cursor_t *cursor,
850 bool value);
851
858FLECS_API
860 ecs_meta_cursor_t *cursor,
861 char value);
862
869FLECS_API
871 ecs_meta_cursor_t *cursor,
872 int64_t value);
873
880FLECS_API
882 ecs_meta_cursor_t *cursor,
883 uint64_t value);
884
891FLECS_API
893 ecs_meta_cursor_t *cursor,
894 double value);
895
902FLECS_API
904 ecs_meta_cursor_t *cursor,
905 const char *value);
906
913FLECS_API
915 ecs_meta_cursor_t *cursor,
916 const char *value);
917
924FLECS_API
926 ecs_meta_cursor_t *cursor,
927 ecs_entity_t value);
928
935FLECS_API
937 ecs_meta_cursor_t *cursor,
938 ecs_id_t value);
939
945FLECS_API
947 ecs_meta_cursor_t *cursor);
948
957FLECS_API
959 ecs_meta_cursor_t *cursor,
960 const ecs_value_t *value);
961
962/* Functions for getting members. */
963
969FLECS_API
971 const ecs_meta_cursor_t *cursor);
972
978FLECS_API
980 const ecs_meta_cursor_t *cursor);
981
987FLECS_API
989 const ecs_meta_cursor_t *cursor);
990
996FLECS_API
998 const ecs_meta_cursor_t *cursor);
999
1005FLECS_API
1007 const ecs_meta_cursor_t *cursor);
1008
1016FLECS_API
1018 const ecs_meta_cursor_t *cursor);
1019
1026FLECS_API
1028 const ecs_meta_cursor_t *cursor);
1029
1036FLECS_API
1038 const ecs_meta_cursor_t *cursor);
1039
1046FLECS_API
1048 ecs_primitive_kind_t type_kind,
1049 const void *ptr);
1050
1060FLECS_API
1062 const ecs_meta_op_t *op,
1063 const void *ptr);
1064
1065/* Utility functions for working with pointers to dynamically created
1066 * values. */
1067
1075FLECS_API
1077 const ecs_world_t *world,
1078 ecs_entity_t type,
1079 void *ptr);
1080
1088FLECS_API
1090 const ecs_world_t *world,
1091 const ecs_type_info_t *ti,
1092 void *ptr);
1093
1100FLECS_API
1102 ecs_world_t *world,
1103 ecs_entity_t type);
1104
1112 ecs_world_t *world,
1113 const ecs_type_info_t *ti);
1114
1123 const ecs_world_t *world,
1124 const ecs_type_info_t *ti,
1125 void *ptr);
1126
1134FLECS_API
1136 const ecs_world_t *world,
1137 ecs_entity_t type,
1138 void* ptr);
1139
1147FLECS_API
1149 ecs_world_t *world,
1150 const ecs_type_info_t *ti,
1151 void* ptr);
1152
1160FLECS_API
1162 ecs_world_t *world,
1163 ecs_entity_t type,
1164 void* ptr);
1165
1174FLECS_API
1176 const ecs_world_t *world,
1177 const ecs_type_info_t *ti,
1178 void* dst,
1179 const void *src);
1180
1189FLECS_API
1191 const ecs_world_t *world,
1192 ecs_entity_t type,
1193 void* dst,
1194 const void *src);
1195
1204FLECS_API
1206 const ecs_world_t *world,
1207 const ecs_type_info_t *ti,
1208 void* dst,
1209 void *src);
1210
1219FLECS_API
1221 const ecs_world_t *world,
1222 ecs_entity_t type,
1223 void* dst,
1224 void *src);
1225
1234FLECS_API
1236 const ecs_world_t *world,
1237 const ecs_type_info_t *ti,
1238 void* dst,
1239 void *src);
1240
1249FLECS_API
1251 const ecs_world_t *world,
1252 ecs_entity_t type,
1253 void* dst,
1254 void *src);
1255
1256
1257/* Value utilities. A value is a value that holds a value of a dynamic
1258 * type. Values own the value they point to, and will invoke the correct
1259 * type hooks when a value is assigned, copied, moved or destructed. A value
1260 * must always hold a valid type and value. */
1261
1273FLECS_API
1275 const ecs_world_t *world,
1276 ecs_value_t *v,
1277 ecs_entity_t type,
1278 const void *ptr);
1279
1286FLECS_API
1288 const ecs_world_t *world,
1289 ecs_entity_t type);
1290
1298FLECS_API
1300 const ecs_world_t *world,
1301 ecs_entity_t type,
1302 const void *ptr);
1303
1310FLECS_API
1312 const ecs_world_t *world,
1313 ecs_value_t *v);
1314
1322FLECS_API
1324 const ecs_world_t *world,
1325 ecs_value_t *dst,
1326 const ecs_value_t *src);
1327
1335FLECS_API
1337 const ecs_world_t *world,
1338 ecs_value_t *dst,
1339 const ecs_value_t *src);
1340
1349FLECS_API
1351 const ecs_world_t *world,
1352 ecs_value_t *dst,
1353 ecs_value_t *src);
1354
1362FLECS_API
1364 const ecs_world_t *world,
1365 ecs_value_t *dst,
1366 ecs_value_t *src);
1367
1375FLECS_API
1377 const ecs_world_t *world,
1378 const ecs_value_t *a,
1379 const ecs_value_t *b);
1380
1388FLECS_API
1390 const ecs_world_t *world,
1391 const ecs_value_t *a,
1392 const ecs_value_t *b);
1393
1407FLECS_API
1409 ecs_world_t *world,
1410 ecs_entity_t type);
1411
1425FLECS_API
1427 ecs_world_t *world,
1428 ecs_entity_t type);
1429
1430/* API functions for creating meta types */
1431
1437
1444FLECS_API
1446 ecs_world_t *world,
1447 const ecs_primitive_desc_t *desc);
1448
1449
1456
1463FLECS_API
1465 ecs_world_t *world,
1466 const ecs_enum_desc_t *desc);
1467
1468
1474
1481FLECS_API
1483 ecs_world_t *world,
1484 const ecs_bitmask_desc_t *desc);
1485
1486
1493
1500FLECS_API
1502 ecs_world_t *world,
1503 const ecs_array_desc_t *desc);
1504
1505
1511
1518FLECS_API
1520 ecs_world_t *world,
1521 const ecs_vector_desc_t *desc);
1522
1523
1530
1537FLECS_API
1539 ecs_world_t *world,
1540 const ecs_map_desc_t *desc);
1541
1542
1549
1556FLECS_API
1558 ecs_world_t *world,
1559 const ecs_struct_desc_t *desc);
1560
1569FLECS_API
1571 ecs_world_t *world,
1572 ecs_entity_t type,
1573 const ecs_member_t *member);
1574
1582FLECS_API
1584 ecs_world_t *world,
1585 ecs_entity_t type,
1586 const char *name);
1587
1595FLECS_API
1597 ecs_world_t *world,
1598 ecs_entity_t type,
1599 int32_t i);
1600
1606
1629FLECS_API
1631 ecs_world_t *world,
1632 const ecs_opaque_desc_t *desc);
1633
1634
1663
1670FLECS_API
1672 ecs_world_t *world,
1673 const ecs_unit_desc_t *desc);
1674
1675
1687
1694FLECS_API
1696 ecs_world_t *world,
1697 const ecs_unit_prefix_desc_t *desc);
1698
1699
1706FLECS_API
1708 ecs_world_t *world,
1709 const ecs_entity_desc_t *desc);
1710
1711/* Convenience macros */
1712
1714#define ecs_primitive(world, ...)\
1715 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
1716
1718#define ecs_enum(world, ...)\
1719 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
1720
1722#define ecs_bitmask(world, ...)\
1723 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
1724
1726#define ecs_array(world, ...)\
1727 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
1728
1730#define ecs_vector(world, ...)\
1731 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
1732
1734#define ecs_map_type(world, ...)\
1735 ecs_map_type_init(world, &(ecs_map_desc_t) __VA_ARGS__ )
1736
1738#define ecs_opaque(world, ...)\
1739 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
1740
1742#define ecs_struct(world, ...)\
1743 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
1744
1746#define ecs_unit(world, ...)\
1747 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
1748
1750#define ecs_unit_prefix(world, ...)\
1751 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
1752
1754#define ecs_quantity(world, ...)\
1755 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
1756
1757
1766FLECS_API
1768 ecs_world_t *world);
1769
1770#ifdef __cplusplus
1771}
1772#endif
1773
1774#include "meta_c.h"
1775
1776#endif
1777
1780#endif
FLECS_API int ecs_meta_set_int(ecs_meta_cursor_t *cursor, int64_t value)
Set field with int value.
FLECS_API int ecs_meta_next(ecs_meta_cursor_t *cursor)
Move cursor to next field.
FLECS_API int ecs_meta_set_uint(ecs_meta_cursor_t *cursor, uint64_t value)
Set field with uint value.
struct EcsMember EcsMember
Component added to member entities.
int ecs_ptr_fini_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Destruct a value.
FLECS_API int ecs_ptr_move_ctor_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move-construct a value.
FLECS_API bool ecs_meta_get_bool(const ecs_meta_cursor_t *cursor)
Get field value as boolean.
struct EcsPrimitive EcsPrimitive
Component added to primitive types.
FLECS_API int ecs_ptr_free(ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value and free storage.
bool ecs_bool_t
Primitive type definitions.
Definition meta.h:95
struct ecs_vector_desc_t ecs_vector_desc_t
Used with ecs_vector_init().
FLECS_API ecs_value_t ecs_value_new(const ecs_world_t *world, ecs_entity_t type)
Create new value with default constructed value of specified type.
FLECS_API const ecs_entity_t ecs_id(EcsType)
ID for component added to all types with reflection data.
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:402
FLECS_API ecs_entity_t ecs_bitmask_init(ecs_world_t *world, const ecs_bitmask_desc_t *desc)
Create a new bitmask type.
struct EcsEnum EcsEnum
Component added to enum type entities.
uint32_t ecs_u32_t
Built-in u32 type.
Definition meta.h:100
FLECS_API void ecs_value_copy_ctor(const ecs_world_t *world, ecs_value_t *dst, const ecs_value_t *src)
Copy construct value.
FLECS_API double ecs_meta_ptr_to_float(ecs_primitive_kind_t type_kind, const void *ptr)
Convert pointer of primitive kind to float.
FLECS_API int ecs_set_rtt_equals(ecs_world_t *world, ecs_entity_t type)
Generate a runtime equals hook for a type.
struct ecs_bitmask_constant_t ecs_bitmask_constant_t
Type that describes a bitmask constant.
int16_t ecs_i16_t
Built-in i16 type.
Definition meta.h:104
struct ecs_meta_cursor_t ecs_meta_cursor_t
Type that enables iterating and populating a value using reflection data.
ecs_meta_op_kind_t
Serializer instruction opcodes.
Definition meta.h:538
FLECS_API int ecs_meta_set_string_literal(ecs_meta_cursor_t *cursor, const char *value)
Set field with string literal value (has enclosing "").
FLECS_API ecs_entity_t ecs_opaque_init(ecs_world_t *world, const ecs_opaque_desc_t *desc)
Create a new opaque type.
FLECS_API int ecs_meta_set_float(ecs_meta_cursor_t *cursor, double value)
Set field with float value.
struct ecs_enum_desc_t ecs_enum_desc_t
Used with ecs_enum_init().
FLECS_API int ecs_meta_dotmember(ecs_meta_cursor_t *cursor, const char *name)
Move cursor to member.
struct EcsStruct EcsStruct
Component added to struct type entities.
FLECS_API ecs_entity_t ecs_meta_get_entity(const ecs_meta_cursor_t *cursor)
Get field value as entity.
FLECS_API int ecs_meta_key(ecs_meta_cursor_t *cursor, const ecs_value_t *key)
Move cursor to key (for map scopes).
FLECS_API int ecs_ptr_move_ctor(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move-construct a value.
uint8_t ecs_u8_t
Built-in u8 type.
Definition meta.h:98
struct ecs_member_t ecs_member_t
Element type of members vector in EcsStruct.
FLECS_API int ecs_ptr_move(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move a value.
int(* ecs_meta_serialize_element_t)(const ecs_serializer_t *ser, const void *src, size_t elem)
Callback invoked to serialize an opaque vector or array element.
Definition meta.h:408
struct EcsVector EcsVector
Component added to vector type entities.
int64_t ecs_i64_t
Built-in i64 type.
Definition meta.h:106
FLECS_API char * ecs_meta_serializer_to_str(ecs_world_t *world, ecs_entity_t type)
Convert serializer to string.
FLECS_API bool ecs_meta_is_collection(const ecs_meta_cursor_t *cursor)
Is the current scope a collection?
FLECS_API void ecs_value_set(const ecs_world_t *world, ecs_value_t *v, ecs_entity_t type, const void *ptr)
Assign value of specified type to value.
FLECS_API int ecs_struct_add_member(ecs_world_t *world, ecs_entity_t type, const ecs_member_t *member)
Add member to struct.
struct ecs_serializer_t ecs_serializer_t
Serializer interface.
FLECS_API ecs_entity_t ecs_map_type_init(ecs_world_t *world, const ecs_map_desc_t *desc)
Create a new map type.
FLECS_API int ecs_ptr_free_w_type_info(ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Destruct a value and free storage.
char * ecs_string_t
Built-in string type.
Definition meta.h:110
struct EcsBitmask EcsBitmask
Component added to bitmask type entities.
struct ecs_member_value_range_t ecs_member_value_range_t
Type expressing a range for a member value.
uint64_t ecs_u64_t
Built-in u64 type.
Definition meta.h:101
intptr_t ecs_iptr_t
Built-in iptr type.
Definition meta.h:107
struct EcsOpaque EcsOpaque
Opaque type reflection data.
FLECS_API void ecs_value_move_ctor(const ecs_world_t *world, ecs_value_t *dst, ecs_value_t *src)
Move construct value.
FLECS_API ecs_entity_t ecs_quantity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Create a new quantity.
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 or map operations.
FLECS_API int ecs_meta_set_id(ecs_meta_cursor_t *cursor, ecs_id_t value)
Set field with (component) ID value.
FLECS_API void ecs_value_copy(const ecs_world_t *world, ecs_value_t *dst, const ecs_value_t *src)
Copy value.
uintptr_t ecs_uptr_t
Built-in uptr type.
Definition meta.h:102
FLECS_API ecs_meta_cursor_t ecs_meta_cursor(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Create meta cursor.
FLECS_API ecs_entity_t ecs_meta_get_unit(const ecs_meta_cursor_t *cursor)
Get unit of current field.
FLECS_API const ecs_entity_t EcsQuantity
Tag added to unit quantities.
float ecs_f32_t
Built-in f32 type.
Definition meta.h:108
FLECS_API void FlecsMetaImport(ecs_world_t *world)
Meta module import function.
ecs_primitive_kind_t
Primitive type kinds supported by meta addon.
Definition meta.h:174
struct ecs_map_desc_t ecs_map_desc_t
Used with ecs_map_type_init().
FLECS_API ecs_entity_t ecs_meta_get_member_id(const ecs_meta_cursor_t *cursor)
Get member entity of current field.
FLECS_API const char * ecs_meta_get_string(const ecs_meta_cursor_t *cursor)
Get field value as string.
FLECS_API const char * ecs_meta_get_member(const ecs_meta_cursor_t *cursor)
Get member name of current field.
struct EcsArray EcsArray
Component added to array type entities.
FLECS_API ecs_value_t ecs_value_init(const ecs_world_t *world, ecs_entity_t type, const void *ptr)
Create new value initialized with the provided value.
FLECS_API ecs_member_t * ecs_struct_get_member(ecs_world_t *world, ecs_entity_t type, const char *name)
Get member by name from struct.
struct ecs_array_desc_t ecs_array_desc_t
Used with ecs_array_init().
FLECS_API int ecs_ptr_init(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Construct a value in existing storage.
FLECS_API int ecs_ptr_fini(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value.
FLECS_API ecs_member_t * ecs_struct_get_nth_member(ecs_world_t *world, ecs_entity_t type, int32_t i)
Get member by index from struct.
FLECS_API double ecs_meta_get_float(const ecs_meta_cursor_t *cursor)
Get field value as float.
FLECS_API int ecs_meta_pop(ecs_meta_cursor_t *cursor)
Pop a struct or collection scope (must follow a push).
FLECS_API ecs_entity_t ecs_meta_get_type(const ecs_meta_cursor_t *cursor)
Get type of current field.
FLECS_API uint64_t ecs_meta_get_uint(const ecs_meta_cursor_t *cursor)
Get field value as unsigned integer.
FLECS_API ecs_entity_t ecs_vector_init(ecs_world_t *world, const ecs_vector_desc_t *desc)
Create a new vector type.
FLECS_API char ecs_meta_get_char(const ecs_meta_cursor_t *cursor)
Get field value as char.
double ecs_f64_t
Built-in f64 type.
Definition meta.h:109
char ecs_char_t
Built-in char type.
Definition meta.h:96
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.
FLECS_API void * ecs_ptr_new(ecs_world_t *world, ecs_entity_t type)
Construct a value in new storage.
struct ecs_opaque_desc_t ecs_opaque_desc_t
Used with ecs_opaque_init().
struct EcsConstants EcsConstants
Component with data structures for looking up enum or bitmask constants.
FLECS_API int ecs_meta_elem(ecs_meta_cursor_t *cursor, int32_t elem)
Move cursor to a field.
struct ecs_enum_constant_t ecs_enum_constant_t
Type that describes an enum constant.
FLECS_API int64_t ecs_meta_get_int(const ecs_meta_cursor_t *cursor)
Get field value as signed integer.
struct ecs_primitive_desc_t ecs_primitive_desc_t
Used with ecs_primitive_init().
FLECS_API void ecs_value_fini(const ecs_world_t *world, ecs_value_t *v)
Destruct value.
ecs_type_kind_t
Type kinds supported by meta addon.
Definition meta.h:153
struct ecs_unit_translation_t ecs_unit_translation_t
Helper type to describe translation between two units.
FLECS_API ecs_entity_t ecs_primitive_init(ecs_world_t *world, const ecs_primitive_desc_t *desc)
Create a new primitive type.
FLECS_API ecs_entity_t ecs_unit_init(ecs_world_t *world, const ecs_unit_desc_t *desc)
Create a new unit.
uint16_t ecs_u16_t
Built-in u16 type.
Definition meta.h:99
FLECS_API int ecs_value_compare(const ecs_world_t *world, const ecs_value_t *a, const ecs_value_t *b)
Compare two values.
int(* ecs_meta_serialize_t)(const ecs_serializer_t *ser, const void *src)
Callback invoked serializing an opaque type.
Definition meta.h:396
FLECS_API int ecs_ptr_init_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Construct a value in existing storage.
FLECS_API int ecs_meta_set_string(ecs_meta_cursor_t *cursor, const char *value)
Set field with string value.
struct ecs_struct_desc_t ecs_struct_desc_t
Used with ecs_struct_init().
#define ECS_META_MAX_SCOPE_DEPTH
Maximum level of type nesting.
Definition meta.h:611
int32_t ecs_i32_t
Built-in i32 type.
Definition meta.h:105
FLECS_API int ecs_meta_member(ecs_meta_cursor_t *cursor, const char *name)
Move cursor to member.
FLECS_API ecs_entity_t ecs_enum_init(ecs_world_t *world, const ecs_enum_desc_t *desc)
Create a new enum type.
FLECS_API ecs_entity_t ecs_struct_init(ecs_world_t *world, const ecs_struct_desc_t *desc)
Create a new struct type.
FLECS_API void ecs_value_move(const ecs_world_t *world, ecs_value_t *dst, ecs_value_t *src)
Move value.
FLECS_API int ecs_set_rtt_compare(ecs_world_t *world, ecs_entity_t type)
Generate a runtime compare hook for a type.
void * ecs_ptr_new_w_type_info(ecs_world_t *world, const ecs_type_info_t *ti)
Construct a value in new storage.
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.
struct ecs_meta_op_t ecs_meta_op_t
Meta type serializer instruction data.
struct EcsType EcsType
Component that is automatically added to every type with the right kind.
FLECS_API int ecs_meta_set_bool(ecs_meta_cursor_t *cursor, bool value)
Set field with boolean value.
int8_t ecs_i8_t
Built-in i8 type.
Definition meta.h:103
unsigned char ecs_byte_t
Built-in ecs_byte type.
Definition meta.h:97
struct EcsUnitPrefix EcsUnitPrefix
Component that stores unit prefix data.
struct EcsMap EcsMap
Component added to map type entities.
FLECS_API int ecs_meta_set_char(ecs_meta_cursor_t *cursor, char value)
Set field with char value.
struct ecs_unit_desc_t ecs_unit_desc_t
Used with ecs_unit_init().
struct ecs_meta_scope_t ecs_meta_scope_t
Type with information about the currently iterated scope.
#define ECS_MEMBER_DESC_CACHE_SIZE
Max number of constants and members that can be specified in desc structs.
Definition meta.h:79
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.
FLECS_API bool ecs_meta_is_map(const ecs_meta_cursor_t *cursor)
Is the current scope a map? When the current scope is a map, elements can be selected by moving the c...
FLECS_API void * ecs_meta_get_ptr(ecs_meta_cursor_t *cursor)
Get pointer to current field.
struct EcsMemberRanges EcsMemberRanges
Component added to member entities to express valid value ranges.
FLECS_API int ecs_ptr_copy(const ecs_world_t *world, ecs_entity_t type, void *dst, const void *src)
Copy a value.
struct EcsTypeSerializer EcsTypeSerializer
Component that stores the type serializer.
struct EcsUnit EcsUnit
Component that stores unit data.
FLECS_API int ecs_meta_set_value(ecs_meta_cursor_t *cursor, const ecs_value_t *value)
Set field with dynamic value.
FLECS_API int ecs_meta_set_null(ecs_meta_cursor_t *cursor)
Set field with null value.
FLECS_API ecs_entity_t ecs_array_init(ecs_world_t *world, const ecs_array_desc_t *desc)
Create a new array type.
FLECS_API int ecs_meta_set_entity(ecs_meta_cursor_t *cursor, ecs_entity_t value)
Set field with entity value.
FLECS_API ecs_id_t ecs_meta_get_id(const ecs_meta_cursor_t *cursor)
Get field value as (component) ID.
struct ecs_unit_prefix_desc_t ecs_unit_prefix_desc_t
Used with ecs_unit_prefix_init().
FLECS_API int ecs_ptr_copy_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, const void *src)
Copy a value.
FLECS_API bool ecs_value_equals(const ecs_world_t *world, const ecs_value_t *a, const ecs_value_t *b)
Test if two values are equal.
struct ecs_bitmask_desc_t ecs_bitmask_desc_t
Used with ecs_bitmask_init().
FLECS_API int ecs_meta_push(ecs_meta_cursor_t *cursor)
Push a scope (required and only valid for structs and collections).
FLECS_API int ecs_ptr_move_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move a value.
@ EcsOpPrimitive
Marks first constant that's a primitive.
Definition meta.h:557
@ EcsOpPushMap
Push map.
Definition meta.h:542
@ EcsOpOpaqueArray
Opaque array.
Definition meta.h:547
@ EcsOpOpaqueStruct
Opaque struct.
Definition meta.h:546
@ EcsOpScope
Marks last constant that can open or close a scope.
Definition meta.h:551
@ EcsOpPop
Pop scope.
Definition meta.h:544
@ EcsOpPushVector
Push vector.
Definition meta.h:541
@ EcsOpOpaqueVector
Opaque vector.
Definition meta.h:548
@ EcsOpPushStruct
Push struct.
Definition meta.h:539
@ EcsOpPushValue
Push value.
Definition meta.h:543
@ EcsOpOpaqueValue
Opaque value.
Definition meta.h:553
@ EcsOpPushArray
Push array.
Definition meta.h:540
@ EcsOpForward
Forward to type.
Definition meta.h:549
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:393
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:437
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
Definition flecs.h:386
Utility macros for populating reflection data in C.
Component added to array type entities.
Definition meta.h:323
int32_t count
Number of elements.
Definition meta.h:325
ecs_entity_t type
Element type.
Definition meta.h:324
Component added to bitmask type entities.
Definition meta.h:309
int32_t dummy_
Unused.
Definition meta.h:310
Component with data structures for looking up enum or bitmask constants.
Definition meta.h:314
ecs_vec_t ordered_constants
Stores the constants in registration order.
Definition meta.h:319
ecs_map_t * constants
Populated from child entities with Constant component.
Definition meta.h:316
Component added to enum type entities.
Definition meta.h:289
ecs_entity_t underlying_type
Underlying type for enum.
Definition meta.h:290
Component added to map type entities.
Definition meta.h:334
ecs_entity_t type
Value type.
Definition meta.h:336
ecs_entity_t key_type
Key type.
Definition meta.h:335
Component added to member entities to express valid value ranges.
Definition meta.h:217
ecs_member_value_range_t warning
Member value warning range.
Definition meta.h:219
ecs_member_value_range_t value
Member value range.
Definition meta.h:218
ecs_member_value_range_t error
Member value error range.
Definition meta.h:220
Component added to member entities.
Definition meta.h:202
ecs_entity_t unit
Member unit.
Definition meta.h:205
bool use_offset
If offset should be explicitly used.
Definition meta.h:207
ecs_entity_t type
Member type.
Definition meta.h:203
int32_t offset
Member offset.
Definition meta.h:206
int32_t count
Number of elements for inline arrays.
Definition meta.h:204
Opaque type reflection data.
Definition meta.h:418
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:491
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:473
ecs_meta_serialize_member_t serialize_member
Serialize member action.
Definition meta.h:421
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:477
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:446
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:420
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:436
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:419
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:431
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:456
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:495
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:441
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:451
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:461
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) ID value.
Definition meta.h:467
ecs_meta_serialize_element_t serialize_element
Serialize element action.
Definition meta.h:422
Component added to primitive types.
Definition meta.h:197
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:198
Component added to struct type entities.
Definition meta.h:268
ecs_vec_t members
Populated from child entities with Member component.
Definition meta.h:270
Component that stores the type serializer.
Definition meta.h:600
ecs_type_kind_t kind
Quick access to type kind (same as EcsType).
Definition meta.h:601
ecs_vec_t ops
vector<ecs_meta_op_t>
Definition meta.h:602
Component that is automatically added to every type with the right kind.
Definition meta.h:167
bool existing
Whether the type existed or was populated from reflection.
Definition meta.h:169
bool partial
Whether the reflection data is a partial type description.
Definition meta.h:170
ecs_type_kind_t kind
Type kind.
Definition meta.h:168
Component that stores unit prefix data.
Definition meta.h:525
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:527
char * symbol
Symbol of prefix (e.g., "K", "M", "Ki").
Definition meta.h:526
Component that stores unit data.
Definition meta.h:516
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:521
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:518
char * symbol
Unit symbol.
Definition meta.h:517
ecs_entity_t base
Base unit (e.g., "meters").
Definition meta.h:519
ecs_entity_t over
Over unit (e.g., "per second").
Definition meta.h:520
Component added to vector type entities.
Definition meta.h:329
ecs_entity_t type
Element type.
Definition meta.h:330
Used with ecs_array_init().
Definition meta.h:1488
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1489
ecs_entity_t type
Element type.
Definition meta.h:1490
int32_t count
Number of elements.
Definition meta.h:1491
Type that describes a bitmask constant.
Definition meta.h:294
ecs_flags64_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:299
int64_t _unused
Keep layout the same with ecs_enum_constant_t.
Definition meta.h:302
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:305
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:296
Used with ecs_bitmask_init().
Definition meta.h:1470
ecs_bitmask_constant_t constants[(32)]
Bitmask constants.
Definition meta.h:1472
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1471
Used with ecs_entity_init().
Definition flecs.h:1075
Type that describes an enum constant.
Definition meta.h:274
ecs_entity_t constant
Should not be set by ecs_enum_desc_t.
Definition meta.h:285
uint64_t value_unsigned
For when the underlying type is unsigned.
Definition meta.h:282
int64_t value
May be set when used with ecs_enum_desc_t.
Definition meta.h:279
const char * name
Must be set when used with ecs_enum_desc_t.
Definition meta.h:276
Used with ecs_enum_init().
Definition meta.h:1451
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1452
ecs_entity_t underlying_type
Underlying type for enum.
Definition meta.h:1454
ecs_enum_constant_t constants[(32)]
Enum constants.
Definition meta.h:1453
Used with ecs_map_type_init().
Definition meta.h:1525
ecs_entity_t key_type
Key type.
Definition meta.h:1527
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1526
ecs_entity_t type
Value type.
Definition meta.h:1528
Element type of members vector in EcsStruct.
Definition meta.h:224
ecs_member_value_range_t warning_range
Numerical range outside of which the value represents a warning.
Definition meta.h:258
const char * name
Must be set when used with ecs_struct_desc_t.
Definition meta.h:226
ecs_size_t size
Should not be set by ecs_struct_desc_t.
Definition meta.h:261
bool use_offset
Set to true to prevent automatic offset computation.
Definition meta.h:245
ecs_entity_t type
Member type.
Definition meta.h:229
ecs_entity_t member
Should not be set by ecs_struct_desc_t.
Definition meta.h:264
int32_t offset
May be set when used with ecs_struct_desc_t.
Definition meta.h:236
ecs_entity_t unit
May be set when used with ecs_struct_desc_t.
Definition meta.h:240
ecs_member_value_range_t range
Numerical range that specifies which values member can assume.
Definition meta.h:250
int32_t count
Element count (for inline arrays).
Definition meta.h:233
ecs_member_value_range_t error_range
Numerical range outside of which the value represents an error.
Definition meta.h:254
Type expressing a range for a member value.
Definition meta.h:211
double min
Min member value.
Definition meta.h:212
double max
Max member value.
Definition meta.h:213
Type that enables iterating and populating a value using reflection data.
Definition meta.h:632
ecs_meta_scope_t scope[(32)]
Cursor scope stack.
Definition meta.h:634
bool valid
Whether the cursor points to a valid field.
Definition meta.h:636
const ecs_world_t * world
The world.
Definition meta.h:633
void * lookup_ctx
Context for lookup_action.
Definition meta.h:641
int16_t depth
Current scope depth.
Definition meta.h:635
ecs_entity_t(* lookup_action)(ecs_world_t *, const char *, void *)
Custom entity lookup action for overriding default ecs_lookup().
Definition meta.h:640
bool is_primitive_scope
If in root scope, this allows for a push for primitive types.
Definition meta.h:637
Meta type serializer instruction data.
Definition meta.h:581
const char * name
Name of value (only used for struct members).
Definition meta.h:585
ecs_meta_op_kind_t kind
Instruction opcode.
Definition meta.h:582
ecs_hashmap_t * members
string -> member index (structs).
Definition meta.h:592
ecs_meta_serialize_t opaque
Serialize callback for opaque types.
Definition meta.h:594
const ecs_type_info_t * type_info
Type info.
Definition meta.h:590
ecs_map_t * constants
(u)int -> constant entity (enums and bitmasks).
Definition meta.h:593
int16_t member_index
Index of member in struct.
Definition meta.h:588
ecs_entity_t type
Type entity.
Definition meta.h:589
int16_t op_count
Number of operations until next field or end.
Definition meta.h:587
ecs_meta_op_kind_t underlying_kind
Underlying type kind (for enums).
Definition meta.h:583
ecs_size_t elem_size
Element size (for PushArray or PushVector) and element count (for PopArray).
Definition meta.h:586
ecs_size_t offset
Offset of current field.
Definition meta.h:584
Type with information about the currently iterated scope.
Definition meta.h:614
bool is_moved_scope
Whether the scope was moved in (with ecs_meta_elem(), for vectors).
Definition meta.h:627
int16_t ops_cur
Current element in ops.
Definition meta.h:618
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:621
int32_t elem_count
Set for collections.
Definition meta.h:628
void * ptr
Pointer to ops[0].
Definition meta.h:620
bool is_empty_scope
Whether the scope was populated (for vectors).
Definition meta.h:626
bool is_map
Whether the scope is a map.
Definition meta.h:624
int16_t ops_count
Number of elements in ops.
Definition meta.h:617
ecs_meta_op_t * ops
The type operations (see ecs_meta_op_t).
Definition meta.h:616
ecs_hashmap_t * members
string -> member index.
Definition meta.h:622
int16_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:619
ecs_entity_t type
The type being iterated.
Definition meta.h:615
bool is_collection
Whether the scope is iterating elements.
Definition meta.h:623
bool is_value
Whether the scope is a value.
Definition meta.h:625
Used with ecs_opaque_init().
Definition meta.h:1602
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1603
EcsOpaque type
Type that the opaque type maps to.
Definition meta.h:1604
Used with ecs_primitive_init().
Definition meta.h:1433
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1434
ecs_primitive_kind_t kind
Primitive type kind.
Definition meta.h:1435
Serializer interface.
Definition meta.h:345
void * ctx
Serializer context.
Definition meta.h:358
int(* value)(const struct ecs_serializer_t *ser, ecs_entity_t type, const void *value)
Serialize value.
Definition meta.h:347
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Serialize member.
Definition meta.h:353
const ecs_world_t * world
The world.
Definition meta.h:357
Used with ecs_struct_init().
Definition meta.h:1544
ecs_member_t members[(32)]
Struct members.
Definition meta.h:1546
bool create_member_entities
Create entities for members.
Definition meta.h:1547
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1545
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:1050
Used with ecs_unit_init().
Definition meta.h:1636
ecs_entity_t base
Base unit, e.g., "meters" (optional).
Definition meta.h:1647
ecs_entity_t over
Over unit, e.g., "per second" (optional).
Definition meta.h:1650
const char * symbol
Unit symbol, e.g., "m", "%", "g".
Definition meta.h:1641
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:1661
ecs_entity_t quantity
Unit quantity, e.g., distance, percentage, weight.
Definition meta.h:1644
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1653
ecs_entity_t entity
Existing entity to associate with unit (optional).
Definition meta.h:1638
Used with ecs_unit_prefix_init().
Definition meta.h:1677
ecs_entity_t entity
Existing entity to associate with unit prefix (optional).
Definition meta.h:1679
const char * symbol
Unit prefix symbol, e.g., "K", "M", "Ki".
Definition meta.h:1682
ecs_unit_translation_t translation
Translation to apply to derived unit (optional).
Definition meta.h:1685
Helper type to describe translation between two units.
Definition meta.h:510
int32_t power
Power to apply to factor (e.g., "1", "3", "-9").
Definition meta.h:512
int32_t factor
Factor to apply (e.g., "1000", "1000000", "1024").
Definition meta.h:511
Value of a dynamic type.
Definition flecs.h:1066
Used with ecs_vector_init().
Definition meta.h:1507
ecs_entity_t entity
Existing entity to use for type (optional).
Definition meta.h:1508
ecs_entity_t type
Element type.
Definition meta.h:1509