sessiond: generate packet header, packet context and event header dynamically
[lttng-tools.git] / src / bin / lttng-sessiond / stream-class.hpp
1 /*
2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef LTTNG_STREAM_CLASS_H
9 #define LTTNG_STREAM_CLASS_H
10
11 #include "field.hpp"
12
13 #include <vendor/optional.hpp>
14
15 #include <vector>
16
17 namespace lttng {
18 namespace sessiond {
19 namespace trace {
20
21 class trace_class_visitor;
22
23 class stream_class {
24 public:
25 enum class header_type { COMPACT, LARGE };
26
27 /*
28 * Derived classes must implement _accept_on_event_classes()
29 * to continue the traversal to the stream class' event classes.
30 */
31 void accept(trace_class_visitor& visitor) const;
32 virtual ~stream_class() = default;
33
34 virtual const type* get_packet_context() const;
35 virtual const type* get_event_header() const;
36 virtual const type* get_event_context() const;
37
38 const unsigned int id;
39 /*
40 * header_type is suffixed with '_' to work-around a bug in older
41 * GCCs (before 6) that do not recognize hidden/shadowed enumeration as valid
42 * nested-name-specifiers.
43 */
44 const header_type header_type_;
45 const nonstd::optional<std::string> default_clock_class_name;
46
47 protected:
48 stream_class(unsigned int id,
49 enum header_type header_type,
50 nonstd::optional<std::string> default_clock_class_name = nonstd::nullopt);
51 virtual void _accept_on_event_classes(trace_class_visitor& trace_class_visitor) const = 0;
52
53 lttng::sessiond::trace::type::cuptr _packet_context;
54 lttng::sessiond::trace::type::cuptr _event_header;
55 lttng::sessiond::trace::type::cuptr _event_context;
56 };
57
58 } /* namespace trace */
59 } /* namespace sessiond */
60 } /* namespace lttng */
61
62 #endif /* LTTNG_STREAM_CLASS_H */
This page took 0.031078 seconds and 5 git commands to generate.