75 desc_.entity = result;
82template <
typename... Args>
88template <
typename Kind>
89inline untyped_component& untyped_component::metric(
92 const char *metric_name)
105 const char *component_name = e.
name();
107 if (ecs_os_strcmp(m->
name,
"value") || !component_name) {
111 char *snake_name = flecs_to_snake_case(component_name);
113 ecs_os_free(snake_name);
120 w.metric(metric_entity).member(me).kind<Kind>().brief(brief);
FLECS_API ecs_entity_t ecs_metric_init(ecs_world_t *world, const ecs_metric_desc_t *desc)
Create a new metric.
FLECS_API void FlecsMetricsImport(ecs_world_t *world)
Metrics module import function.
flecs::metric_builder metric(Args &&... args) const
Create a metric.
flecs::entity import()
Import a module.
flecs::component< T > component(Args &&... args) const
Find or register a component.
flecs::entity entity(Args &&... args) const
Create an entity.
ecs_entity_t entity_t
Entity type.
void err(const char *fmt,...)
Error (level -3).
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t component)
Get the type for a component.
Component that stores metric source.
Component that stores metric value.
Element type of members vector in EcsStruct.
const char * name
Must be set when used with ecs_struct_desc_t.
ecs_entity_t member
Should not be set by ecs_struct_desc_t.
const char * dotmember
Member dot expression.
ecs_id_t id
Tracks whether entities have the specified component ID.
const Self & scope(const Func &func) const
The function will be run with the scope set to the current entity.
flecs::string_view name() const
Return the entity name.
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
flecs::entity parent() const
Get parent of entity.
entity()
Default constructor.
flecs::id_t id_
The raw ID value.
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
Metric builder interface.
~metric_builder()
Destructor.
metric_builder & dotmember(const char *name)
Set the member to use for the metric using dot notation.
metric_builder & member(flecs::entity_t e)
Set the member to use for the metric by entity ID.
Counter increment metric kind.
metrics(flecs::world &world)
Construct the metrics module.
const char * c_str() const
Return the C string.
world_t * world_
Pointer to the underlying C world.
flecs::entity lookup(const char *name, const char *sep="::", const char *root_sep="::", bool recursive=true) const
Lookup entity by name.