Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
meta.h
Go to the documentation of this file.
1
55#ifdef FLECS_META
56
65#include <stddef.h>
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
78#define ECS_MEMBER_DESC_CACHE_SIZE (32)
79
87typedef bool ecs_bool_t;
88typedef char ecs_char_t;
89typedef unsigned char ecs_byte_t;
90typedef uint8_t ecs_u8_t;
91typedef uint16_t ecs_u16_t;
92typedef uint32_t ecs_u32_t;
93typedef uint64_t ecs_u64_t;
94typedef uintptr_t ecs_uptr_t;
95typedef int8_t ecs_i8_t;
96typedef int16_t ecs_i16_t;
97typedef int32_t ecs_i32_t;
98typedef int64_t ecs_i64_t;
99typedef intptr_t ecs_iptr_t;
100typedef float ecs_f32_t;
101typedef double ecs_f64_t;
102typedef char* ecs_string_t;
103
104/* Meta module component ids */
105FLECS_API extern const ecs_entity_t ecs_id(EcsMetaType);
106FLECS_API extern const ecs_entity_t ecs_id(EcsMetaTypeSerialized);
107FLECS_API extern const ecs_entity_t ecs_id(EcsPrimitive);
108FLECS_API extern const ecs_entity_t ecs_id(EcsEnum);
109FLECS_API extern const ecs_entity_t ecs_id(EcsBitmask);
110FLECS_API extern const ecs_entity_t ecs_id(EcsMember);
111FLECS_API extern const ecs_entity_t ecs_id(EcsMemberRanges);
112FLECS_API extern const ecs_entity_t ecs_id(EcsStruct);
113FLECS_API extern const ecs_entity_t ecs_id(EcsArray);
114FLECS_API extern const ecs_entity_t ecs_id(EcsVector);
115FLECS_API extern const ecs_entity_t ecs_id(EcsOpaque);
116FLECS_API extern const ecs_entity_t ecs_id(EcsUnit);
117FLECS_API extern const ecs_entity_t ecs_id(EcsUnitPrefix);
118FLECS_API extern const ecs_entity_t EcsConstant;
119FLECS_API extern const ecs_entity_t EcsQuantity;
120
121/* Primitive type component ids */
122FLECS_API extern const ecs_entity_t ecs_id(ecs_bool_t);
123FLECS_API extern const ecs_entity_t ecs_id(ecs_char_t);
124FLECS_API extern const ecs_entity_t ecs_id(ecs_byte_t);
125FLECS_API extern const ecs_entity_t ecs_id(ecs_u8_t);
126FLECS_API extern const ecs_entity_t ecs_id(ecs_u16_t);
127FLECS_API extern const ecs_entity_t ecs_id(ecs_u32_t);
128FLECS_API extern const ecs_entity_t ecs_id(ecs_u64_t);
129FLECS_API extern const ecs_entity_t ecs_id(ecs_uptr_t);
130FLECS_API extern const ecs_entity_t ecs_id(ecs_i8_t);
131FLECS_API extern const ecs_entity_t ecs_id(ecs_i16_t);
132FLECS_API extern const ecs_entity_t ecs_id(ecs_i32_t);
133FLECS_API extern const ecs_entity_t ecs_id(ecs_i64_t);
134FLECS_API extern const ecs_entity_t ecs_id(ecs_iptr_t);
135FLECS_API extern const ecs_entity_t ecs_id(ecs_f32_t);
136FLECS_API extern const ecs_entity_t ecs_id(ecs_f64_t);
137FLECS_API extern const ecs_entity_t ecs_id(ecs_string_t);
138FLECS_API extern const ecs_entity_t ecs_id(ecs_entity_t);
139
141typedef enum ecs_type_kind_t {
142 EcsPrimitiveType,
143 EcsBitmaskType,
144 EcsEnumType,
145 EcsStructType,
146 EcsArrayType,
147 EcsVectorType,
148 EcsOpaqueType,
149 EcsTypeKindLast = EcsOpaqueType
151
153typedef struct EcsMetaType {
154 ecs_type_kind_t kind;
155 bool existing;
156 bool partial;
158
161 EcsBool = 1,
162 EcsChar,
163 EcsByte,
164 EcsU8,
165 EcsU16,
166 EcsU32,
167 EcsU64,
168 EcsI8,
169 EcsI16,
170 EcsI32,
171 EcsI64,
172 EcsF32,
173 EcsF64,
174 EcsUPtr,
175 EcsIPtr,
176 EcsString,
177 EcsEntity,
178 EcsPrimitiveKindLast = EcsEntity
180
185
187typedef struct EcsMember {
188 ecs_entity_t type;
189 int32_t count;
190 ecs_entity_t unit;
191 int32_t offset;
193
196 double min;
197 double max;
199
206
238
240typedef struct EcsStruct {
242 ecs_vec_t members; /* vector<ecs_member_t> */
244
245typedef struct ecs_enum_constant_t {
247 const char *name;
248
250 int32_t value;
251
255
257typedef struct EcsEnum {
259 ecs_map_t constants; /* map<i32_t, ecs_enum_constant_t> */
261
264 const char *name;
265
267 ecs_flags32_t value;
268
272
274typedef struct EcsBitmask {
275 /* Populated from child entities with Constant component */
276 ecs_map_t constants; /* map<u32_t, ecs_bitmask_constant_t> */
278
284
289
290
291/* Opaque type support */
292
293#if !defined(__cplusplus) || !defined(FLECS_CPP)
294
296typedef struct ecs_serializer_t {
297 /* Serialize value */
298 int (*value)(
299 const struct ecs_serializer_t *ser,
300 ecs_entity_t type,
301 const void *value);
303 /* Serialize member */
304 int (*member)(
305 const struct ecs_serializer_t *ser,
306 const char *member);
308 const ecs_world_t *world;
309 void *ctx;
311
312#elif defined(__cplusplus)
313
314} /* extern "C" { */
315
317typedef struct ecs_serializer_t {
318 /* Serialize value */
319 int (*value_)(
320 const struct ecs_serializer_t *ser,
321 ecs_entity_t type,
322 const void *value);
323
324 /* Serialize member */
325 int (*member_)(
326 const struct ecs_serializer_t *ser,
327 const char *name);
328
329 /* Serialize value */
330 int value(ecs_entity_t type, const void *value) const;
331
332 /* Serialize value */
333 template <typename T>
334 int value(const T& value) const;
335
336 /* Serialize member */
337 int member(const char *name) const;
338
339 const ecs_world_t *world;
340 void *ctx;
342
343extern "C" {
344#endif
345
347typedef int (*ecs_meta_serialize_t)(
348 const ecs_serializer_t *ser,
349 const void *src);
351typedef struct EcsOpaque {
355 /* Deserializer interface
356 * Only override the callbacks that are valid for the opaque type. If a
357 * deserializer attempts to assign a value type that is not supported by the
358 * interface, a conversion error is thrown.
359 */
360
362 void (*assign_bool)(
363 void *dst,
364 bool value);
365
367 void (*assign_char)(
368 void *dst,
369 char value);
370
372 void (*assign_int)(
373 void *dst,
374 int64_t value);
375
377 void (*assign_uint)(
378 void *dst,
379 uint64_t value);
380
383 void *dst,
384 double value);
385
388 void *dst,
389 const char *value);
390
393 void *dst,
394 ecs_world_t *world,
395 ecs_entity_t entity);
396
398 void (*assign_null)(
399 void *dst);
400
402 void (*clear)(
403 void *dst);
404
406 void* (*ensure_element)(
407 void *dst,
408 size_t elem);
409
411 void* (*ensure_member)(
412 void *dst,
413 const char *member);
414
416 size_t (*count)(
417 const void *dst);
418
420 void (*resize)(
421 void *dst,
422 size_t count);
423} EcsOpaque;
424
425
426/* Units */
427
428/* Helper type to describe translation between two units. Note that this
429 * is not intended as a generic approach to unit conversions (e.g. from celsius
430 * to fahrenheit) but to translate between units that derive from the same base
431 * (e.g. meters to kilometers).
432 *
433 * Note that power is applied to the factor. When describing a translation of
434 * 1000, either use {factor = 1000, power = 1} or {factor = 1, power = 3}. */
436 int32_t factor;
437 int32_t power;
439
447
452
453
454/* Serializer utilities */
455
457 EcsOpArray,
458 EcsOpVector,
459 EcsOpOpaque,
460 EcsOpPush,
461 EcsOpPop,
462
465 EcsOpEnum,
466 EcsOpBitmask,
467
470 EcsOpBool,
471 EcsOpChar,
472 EcsOpByte,
473 EcsOpU8,
474 EcsOpU16,
475 EcsOpU32,
476 EcsOpU64,
477 EcsOpI8,
478 EcsOpI16,
479 EcsOpI32,
480 EcsOpI64,
481 EcsOpF32,
482 EcsOpF64,
483 EcsOpUPtr,
484 EcsOpIPtr,
485 EcsOpString,
486 EcsOpEntity,
487 EcsMetaTypeOpKindLast = EcsOpEntity
489
490typedef struct ecs_meta_type_op_t {
492 ecs_size_t offset;
493 int32_t count;
494 const char *name;
495 int32_t op_count;
496 ecs_size_t size;
498 int32_t member_index;
499 ecs_hashmap_t *members;
501
502typedef struct EcsMetaTypeSerialized {
503 ecs_vec_t ops;
505
506
507/* Deserializer utilities */
508
509#define ECS_META_MAX_SCOPE_DEPTH (32) /* >32 levels of nesting is not sane */
510
528
530typedef struct ecs_meta_cursor_t {
531 const ecs_world_t *world;
532 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
533 int32_t depth;
534 bool valid;
537 /* Custom entity lookup action for overriding default ecs_lookup_fullpath */
538 ecs_entity_t (*lookup_action)(const ecs_world_t*, const char*, void*);
539 void *lookup_ctx;
541
542FLECS_API
543ecs_meta_cursor_t ecs_meta_cursor(
544 const ecs_world_t *world,
545 ecs_entity_t type,
546 void *ptr);
547
549FLECS_API
551 ecs_meta_cursor_t *cursor);
552
554FLECS_API
556 ecs_meta_cursor_t *cursor);
557
559FLECS_API
561 ecs_meta_cursor_t *cursor,
562 int32_t elem);
563
565FLECS_API
567 ecs_meta_cursor_t *cursor,
568 const char *name);
569
571FLECS_API
573 ecs_meta_cursor_t *cursor,
574 const char *name);
575
577FLECS_API
579 ecs_meta_cursor_t *cursor);
580
582FLECS_API
584 ecs_meta_cursor_t *cursor);
585
587FLECS_API
589 const ecs_meta_cursor_t *cursor);
590
592FLECS_API
594 const ecs_meta_cursor_t *cursor);
595
597FLECS_API
599 const ecs_meta_cursor_t *cursor);
600
602FLECS_API
604 const ecs_meta_cursor_t *cursor);
605
607FLECS_API
609 const ecs_meta_cursor_t *cursor);
610
611/* The set functions assign the field with the specified value. If the value
612 * does not have the same type as the field, it will be cased to the field type.
613 * If no valid conversion is available, the operation will fail. */
614
616FLECS_API
618 ecs_meta_cursor_t *cursor,
619 bool value);
620
622FLECS_API
624 ecs_meta_cursor_t *cursor,
625 char value);
626
628FLECS_API
630 ecs_meta_cursor_t *cursor,
631 int64_t value);
632
634FLECS_API
636 ecs_meta_cursor_t *cursor,
637 uint64_t value);
638
640FLECS_API
642 ecs_meta_cursor_t *cursor,
643 double value);
644
646FLECS_API
648 ecs_meta_cursor_t *cursor,
649 const char *value);
650
652FLECS_API
654 ecs_meta_cursor_t *cursor,
655 const char *value);
656
658FLECS_API
660 ecs_meta_cursor_t *cursor,
661 ecs_entity_t value);
662
664FLECS_API
666 ecs_meta_cursor_t *cursor);
667
669FLECS_API
671 ecs_meta_cursor_t *cursor,
672 const ecs_value_t *value);
673
674/* Functions for getting members. */
675
677FLECS_API
679 const ecs_meta_cursor_t *cursor);
680
682FLECS_API
684 const ecs_meta_cursor_t *cursor);
685
687FLECS_API
689 const ecs_meta_cursor_t *cursor);
690
692FLECS_API
694 const ecs_meta_cursor_t *cursor);
695
697FLECS_API
699 const ecs_meta_cursor_t *cursor);
700
705FLECS_API
707 const ecs_meta_cursor_t *cursor);
708
711FLECS_API
713 const ecs_meta_cursor_t *cursor);
714
716FLECS_API
718 ecs_primitive_kind_t type_kind,
719 const void *ptr);
720
721/* API functions for creating meta types */
722
728
730FLECS_API
732 ecs_world_t *world,
733 const ecs_primitive_desc_t *desc);
734
736typedef struct ecs_enum_desc_t {
738 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
740
742FLECS_API
744 ecs_world_t *world,
745 const ecs_enum_desc_t *desc);
746
747
749typedef struct ecs_bitmask_desc_t {
751 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
753
755FLECS_API
757 ecs_world_t *world,
758 const ecs_bitmask_desc_t *desc);
759
760
762typedef struct ecs_array_desc_t {
764 ecs_entity_t type;
765 int32_t count;
767
769FLECS_API
771 ecs_world_t *world,
772 const ecs_array_desc_t *desc);
773
774
780
782FLECS_API
784 ecs_world_t *world,
785 const ecs_vector_desc_t *desc);
786
787
789typedef struct ecs_struct_desc_t {
791 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
793
795FLECS_API
797 ecs_world_t *world,
798 const ecs_struct_desc_t *desc);
799
801typedef struct ecs_opaque_desc_t {
802 ecs_entity_t entity;
803 EcsOpaque type;
805
824FLECS_API
826 ecs_world_t *world,
827 const ecs_opaque_desc_t *desc);
828
857
859FLECS_API
861 ecs_world_t *world,
862 const ecs_unit_desc_t *desc);
863
875
877FLECS_API
879 ecs_world_t *world,
880 const ecs_unit_prefix_desc_t *desc);
881
883FLECS_API
885 ecs_world_t *world,
886 const ecs_entity_desc_t *desc);
887
888/* Convenience macros */
889
890#define ecs_primitive(world, ...)\
891 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
892
893#define ecs_enum(world, ...)\
894 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
895
896#define ecs_bitmask(world, ...)\
897 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
898
899#define ecs_array(world, ...)\
900 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
901
902#define ecs_vector(world, ...)\
903 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
904
905#define ecs_opaque(world, ...)\
906 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
907
908#define ecs_struct(world, ...)\
909 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
910
911#define ecs_unit(world, ...)\
912 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
913
914#define ecs_unit_prefix(world, ...)\
915 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
916
917#define ecs_quantity(world, ...)\
918 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
919
920/* Module import */
921FLECS_API
922void FlecsMetaImport(
923 ecs_world_t *world);
924
925#ifdef __cplusplus
926}
927#endif
928
929#endif
930
933#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.
FLECS_API bool ecs_meta_get_bool(const ecs_meta_cursor_t *cursor)
Get field value as boolean.
bool ecs_bool_t
Primitive type definitions.
Definition meta.h:87
FLECS_API ecs_entity_t ecs_bitmask_init(ecs_world_t *world, const ecs_bitmask_desc_t *desc)
Create a new bitmask type.
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_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.
FLECS_API int ecs_meta_dotmember(ecs_meta_cursor_t *cursor, const char *name)
Move cursor to member, supports dot-separated nested members.
FLECS_API ecs_entity_t ecs_meta_get_entity(const ecs_meta_cursor_t *cursor)
Get field value as entity.
FLECS_API bool ecs_meta_is_collection(const ecs_meta_cursor_t *cursor)
Is the current scope a collection?
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_entity_t ecs_meta_get_unit(const ecs_meta_cursor_t *cursor)
Get unit of current element.
ecs_primitive_kind_t
Primitive type kinds supported by meta addon.
Definition meta.h:160
FLECS_API ecs_entity_t ecs_meta_get_member_id(const ecs_meta_cursor_t *cursor)
Get member entity of current member.
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 member.
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 element.
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.
ecs_meta_type_op_kind_t
Definition meta.h:456
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 int ecs_meta_elem(ecs_meta_cursor_t *cursor, int32_t elem)
Move cursor to a element.
FLECS_API int64_t ecs_meta_get_int(const ecs_meta_cursor_t *cursor)
Get field value as signed integer.
ecs_type_kind_t
Type kinds supported by meta addon.
Definition meta.h:141
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.
int(* ecs_meta_serialize_t)(const ecs_serializer_t *ser, const void *src)
Callback invoked serializing an opaque type.
Definition meta.h:347
FLECS_API int ecs_meta_set_string(ecs_meta_cursor_t *cursor, const char *value)
Set field with string value.
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 int ecs_meta_set_bool(ecs_meta_cursor_t *cursor, bool value)
Set field with boolean value.
FLECS_API int ecs_meta_set_char(ecs_meta_cursor_t *cursor, char value)
Set field with char value.
FLECS_API void * ecs_meta_get_ptr(ecs_meta_cursor_t *cursor)
Get pointer to current field.
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 int ecs_meta_push(ecs_meta_cursor_t *cursor)
Push a scope (required/only valid for structs & collections)
@ EcsOpPrimitive
Marks first constant that's a primitive.
Definition meta.h:468
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition meta.h:463
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:288
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:332
Component added to array type entities.
Definition meta.h:280
int32_t count
Number of elements.
Definition meta.h:282
ecs_entity_t type
Element type.
Definition meta.h:281
Component added to bitmask type entities.
Definition meta.h:274
Component information.
Definition flecs.h:1272
Component added to enum type entities.
Definition meta.h:257
ecs_map_t constants
Populated from child entities with Constant component.
Definition meta.h:259
Component added to member entities to express valid value ranges.
Definition meta.h:201
Component added to member entities.
Definition meta.h:187
ecs_vec_t ops
vector<ecs_meta_type_op_t>
Definition meta.h:503
Component that is automatically added to every type with the right kind.
Definition meta.h:153
bool partial
Is the reflection data a partial type description.
Definition meta.h:156
bool existing
Did the type exist or is it populated from reflection.
Definition meta.h:155
size_t(* count)(const void *dst)
Return number of elements.
Definition meta.h:416
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:398
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:402
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:377
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:353
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:367
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:352
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:362
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:387
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:420
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:372
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:382
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:392
Component added to primitive types.
Definition meta.h:182
Component added to struct type entities.
Definition meta.h:240
ecs_vec_t members
Populated from child entities with Member component.
Definition meta.h:242
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:450
char * symbol
Symbol of prefix (e.g.
Definition meta.h:449
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:445
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:442
ecs_entity_t base
Base unit (e.g.
Definition meta.h:443
ecs_entity_t over
Over unit (e.g.
Definition meta.h:444
Component added to vector type entities.
Definition meta.h:286
ecs_entity_t type
Element type.
Definition meta.h:287
Used with ecs_array_init.
Definition meta.h:762
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:763
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:270
ecs_flags32_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:267
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:264
Used with ecs_bitmask_init.
Definition meta.h:749
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:750
Used with ecs_entity_init.
Definition flecs.h:879
ecs_entity_t constant
Should not be set by ecs_enum_desc_t.
Definition meta.h:253
int32_t value
May be set when used with ecs_enum_desc_t.
Definition meta.h:250
const char * name
Must be set when used with ecs_enum_desc_t.
Definition meta.h:247
Used with ecs_enum_init.
Definition meta.h:736
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:737
Element type of members vector in EcsStruct.
Definition meta.h:208
ecs_member_value_range_t warning_range
Numerical range outside of which the value represents an warning.
Definition meta.h:232
const char * name
Must be set when used with ecs_struct_desc_t.
Definition meta.h:210
ecs_size_t size
Should not be set by ecs_struct_desc_t.
Definition meta.h:235
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:219
ecs_member_value_range_t range
Numerical range that specifies which values member can assume.
Definition meta.h:224
int32_t count
May be set when used with ecs_struct_desc_t.
Definition meta.h:214
ecs_member_value_range_t error_range
Numerical range outside of which the value represents an error.
Definition meta.h:228
Type expressing a range for a member value.
Definition meta.h:195
Type that enables iterating/populating a value using reflection data.
Definition meta.h:530
bool is_primitive_scope
If in root scope, this allows for a push for primitive types.
Definition meta.h:535
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:521
int32_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:517
const EcsComponent * comp
Pointer to component, in case size/alignment is needed.
Definition meta.h:520
void * ptr
Pointer to the value being iterated.
Definition meta.h:518
bool is_empty_scope
Was scope populated (for collections)
Definition meta.h:526
ecs_vec_t * vector
Current vector, in case a vector is iterated.
Definition meta.h:522
int32_t elem_cur
Current element (for collections)
Definition meta.h:516
int32_t op_cur
Current operation.
Definition meta.h:515
bool is_inline_array
Is the scope iterating an inline array?
Definition meta.h:525
ecs_hashmap_t * members
string -> member index
Definition meta.h:523
ecs_meta_type_op_t * ops
The type operations (see ecs_meta_type_op_t)
Definition meta.h:513
int32_t op_count
Number of operations in ops array to process.
Definition meta.h:514
ecs_entity_t type
The type being iterated.
Definition meta.h:512
bool is_collection
Is the scope iterating elements?
Definition meta.h:524
ecs_entity_t type
Type entity.
Definition meta.h:497
ecs_size_t size
Size of type of operation.
Definition meta.h:496
ecs_size_t offset
Offset of current field.
Definition meta.h:492
const char * name
Name of value (only used for struct members)
Definition meta.h:494
int32_t member_index
Index of member in struct.
Definition meta.h:498
ecs_hashmap_t * members
string -> member index (structs only)
Definition meta.h:499
int32_t op_count
Number of operations until next field or end.
Definition meta.h:495
Used with ecs_opaque_init.
Definition meta.h:801
Used with ecs_primitive_init.
Definition meta.h:724
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:725
Serializer interface.
Definition meta.h:296
int(* value)(const struct ecs_serializer_t *ser, ecs_entity_t type, const void *value)
Pointer to the value to serialize.
Definition meta.h:298
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Member name.
Definition meta.h:304
Used with ecs_struct_init.
Definition meta.h:789
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:790
Used with ecs_unit_init.
Definition meta.h:830
ecs_entity_t base
Base unit, e.g.
Definition meta.h:841
ecs_entity_t over
Over unit, e.g.
Definition meta.h:844
const char * symbol
Unit symbol, e.g.
Definition meta.h:835
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:855
ecs_entity_t quantity
Unit quantity, e.g.
Definition meta.h:838
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition meta.h:847
ecs_entity_t entity
Existing entity to associate with unit (optional)
Definition meta.h:832
Used with ecs_unit_prefix_init.
Definition meta.h:865
ecs_entity_t entity
Existing entity to associate with unit prefix (optional)
Definition meta.h:867
const char * symbol
Unit symbol, e.g.
Definition meta.h:870
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition meta.h:873
int32_t power
Power to apply to factor (e.g.
Definition meta.h:437
int32_t factor
Factor to apply (e.g.
Definition meta.h:436
Used with ecs_vector_init.
Definition meta.h:776
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:777