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;
157 ecs_size_t size;
158 ecs_size_t alignment;
160
163 EcsBool = 1,
164 EcsChar,
165 EcsByte,
166 EcsU8,
167 EcsU16,
168 EcsU32,
169 EcsU64,
170 EcsI8,
171 EcsI16,
172 EcsI32,
173 EcsI64,
174 EcsF32,
175 EcsF64,
176 EcsUPtr,
177 EcsIPtr,
178 EcsString,
179 EcsEntity,
180 EcsPrimitiveKindLast = EcsEntity
182
184typedef struct EcsPrimitive {
187
189typedef struct EcsMember {
190 ecs_entity_t type;
191 int32_t count;
192 ecs_entity_t unit;
193 int32_t offset;
195
198 double min;
199 double max;
201
203typedef struct EcsMemberRanges {
208
210typedef struct ecs_member_t {
212 const char *name;
213 ecs_entity_t type;
214
216 int32_t count;
217 int32_t offset;
218
222
227
231
235
237 ecs_size_t size;
238 ecs_entity_t member;
240
242typedef struct EcsStruct {
244 ecs_vec_t members; /* vector<ecs_member_t> */
246
247typedef struct ecs_enum_constant_t {
249 const char *name;
250
252 int32_t value;
253
257
259typedef struct EcsEnum {
261 ecs_map_t constants; /* map<i32_t, ecs_enum_constant_t> */
263
266 const char *name;
267
269 ecs_flags32_t value;
270
274
276typedef struct EcsBitmask {
277 /* Populated from child entities with Constant component */
278 ecs_map_t constants; /* map<u32_t, ecs_bitmask_constant_t> */
280
282typedef struct EcsArray {
284 int32_t count;
286
288typedef struct EcsVector {
291
292
293/* Opaque type support */
294
295#if !defined(__cplusplus) || !defined(FLECS_CPP)
296
298typedef struct ecs_serializer_t {
299 /* Serialize value */
300 int (*value)(
301 const struct ecs_serializer_t *ser,
302 ecs_entity_t type,
303 const void *value);
305 /* Serialize member */
306 int (*member)(
307 const struct ecs_serializer_t *ser,
308 const char *member);
310 const ecs_world_t *world;
311 void *ctx;
313
314#elif defined(__cplusplus)
315
316} /* extern "C" { */
317
319typedef struct ecs_serializer_t {
320 /* Serialize value */
321 int (*value_)(
322 const struct ecs_serializer_t *ser,
323 ecs_entity_t type,
324 const void *value);
325
326 /* Serialize member */
327 int (*member_)(
328 const struct ecs_serializer_t *ser,
329 const char *name);
330
331 /* Serialize value */
332 int value(ecs_entity_t type, const void *value) const;
333
334 /* Serialize value */
335 template <typename T>
336 int value(const T& value) const;
337
338 /* Serialize member */
339 int member(const char *name) const;
340
341 const ecs_world_t *world;
342 void *ctx;
344
345extern "C" {
346#endif
347
349typedef int (*ecs_meta_serialize_t)(
350 const ecs_serializer_t *ser,
351 const void *src);
353typedef struct EcsOpaque {
357 /* Deserializer interface
358 * Only override the callbacks that are valid for the opaque type. If a
359 * deserializer attempts to assign a value type that is not supported by the
360 * interface, a conversion error is thrown.
361 */
362
364 void (*assign_bool)(
365 void *dst,
366 bool value);
367
369 void (*assign_char)(
370 void *dst,
371 char value);
372
374 void (*assign_int)(
375 void *dst,
376 int64_t value);
377
379 void (*assign_uint)(
380 void *dst,
381 uint64_t value);
382
385 void *dst,
386 double value);
387
390 void *dst,
391 const char *value);
392
395 void *dst,
396 ecs_world_t *world,
397 ecs_entity_t entity);
398
400 void (*assign_null)(
401 void *dst);
402
404 void (*clear)(
405 void *dst);
406
408 void* (*ensure_element)(
409 void *dst,
410 size_t elem);
411
413 void* (*ensure_member)(
414 void *dst,
415 const char *member);
416
418 size_t (*count)(
419 const void *dst);
420
422 void (*resize)(
423 void *dst,
424 size_t count);
425} EcsOpaque;
426
427
428/* Units */
429
430/* Helper type to describe translation between two units. Note that this
431 * is not intended as a generic approach to unit conversions (e.g. from celsius
432 * to fahrenheit) but to translate between units that derive from the same base
433 * (e.g. meters to kilometers).
434 *
435 * Note that power is applied to the factor. When describing a translation of
436 * 1000, either use {factor = 1000, power = 1} or {factor = 1, power = 3}. */
438 int32_t factor;
439 int32_t power;
441
442typedef struct EcsUnit {
443 char *symbol;
448} EcsUnit;
449
450typedef struct EcsUnitPrefix {
451 char *symbol;
454
455
456/* Serializer utilities */
457
459 EcsOpArray,
460 EcsOpVector,
461 EcsOpOpaque,
462 EcsOpPush,
463 EcsOpPop,
464
467 EcsOpEnum,
468 EcsOpBitmask,
469
472 EcsOpBool,
473 EcsOpChar,
474 EcsOpByte,
475 EcsOpU8,
476 EcsOpU16,
477 EcsOpU32,
478 EcsOpU64,
479 EcsOpI8,
480 EcsOpI16,
481 EcsOpI32,
482 EcsOpI64,
483 EcsOpF32,
484 EcsOpF64,
485 EcsOpUPtr,
486 EcsOpIPtr,
487 EcsOpString,
488 EcsOpEntity,
489 EcsMetaTypeOpKindLast = EcsOpEntity
491
492typedef struct ecs_meta_type_op_t {
494 ecs_size_t offset;
495 int32_t count;
496 const char *name;
497 int32_t op_count;
498 ecs_size_t size;
500 int32_t member_index;
501 ecs_hashmap_t *members;
503
504typedef struct EcsMetaTypeSerialized {
505 ecs_vec_t ops;
507
508
509/* Deserializer utilities */
510
511#define ECS_META_MAX_SCOPE_DEPTH (32) /* >32 levels of nesting is not sane */
512
513typedef struct ecs_meta_scope_t {
516 int32_t op_count;
517 int32_t op_cur;
518 int32_t elem_cur;
519 int32_t prev_depth;
520 void *ptr;
524 ecs_vec_t *vector;
525 ecs_hashmap_t *members;
530
532typedef struct ecs_meta_cursor_t {
533 const ecs_world_t *world;
534 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
535 int32_t depth;
536 bool valid;
539 /* Custom entity lookup action for overriding default ecs_lookup_fullpath */
540 ecs_entity_t (*lookup_action)(const ecs_world_t*, const char*, void*);
541 void *lookup_ctx;
543
544FLECS_API
545ecs_meta_cursor_t ecs_meta_cursor(
546 const ecs_world_t *world,
547 ecs_entity_t type,
548 void *ptr);
549
551FLECS_API
553 ecs_meta_cursor_t *cursor);
554
556FLECS_API
558 ecs_meta_cursor_t *cursor);
559
561FLECS_API
563 ecs_meta_cursor_t *cursor,
564 int32_t elem);
565
567FLECS_API
569 ecs_meta_cursor_t *cursor,
570 const char *name);
571
573FLECS_API
575 ecs_meta_cursor_t *cursor,
576 const char *name);
577
579FLECS_API
581 ecs_meta_cursor_t *cursor);
582
584FLECS_API
586 ecs_meta_cursor_t *cursor);
587
589FLECS_API
591 const ecs_meta_cursor_t *cursor);
592
594FLECS_API
596 const ecs_meta_cursor_t *cursor);
597
599FLECS_API
601 const ecs_meta_cursor_t *cursor);
602
604FLECS_API
606 const ecs_meta_cursor_t *cursor);
607
608/* The set functions assign the field with the specified value. If the value
609 * does not have the same type as the field, it will be cased to the field type.
610 * If no valid conversion is available, the operation will fail. */
611
613FLECS_API
615 ecs_meta_cursor_t *cursor,
616 bool value);
617
619FLECS_API
621 ecs_meta_cursor_t *cursor,
622 char value);
623
625FLECS_API
627 ecs_meta_cursor_t *cursor,
628 int64_t value);
629
631FLECS_API
633 ecs_meta_cursor_t *cursor,
634 uint64_t value);
635
637FLECS_API
639 ecs_meta_cursor_t *cursor,
640 double value);
641
643FLECS_API
645 ecs_meta_cursor_t *cursor,
646 const char *value);
647
649FLECS_API
651 ecs_meta_cursor_t *cursor,
652 const char *value);
653
655FLECS_API
657 ecs_meta_cursor_t *cursor,
658 ecs_entity_t value);
659
661FLECS_API
663 ecs_meta_cursor_t *cursor);
664
666FLECS_API
668 ecs_meta_cursor_t *cursor,
669 const ecs_value_t *value);
670
671/* Functions for getting members. */
672
674FLECS_API
676 const ecs_meta_cursor_t *cursor);
677
679FLECS_API
681 const ecs_meta_cursor_t *cursor);
682
684FLECS_API
686 const ecs_meta_cursor_t *cursor);
687
689FLECS_API
691 const ecs_meta_cursor_t *cursor);
692
694FLECS_API
696 const ecs_meta_cursor_t *cursor);
697
702FLECS_API
704 const ecs_meta_cursor_t *cursor);
705
708FLECS_API
710 const ecs_meta_cursor_t *cursor);
711
713FLECS_API
715 ecs_primitive_kind_t type_kind,
716 const void *ptr);
717
718/* API functions for creating meta types */
719
721typedef struct ecs_primitive_desc_t {
725
727FLECS_API
729 ecs_world_t *world,
730 const ecs_primitive_desc_t *desc);
731
733typedef struct ecs_enum_desc_t {
735 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
737
739FLECS_API
741 ecs_world_t *world,
742 const ecs_enum_desc_t *desc);
743
744
746typedef struct ecs_bitmask_desc_t {
748 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
750
752FLECS_API
754 ecs_world_t *world,
755 const ecs_bitmask_desc_t *desc);
756
757
759typedef struct ecs_array_desc_t {
761 ecs_entity_t type;
762 int32_t count;
764
766FLECS_API
768 ecs_world_t *world,
769 const ecs_array_desc_t *desc);
770
771
773typedef struct ecs_vector_desc_t {
775 ecs_entity_t type;
777
779FLECS_API
781 ecs_world_t *world,
782 const ecs_vector_desc_t *desc);
783
784
786typedef struct ecs_struct_desc_t {
788 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
790
792FLECS_API
794 ecs_world_t *world,
795 const ecs_struct_desc_t *desc);
796
798typedef struct ecs_opaque_desc_t {
799 ecs_entity_t entity;
800 EcsOpaque type;
802
821FLECS_API
823 ecs_world_t *world,
824 const ecs_opaque_desc_t *desc);
825
827typedef struct ecs_unit_desc_t {
830
832 const char *symbol;
833
836
839
842
845
854
856FLECS_API
858 ecs_world_t *world,
859 const ecs_unit_desc_t *desc);
860
865
867 const char *symbol;
868
872
874FLECS_API
876 ecs_world_t *world,
877 const ecs_unit_prefix_desc_t *desc);
878
880FLECS_API
882 ecs_world_t *world,
883 const ecs_entity_desc_t *desc);
884
885/* Convenience macros */
886
887#define ecs_primitive(world, ...)\
888 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
889
890#define ecs_enum(world, ...)\
891 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
892
893#define ecs_bitmask(world, ...)\
894 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
895
896#define ecs_array(world, ...)\
897 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
898
899#define ecs_vector(world, ...)\
900 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
901
902#define ecs_opaque(world, ...)\
903 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
904
905#define ecs_struct(world, ...)\
906 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
907
908#define ecs_unit(world, ...)\
909 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
910
911#define ecs_unit_prefix(world, ...)\
912 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
913
914#define ecs_quantity(world, ...)\
915 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
916
917/* Module import */
918FLECS_API
919void FlecsMetaImport(
920 ecs_world_t *world);
921
922#ifdef __cplusplus
923}
924#endif
925
926#endif
927
930#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:162
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:458
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:349
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:470
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition meta.h:465
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:282
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:291
Component added to array type entities.
Definition meta.h:282
int32_t count
Number of elements.
Definition meta.h:284
ecs_entity_t type
Element type.
Definition meta.h:283
Component added to bitmask type entities.
Definition meta.h:276
Component information.
Definition flecs.h:1094
Component added to enum type entities.
Definition meta.h:259
ecs_map_t constants
Populated from child entities with Constant component.
Definition meta.h:261
Component added to member entities to express valid value ranges.
Definition meta.h:203
Component added to member entities.
Definition meta.h:189
ecs_vec_t ops
vector<ecs_meta_type_op_t>
Definition meta.h:505
Component that is automatically added to every type with the right kind.
Definition meta.h:153
ecs_size_t alignment
Computed alignment.
Definition meta.h:158
bool partial
Is the reflection data a partial type description.
Definition meta.h:156
ecs_size_t size
Computed size.
Definition meta.h:157
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:418
void(* assign_null)(void *dst)
Assign null value.
Definition meta.h:400
void(* clear)(void *dst)
Clear collection elements.
Definition meta.h:404
void(* assign_uint)(void *dst, uint64_t value)
Assign unsigned int value.
Definition meta.h:379
ecs_meta_serialize_t serialize
Serialize action.
Definition meta.h:355
void(* assign_char)(void *dst, char value)
Assign char value.
Definition meta.h:369
ecs_entity_t as_type
Type that describes the serialized output.
Definition meta.h:354
void(* assign_bool)(void *dst, bool value)
Assign bool value.
Definition meta.h:364
void(* assign_string)(void *dst, const char *value)
Assign string value.
Definition meta.h:389
void(* resize)(void *dst, size_t count)
Resize to number of elements.
Definition meta.h:422
void(* assign_int)(void *dst, int64_t value)
Assign int value.
Definition meta.h:374
void(* assign_float)(void *dst, double value)
Assign float value.
Definition meta.h:384
void(* assign_entity)(void *dst, ecs_world_t *world, ecs_entity_t entity)
Assign entity value.
Definition meta.h:394
Component added to primitive types.
Definition meta.h:184
Component added to struct type entities.
Definition meta.h:242
ecs_vec_t members
Populated from child entities with Member component.
Definition meta.h:244
ecs_unit_translation_t translation
Translation of prefix.
Definition meta.h:452
char * symbol
Symbol of prefix (e.g.
Definition meta.h:451
ecs_unit_translation_t translation
Translation for derived unit.
Definition meta.h:447
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition meta.h:444
ecs_entity_t base
Base unit (e.g.
Definition meta.h:445
ecs_entity_t over
Over unit (e.g.
Definition meta.h:446
Component added to vector type entities.
Definition meta.h:288
ecs_entity_t type
Element type.
Definition meta.h:289
Used with ecs_array_init.
Definition meta.h:759
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:760
ecs_entity_t constant
Should not be set by ecs_bitmask_desc_t.
Definition meta.h:272
ecs_flags32_t value
May be set when used with ecs_bitmask_desc_t.
Definition meta.h:269
const char * name
Must be set when used with ecs_bitmask_desc_t.
Definition meta.h:266
Used with ecs_bitmask_init.
Definition meta.h:746
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:747
Used with ecs_entity_init.
Definition flecs.h:763
ecs_entity_t constant
Should not be set by ecs_enum_desc_t.
Definition meta.h:255
int32_t value
May be set when used with ecs_enum_desc_t.
Definition meta.h:252
const char * name
Must be set when used with ecs_enum_desc_t.
Definition meta.h:249
Used with ecs_enum_init.
Definition meta.h:733
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:734
Element type of members vector in EcsStruct.
Definition meta.h:210
ecs_member_value_range_t warning_range
Numerical range outside of which the value represents an warning.
Definition meta.h:234
const char * name
Must be set when used with ecs_struct_desc_t.
Definition meta.h:212
ecs_size_t size
Should not be set by ecs_struct_desc_t.
Definition meta.h:237
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:221
ecs_member_value_range_t range
Numerical range that specifies which values member can assume.
Definition meta.h:226
int32_t count
May be set when used with ecs_struct_desc_t.
Definition meta.h:216
ecs_member_value_range_t error_range
Numerical range outside of which the value represents an error.
Definition meta.h:230
Type expressing a range for a member value.
Definition meta.h:197
Type that enables iterating/populating a value using reflection data.
Definition meta.h:532
bool is_primitive_scope
If in root scope, this allows for a push for primitive types.
Definition meta.h:537
const EcsOpaque * opaque
Opaque type interface.
Definition meta.h:523
int32_t prev_depth
Depth to restore, in case dotmember was used.
Definition meta.h:519
const EcsComponent * comp
Pointer to component, in case size/alignment is needed.
Definition meta.h:522
void * ptr
Pointer to the value being iterated.
Definition meta.h:520
bool is_empty_scope
Was scope populated (for collections)
Definition meta.h:528
ecs_vec_t * vector
Current vector, in case a vector is iterated.
Definition meta.h:524
int32_t elem_cur
Current element (for collections)
Definition meta.h:518
int32_t op_cur
Current operation.
Definition meta.h:517
bool is_inline_array
Is the scope iterating an inline array?
Definition meta.h:527
ecs_hashmap_t * members
string -> member index
Definition meta.h:525
ecs_meta_type_op_t * ops
The type operations (see ecs_meta_type_op_t)
Definition meta.h:515
int32_t op_count
Number of operations in ops array to process.
Definition meta.h:516
ecs_entity_t type
The type being iterated.
Definition meta.h:514
bool is_collection
Is the scope iterating elements?
Definition meta.h:526
ecs_entity_t type
Type entity.
Definition meta.h:499
ecs_size_t size
Size of type of operation.
Definition meta.h:498
ecs_size_t offset
Offset of current field.
Definition meta.h:494
const char * name
Name of value (only used for struct members)
Definition meta.h:496
int32_t member_index
Index of member in struct.
Definition meta.h:500
ecs_hashmap_t * members
string -> member index (structs only)
Definition meta.h:501
int32_t op_count
Number of operations until next field or end.
Definition meta.h:497
Used with ecs_opaque_init.
Definition meta.h:798
Used with ecs_primitive_init.
Definition meta.h:721
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:722
Serializer interface.
Definition meta.h:298
int(* value)(const struct ecs_serializer_t *ser, ecs_entity_t type, const void *value)
Pointer to the value to serialize.
Definition meta.h:300
int(* member)(const struct ecs_serializer_t *ser, const char *member)
Member name.
Definition meta.h:306
Used with ecs_struct_init.
Definition meta.h:786
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:787
Used with ecs_unit_init.
Definition meta.h:827
ecs_entity_t base
Base unit, e.g.
Definition meta.h:838
ecs_entity_t over
Over unit, e.g.
Definition meta.h:841
const char * symbol
Unit symbol, e.g.
Definition meta.h:832
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition meta.h:852
ecs_entity_t quantity
Unit quantity, e.g.
Definition meta.h:835
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition meta.h:844
ecs_entity_t entity
Existing entity to associate with unit (optional)
Definition meta.h:829
Used with ecs_unit_prefix_init.
Definition meta.h:862
ecs_entity_t entity
Existing entity to associate with unit prefix (optional)
Definition meta.h:864
const char * symbol
Unit symbol, e.g.
Definition meta.h:867
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition meta.h:870
int32_t power
Power to apply to factor (e.g.
Definition meta.h:439
int32_t factor
Factor to apply (e.g.
Definition meta.h:438
Used with ecs_vector_init.
Definition meta.h:773
ecs_entity_t entity
Existing entity to use for type (optional)
Definition meta.h:774