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);
139FLECS_API extern const ecs_entity_t ecs_id(ecs_id_t);
140
142typedef enum ecs_type_kind_t {
143 EcsPrimitiveType,
144 EcsBitmaskType,
145 EcsEnumType,
146 EcsStructType,
147 EcsArrayType,
148 EcsVectorType,
149 EcsOpaqueType,
150 EcsTypeKindLast = EcsOpaqueType
152
154typedef struct EcsMetaType {
155 ecs_type_kind_t kind;
156 bool existing;
157 bool partial;
159
162 EcsBool = 1,
163 EcsChar,
164 EcsByte,
165 EcsU8,
166 EcsU16,
167 EcsU32,
168 EcsU64,
169 EcsI8,
170 EcsI16,
171 EcsI32,
172 EcsI64,
173 EcsF32,
174 EcsF64,
175 EcsUPtr,
176 EcsIPtr,
177 EcsString,
178 EcsEntity,
179 EcsId,
180 EcsPrimitiveKindLast = EcsId
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_id)(
401 void *dst,
402 ecs_world_t *world,
403 ecs_id_t id);
404
406 void (*assign_null)(
407 void *dst);
408
410 void (*clear)(
411 void *dst);
412
414 void* (*ensure_element)(
415 void *dst,
416 size_t elem);
417
419 void* (*ensure_member)(
420 void *dst,
421 const char *member);
422
424 size_t (*count)(
425 const void *dst);
426
428 void (*resize)(
429 void *dst,
430 size_t count);
431} EcsOpaque;
432
433
434/* Units */
435
436/* Helper type to describe translation between two units. Note that this
437 * is not intended as a generic approach to unit conversions (e.g. from celsius
438 * to fahrenheit) but to translate between units that derive from the same base
439 * (e.g. meters to kilometers).
440 *
441 * Note that power is applied to the factor. When describing a translation of
442 * 1000, either use {factor = 1000, power = 1} or {factor = 1, power = 3}. */
444 int32_t factor;
445 int32_t power;
447
448typedef struct EcsUnit {
449 char *symbol;
454} EcsUnit;
455
456typedef struct EcsUnitPrefix {
457 char *symbol;
460
461
462/* Serializer utilities */
463
465 EcsOpArray,
466 EcsOpVector,
467 EcsOpOpaque,
468 EcsOpPush,
469 EcsOpPop,
470
473 EcsOpEnum,
474 EcsOpBitmask,
475
478 EcsOpBool,
479 EcsOpChar,
480 EcsOpByte,
481 EcsOpU8,
482 EcsOpU16,
483 EcsOpU32,
484 EcsOpU64,
485 EcsOpI8,
486 EcsOpI16,
487 EcsOpI32,
488 EcsOpI64,
489 EcsOpF32,
490 EcsOpF64,
491 EcsOpUPtr,
492 EcsOpIPtr,
493 EcsOpString,
494 EcsOpEntity,
495 EcsOpId,
496 EcsMetaTypeOpKindLast = EcsOpId
498
499typedef struct ecs_meta_type_op_t {
501 ecs_size_t offset;
502 int32_t count;
503 const char *name;
504 int32_t op_count;
505 ecs_size_t size;
507 int32_t member_index;
508 ecs_hashmap_t *members;
510
511typedef struct EcsMetaTypeSerialized {
512 ecs_vec_t ops;
514
515
516/* Deserializer utilities */
517
518#define ECS_META_MAX_SCOPE_DEPTH (32) /* >32 levels of nesting is not sane */
519
520typedef struct ecs_meta_scope_t {
523 int32_t op_count;
524 int32_t op_cur;
525 int32_t elem_cur;
526 int32_t prev_depth;
527 void *ptr;
531 ecs_vec_t *vector;
532 ecs_hashmap_t *members;
537
539typedef struct ecs_meta_cursor_t {
540 const ecs_world_t *world;
541 ecs_meta_scope_t scope[ECS_META_MAX_SCOPE_DEPTH];
542 int32_t depth;
543 bool valid;
546 /* Custom entity lookup action for overriding default ecs_lookup_fullpath */
547 ecs_entity_t (*lookup_action)(const ecs_world_t*, const char*, void*);
548 void *lookup_ctx;
550
551FLECS_API
552ecs_meta_cursor_t ecs_meta_cursor(
553 const ecs_world_t *world,
554 ecs_entity_t type,
555 void *ptr);
556
558FLECS_API
560 ecs_meta_cursor_t *cursor);
561
563FLECS_API
565 ecs_meta_cursor_t *cursor);
566
568FLECS_API
570 ecs_meta_cursor_t *cursor,
571 int32_t elem);
572
574FLECS_API
576 ecs_meta_cursor_t *cursor,
577 const char *name);
578
580FLECS_API
582 ecs_meta_cursor_t *cursor,
583 const char *name);
584
586FLECS_API
588 ecs_meta_cursor_t *cursor);
589
591FLECS_API
593 ecs_meta_cursor_t *cursor);
594
596FLECS_API
598 const ecs_meta_cursor_t *cursor);
599
601FLECS_API
603 const ecs_meta_cursor_t *cursor);
604
606FLECS_API
608 const ecs_meta_cursor_t *cursor);
609
611FLECS_API
613 const ecs_meta_cursor_t *cursor);
614
616FLECS_API
618 const ecs_meta_cursor_t *cursor);
619
620/* The set functions assign the field with the specified value. If the value
621 * does not have the same type as the field, it will be cased to the field type.
622 * If no valid conversion is available, the operation will fail. */
623
625FLECS_API
627 ecs_meta_cursor_t *cursor,
628 bool value);
629
631FLECS_API
633 ecs_meta_cursor_t *cursor,
634 char value);
635
637FLECS_API
639 ecs_meta_cursor_t *cursor,
640 int64_t value);
641
643FLECS_API
645 ecs_meta_cursor_t *cursor,
646 uint64_t value);
647
649FLECS_API
651 ecs_meta_cursor_t *cursor,
652 double value);
653
655FLECS_API
657 ecs_meta_cursor_t *cursor,
658 const char *value);
659
661FLECS_API
663 ecs_meta_cursor_t *cursor,
664 const char *value);
665
667FLECS_API
669 ecs_meta_cursor_t *cursor,
670 ecs_entity_t value);
671
673FLECS_API
675 ecs_meta_cursor_t *cursor,
676 ecs_id_t value);
677
679FLECS_API
681 ecs_meta_cursor_t *cursor,
682 ecs_id_t value);
683
685FLECS_API
687 ecs_meta_cursor_t *cursor);
688
690FLECS_API
692 ecs_meta_cursor_t *cursor,
693 const ecs_value_t *value);
694
695/* Functions for getting members. */
696
698FLECS_API
700 const ecs_meta_cursor_t *cursor);
701
703FLECS_API
705 const ecs_meta_cursor_t *cursor);
706
708FLECS_API
710 const ecs_meta_cursor_t *cursor);
711
713FLECS_API
715 const ecs_meta_cursor_t *cursor);
716
718FLECS_API
720 const ecs_meta_cursor_t *cursor);
721
726FLECS_API
728 const ecs_meta_cursor_t *cursor);
729
732FLECS_API
734 const ecs_meta_cursor_t *cursor);
735
739 const ecs_meta_cursor_t *cursor);
740
742FLECS_API
744 ecs_primitive_kind_t type_kind,
745 const void *ptr);
746
747/* API functions for creating meta types */
748
750typedef struct ecs_primitive_desc_t {
754
756FLECS_API
758 ecs_world_t *world,
759 const ecs_primitive_desc_t *desc);
760
762typedef struct ecs_enum_desc_t {
764 ecs_enum_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
766
768FLECS_API
770 ecs_world_t *world,
771 const ecs_enum_desc_t *desc);
772
773
775typedef struct ecs_bitmask_desc_t {
777 ecs_bitmask_constant_t constants[ECS_MEMBER_DESC_CACHE_SIZE];
779
781FLECS_API
783 ecs_world_t *world,
784 const ecs_bitmask_desc_t *desc);
785
786
788typedef struct ecs_array_desc_t {
790 ecs_entity_t type;
791 int32_t count;
793
795FLECS_API
797 ecs_world_t *world,
798 const ecs_array_desc_t *desc);
799
800
802typedef struct ecs_vector_desc_t {
804 ecs_entity_t type;
806
808FLECS_API
810 ecs_world_t *world,
811 const ecs_vector_desc_t *desc);
812
813
815typedef struct ecs_struct_desc_t {
817 ecs_member_t members[ECS_MEMBER_DESC_CACHE_SIZE];
819
821FLECS_API
823 ecs_world_t *world,
824 const ecs_struct_desc_t *desc);
825
827typedef struct ecs_opaque_desc_t {
828 ecs_entity_t entity;
829 EcsOpaque type;
831
850FLECS_API
852 ecs_world_t *world,
853 const ecs_opaque_desc_t *desc);
854
856typedef struct ecs_unit_desc_t {
859
861 const char *symbol;
862
865
868
871
874
883
885FLECS_API
887 ecs_world_t *world,
888 const ecs_unit_desc_t *desc);
889
894
896 const char *symbol;
897
901
903FLECS_API
905 ecs_world_t *world,
906 const ecs_unit_prefix_desc_t *desc);
907
909FLECS_API
911 ecs_world_t *world,
912 const ecs_entity_desc_t *desc);
913
914/* Convenience macros */
915
916#define ecs_primitive(world, ...)\
917 ecs_primitive_init(world, &(ecs_primitive_desc_t) __VA_ARGS__ )
918
919#define ecs_enum(world, ...)\
920 ecs_enum_init(world, &(ecs_enum_desc_t) __VA_ARGS__ )
921
922#define ecs_bitmask(world, ...)\
923 ecs_bitmask_init(world, &(ecs_bitmask_desc_t) __VA_ARGS__ )
924
925#define ecs_array(world, ...)\
926 ecs_array_init(world, &(ecs_array_desc_t) __VA_ARGS__ )
927
928#define ecs_vector(world, ...)\
929 ecs_vector_init(world, &(ecs_vector_desc_t) __VA_ARGS__ )
930
931#define ecs_opaque(world, ...)\
932 ecs_opaque_init(world, &(ecs_opaque_desc_t) __VA_ARGS__ )
933
934#define ecs_struct(world, ...)\
935 ecs_struct_init(world, &(ecs_struct_desc_t) __VA_ARGS__ )
936
937#define ecs_unit(world, ...)\
938 ecs_unit_init(world, &(ecs_unit_desc_t) __VA_ARGS__ )
939
940#define ecs_unit_prefix(world, ...)\
941 ecs_unit_prefix_init(world, &(ecs_unit_prefix_desc_t) __VA_ARGS__ )
942
943#define ecs_quantity(world, ...)\
944 ecs_quantity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
945
946/* Module import */
947FLECS_API
948void FlecsMetaImport(
949 ecs_world_t *world);
950
951#ifdef __cplusplus
952}
953#endif
954
955#endif
956
959#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.
ecs_id_t ecs_meta_get_id(const ecs_meta_cursor_t *cursor)
Get field value as (component) id.
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 int ecs_meta_set_id(ecs_meta_cursor_t *cursor, ecs_id_t value)
Set field with (component) id value.
FLECS_API int ecs_meta_set_component(ecs_meta_cursor_t *cursor, ecs_id_t value)
Set field with (component) id value.
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:161
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:464
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:142
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:476
@ EcsOpScope
Marks last constant that can open/close a scope.
Definition: meta.h:471
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
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition: flecs.h:281
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:1266
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:512
Component that is automatically added to every type with the right kind.
Definition: meta.h:154
bool partial
Is the reflection data a partial type description.
Definition: meta.h:157
bool existing
Did the type exist or is it populated from reflection.
Definition: meta.h:156
size_t(* count)(const void *dst)
Return number of elements.
Definition: meta.h:424
void(* assign_null)(void *dst)
Assign null value.
Definition: meta.h:406
void(* clear)(void *dst)
Clear collection elements.
Definition: meta.h:410
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:428
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
void(* assign_id)(void *dst, ecs_world_t *world, ecs_id_t id)
Assign (component) id value.
Definition: meta.h:400
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:458
char * symbol
Symbol of prefix (e.g.
Definition: meta.h:457
Definition: meta.h:448
ecs_unit_translation_t translation
Translation for derived unit.
Definition: meta.h:453
ecs_entity_t prefix
Order of magnitude prefix relative to derived.
Definition: meta.h:450
ecs_entity_t base
Base unit (e.g.
Definition: meta.h:451
ecs_entity_t over
Over unit (e.g.
Definition: meta.h:452
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:788
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:789
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:775
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:776
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: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:762
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:763
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:539
bool is_primitive_scope
If in root scope, this allows for a push for primitive types.
Definition: meta.h:544
const EcsOpaque * opaque
Opaque type interface.
Definition: meta.h:530
int32_t prev_depth
Depth to restore, in case dotmember was used.
Definition: meta.h:526
const EcsComponent * comp
Pointer to component, in case size/alignment is needed.
Definition: meta.h:529
void * ptr
Pointer to the value being iterated.
Definition: meta.h:527
bool is_empty_scope
Was scope populated (for collections)
Definition: meta.h:535
ecs_vec_t * vector
Current vector, in case a vector is iterated.
Definition: meta.h:531
int32_t elem_cur
Current element (for collections)
Definition: meta.h:525
int32_t op_cur
Current operation.
Definition: meta.h:524
bool is_inline_array
Is the scope iterating an inline array?
Definition: meta.h:534
ecs_hashmap_t * members
string -> member index
Definition: meta.h:532
ecs_meta_type_op_t * ops
The type operations (see ecs_meta_type_op_t)
Definition: meta.h:522
int32_t op_count
Number of operations in ops array to process.
Definition: meta.h:523
ecs_entity_t type
The type being iterated.
Definition: meta.h:521
bool is_collection
Is the scope iterating elements?
Definition: meta.h:533
ecs_entity_t type
Type entity.
Definition: meta.h:506
ecs_size_t size
Size of type of operation.
Definition: meta.h:505
ecs_size_t offset
Offset of current field.
Definition: meta.h:501
const char * name
Name of value (only used for struct members)
Definition: meta.h:503
int32_t member_index
Index of member in struct.
Definition: meta.h:507
ecs_hashmap_t * members
string -> member index (structs only)
Definition: meta.h:508
int32_t op_count
Number of operations until next field or end.
Definition: meta.h:504
Used with ecs_opaque_init.
Definition: meta.h:827
Used with ecs_primitive_init.
Definition: meta.h:750
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:751
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:815
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:816
Used with ecs_unit_init.
Definition: meta.h:856
ecs_entity_t base
Base unit, e.g.
Definition: meta.h:867
ecs_entity_t over
Over unit, e.g.
Definition: meta.h:870
const char * symbol
Unit symbol, e.g.
Definition: meta.h:861
ecs_entity_t prefix
Prefix indicating order of magnitude relative to the derived unit.
Definition: meta.h:881
ecs_entity_t quantity
Unit quantity, e.g.
Definition: meta.h:864
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition: meta.h:873
ecs_entity_t entity
Existing entity to associate with unit (optional)
Definition: meta.h:858
Used with ecs_unit_prefix_init.
Definition: meta.h:891
ecs_entity_t entity
Existing entity to associate with unit prefix (optional)
Definition: meta.h:893
const char * symbol
Unit symbol, e.g.
Definition: meta.h:896
ecs_unit_translation_t translation
Translation to apply to derived unit (optional)
Definition: meta.h:899
int32_t power
Power to apply to factor (e.g.
Definition: meta.h:445
int32_t factor
Factor to apply (e.g.
Definition: meta.h:444
Used with ecs_vector_init.
Definition: meta.h:802
ecs_entity_t entity
Existing entity to use for type (optional)
Definition: meta.h:803