19 world.
entity<metrics::Instance>(
"::flecs::metrics::Instance");
20 world.
entity<metrics::Metric>(
"::flecs::metrics::Metric");
21 world.
entity<metrics::Counter>(
"::flecs::metrics::Metric::Counter");
22 world.
entity<metrics::CounterId>(
"::flecs::metrics::Metric::CounterId");
23 world.
entity<metrics::CounterIncrement>(
"::flecs::metrics::Metric::CounterIncrement");
24 world.
entity<metrics::Gauge>(
"::flecs::metrics::Metric::Gauge");
27inline metric_builder::~metric_builder() {
33inline metric_builder& metric_builder::member(
const char *name) {
48inline metric_builder& metric_builder::member(
const char *name) {
50 flecs::entity_t m = e.
lookup(name);
53 name, e.path().c_str());
59inline metric_builder& metric_builder::dotmember(
const char *expr) {
60 desc_.dotmember = expr;
65inline metric_builder& metric_builder::dotmember(
const char *expr) {
66 desc_.dotmember = expr;
67 desc_.
id = _::type<T>::id(world_);
75 desc_.entity = result;
82template <
typename... Args>
88template <
typename Kind>
89inline untyped_component& untyped_component::metric(
90 flecs::entity_t parent,
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);
112 metric_entity = w.
scope(
parent).entity(snake_name);
113 ecs_os_free(snake_name);
116 metric_entity = w.
scope(
parent).entity(metric_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 metric.
flecs::entity import()
Import a module.
flecs::component< T > component(Args &&... args) const
Find or register component.
flecs::entity entity(Args &&... args) const
Create an entity.
void err(const char *fmt,...)
Trace (level -3)
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
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.
ecs_id_t id
Tracks whether entities have the specified component id.
const Self & scope(const Func &func) const
The function will be ran with the scope set to the current entity.
flecs::string_view name() const
Return the entity name.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
flecs::entity parent() const
Get parent of entity.
flecs::entity lookup(const char *name, const char *sep="::", const char *root_sep="::", bool recursive=true) const
Lookup entity by name.