Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
alerts.h
Go to the documentation of this file.
1
10#ifdef FLECS_ALERTS
11
20#ifndef FLECS_ALERTS_H
21#define FLECS_ALERTS_H
22
23#ifndef FLECS_PIPELINE
24#define FLECS_PIPELINE
25#endif
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
32#define ECS_ALERT_MAX_SEVERITY_FILTERS (4)
33
35FLECS_API extern ECS_COMPONENT_DECLARE(FlecsAlerts);
36
39FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlert);
42FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertTimeout);
45FLECS_API extern ECS_TAG_DECLARE(EcsAlertInfo);
46FLECS_API extern ECS_TAG_DECLARE(EcsAlertWarning);
47FLECS_API extern ECS_TAG_DECLARE(EcsAlertError);
48FLECS_API extern ECS_TAG_DECLARE(EcsAlertCritical);
54
56typedef struct EcsAlertsActive {
57 int32_t info_count;
58 int32_t warning_count;
59 int32_t error_count;
60 ecs_map_t alerts;
62
76
135
161FLECS_API
163 ecs_world_t *world,
164 const ecs_alert_desc_t *desc);
165
169#define ecs_alert(world, ...)\
170 ecs_alert_init(world, &(ecs_alert_desc_t)__VA_ARGS__)
171
183FLECS_API
185 const ecs_world_t *world,
186 ecs_entity_t entity,
187 ecs_entity_t alert);
188
198FLECS_API
200 const ecs_world_t *world,
201 ecs_entity_t entity,
202 ecs_entity_t alert);
203
212FLECS_API
214 ecs_world_t *world);
215
216#ifdef __cplusplus
217}
218#endif
219
220#endif
221
224#endif
struct EcsAlertsActive EcsAlertsActive
Map with active alerts for entity.
FLECS_API ecs_entity_t ecs_get_alert(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t alert)
Return alert instance for specified alert.
struct ecs_alert_severity_filter_t ecs_alert_severity_filter_t
Alert severity filter.
#define ECS_ALERT_MAX_SEVERITY_FILTERS
Maximum number of severity filters per alert.
Definition alerts.h:32
struct EcsAlertInstance EcsAlertInstance
Component added to alert instance.
FLECS_API void FlecsAlertsImport(ecs_world_t *world)
Alert module import function.
FLECS_API ecs_entity_t ecs_alert_init(ecs_world_t *world, const ecs_alert_desc_t *desc)
Create a new alert.
struct ecs_alert_desc_t ecs_alert_desc_t
Alert descriptor, used with ecs_alert_init().
FLECS_API int32_t ecs_get_alert_count(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t alert)
Return number of active alerts for entity.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:381
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:425
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
Definition flecs.h:374
#define ECS_TAG_DECLARE
Forward declare a tag.
Definition flecs_c.h:66
#define ECS_COMPONENT_DECLARE(id)
Forward declare a component.
Definition flecs_c.h:112
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
Component added to alert instance.
Definition alerts.h:51
char * message
Generated alert message.
Definition alerts.h:52
Map with active alerts for entity.
Definition alerts.h:56
int32_t error_count
Number of alerts for source with error severity.
Definition alerts.h:59
int32_t info_count
Number of alerts for source with info severity.
Definition alerts.h:57
ecs_map_t alerts
Map of active alerts for entity.
Definition alerts.h:60
int32_t warning_count
Number of alerts for source with warning severity.
Definition alerts.h:58
Alert descriptor, used with ecs_alert_init().
Definition alerts.h:78
ecs_alert_severity_filter_t severity_filters[(4)]
Severity filters can be used to assign different severities to the same alert.
Definition alerts.h:114
const char * brief
Description of alert.
Definition alerts.h:104
ecs_ftime_t retain_period
The retain period specifies how long an alert must be inactive before it is cleared.
Definition alerts.h:121
ecs_entity_t member
Alert when member value is out of range.
Definition alerts.h:125
ecs_id_t id
(Component) ID of member to monitor.
Definition alerts.h:129
ecs_entity_t entity
Entity associated with alert.
Definition alerts.h:82
ecs_entity_t severity
Alert severity.
Definition alerts.h:108
ecs_query_desc_t query
Alert query.
Definition alerts.h:87
const char * doc_name
User-friendly name.
Definition alerts.h:101
int32_t _canary
Used for validity testing.
Definition alerts.h:79
const char * message
Template for alert message.
Definition alerts.h:98
const char * var
Variable from which to fetch the member (optional).
Definition alerts.h:133
Alert severity filter.
Definition alerts.h:69
int32_t _var_index
Index of variable in query (do not set).
Definition alerts.h:74
const char * var
Variable to match component on.
Definition alerts.h:72
ecs_entity_t severity
Severity kind.
Definition alerts.h:70
ecs_id_t with
Component to match.
Definition alerts.h:71
Used with ecs_query_init().
Definition flecs.h:1275