Commit | Line | Data |
---|---|---|
0220be14 JG |
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 | ||
24ed18f2 JG |
13 | #include <vendor/optional.hpp> |
14 | ||
0220be14 JG |
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; | |
9d89db29 JG |
33 | stream_class(const stream_class&) = delete; |
34 | stream_class(stream_class&&) = delete; | |
35 | stream_class& operator=(stream_class&&) = delete; | |
36 | stream_class& operator=(const stream_class&) = delete; | |
0220be14 | 37 | |
28f23191 JG |
38 | virtual const type *packet_context() const; |
39 | virtual const type *event_header() const; | |
40 | virtual const type *event_context() const; | |
0220be14 JG |
41 | |
42 | const unsigned int id; | |
65cd3c0c JG |
43 | /* |
44 | * header_type is suffixed with '_' to work-around a bug in older | |
45 | * GCCs (before 6) that do not recognize hidden/shadowed enumeration as valid | |
46 | * nested-name-specifiers. | |
47 | */ | |
48 | const header_type header_type_; | |
24ed18f2 | 49 | const nonstd::optional<std::string> default_clock_class_name; |
0220be14 JG |
50 | |
51 | protected: | |
24ed18f2 | 52 | stream_class(unsigned int id, |
28f23191 JG |
53 | enum header_type header_type, |
54 | nonstd::optional<std::string> default_clock_class_name = nonstd::nullopt); | |
0220be14 JG |
55 | virtual void _accept_on_event_classes(trace_class_visitor& trace_class_visitor) const = 0; |
56 | ||
24ed18f2 JG |
57 | lttng::sessiond::trace::type::cuptr _packet_context; |
58 | lttng::sessiond::trace::type::cuptr _event_header; | |
59 | lttng::sessiond::trace::type::cuptr _event_context; | |
0220be14 JG |
60 | }; |
61 | ||
62 | } /* namespace trace */ | |
63 | } /* namespace sessiond */ | |
64 | } /* namespace lttng */ | |
65 | ||
66 | #endif /* LTTNG_STREAM_CLASS_H */ |