Introduce event/type description visitor
[libside.git] / src / visit-description.h
... / ...
CommitLineData
1// SPDX-License-Identifier: MIT
2/*
3 * Copyright 2024 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 */
5
6#ifndef _VISIT_DESCRIPTION_H
7#define _VISIT_DESCRIPTION_H
8
9#include <side/trace.h>
10
11enum side_description_visitor_location {
12 SIDE_DESCRIPTION_VISITOR_BEFORE,
13 SIDE_DESCRIPTION_VISITOR_AFTER,
14};
15
16enum side_description_visitor_vla_location {
17 SIDE_DESCRIPTION_VISITOR_VLA_BEFORE,
18 SIDE_DESCRIPTION_VISITOR_VLA_AFTER_LENGTH,
19 SIDE_DESCRIPTION_VISITOR_VLA_AFTER_ELEMENT,
20};
21
22struct side_description_visitor {
23 void (*event_func)(enum side_description_visitor_location loc,
24 const struct side_event_description *desc,
25 void *priv);
26
27 void (*static_fields_func)(enum side_description_visitor_location loc,
28 const struct side_event_description *desc,
29 void *priv);
30
31 /* Stack-copy basic types. */
32 void (*field_func)(enum side_description_visitor_location loc, const struct side_event_field *item_desc, void *priv);
33 void (*elem_func)(enum side_description_visitor_location loc, const struct side_type *type_desc, void *priv);
34 void (*option_func)(enum side_description_visitor_location loc, const struct side_variant_option *option_desc, void *priv);
35
36 void (*null_type_func)(const struct side_type *type_desc, void *priv);
37 void (*bool_type_func)(const struct side_type *type_desc, void *priv);
38 void (*integer_type_func)(const struct side_type *type_desc, void *priv);
39 void (*byte_type_func)(const struct side_type *type_desc, void *priv);
40 void (*pointer_type_func)(const struct side_type *type_desc, void *priv);
41 void (*float_type_func)(const struct side_type *type_desc, void *priv);
42 void (*string_type_func)(const struct side_type *type_desc, void *priv);
43
44 /* Stack-copy compound types. */
45 void (*struct_type_func)(enum side_description_visitor_location loc, const struct side_type_struct *side_struct, void *priv);
46 void (*variant_type_func)(enum side_description_visitor_location loc, const struct side_type_variant *side_variant, void *priv);
47 void (*array_type_func)(enum side_description_visitor_location loc, const struct side_type_array *side_array, void *priv);
48 void (*vla_type_func)(enum side_description_visitor_vla_location loc, const struct side_type_vla *side_vla, void *priv);
49 void (*vla_visitor_type_func)(enum side_description_visitor_vla_location loc, const struct side_type_vla_visitor *side_vla_visitor, void *priv);
50
51 /* Stack-copy enumeration types. */
52 void (*enum_type_func)(enum side_description_visitor_location loc, const struct side_type *type_desc, void *priv);
53 void (*enum_bitmap_type_func)(enum side_description_visitor_location loc, const struct side_type *type_desc, void *priv);
54
55 /* Gather basic types. */
56 void (*gather_bool_type_func)(const struct side_type_gather_bool *type, void *priv);
57 void (*gather_byte_type_func)(const struct side_type_gather_byte *type, void *priv);
58 void (*gather_integer_type_func)(const struct side_type_gather_integer *type, void *priv);
59 void (*gather_pointer_type_func)(const struct side_type_gather_integer *type, void *priv);
60 void (*gather_float_type_func)(const struct side_type_gather_float *type, void *priv);
61 void (*gather_string_type_func)(const struct side_type_gather_string *type, void *priv);
62
63 /* Gather compound types. */
64 void (*gather_struct_type_func)(enum side_description_visitor_location loc, const struct side_type_gather_struct *type, void *priv);
65 void (*gather_array_type_func)(enum side_description_visitor_location loc, const struct side_type_gather_array *type, void *priv);
66 void (*gather_vla_type_func)(enum side_description_visitor_vla_location loc, const struct side_type_gather_vla *type, void *priv);
67
68 /* Gather enumeration types. */
69 void (*gather_enum_type_func)(enum side_description_visitor_location loc, const struct side_type_gather_enum *type, void *priv);
70
71 /* Dynamic types. */
72 void (*dynamic_type_func)(const struct side_type *type_desc, void *priv);
73};
74
75void description_visitor_event(const struct side_description_visitor *description_visitor,
76 const struct side_event_description *desc, void *priv);
77
78#endif /* _VISIT_DESCRIPTION_H */
This page took 0.025283 seconds and 4 git commands to generate.