| 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 <vector> |
| 14 | |
| 15 | namespace lttng { |
| 16 | namespace sessiond { |
| 17 | namespace trace { |
| 18 | |
| 19 | class trace_class_visitor; |
| 20 | |
| 21 | class stream_class { |
| 22 | public: |
| 23 | enum class header_type { COMPACT, LARGE }; |
| 24 | |
| 25 | /* |
| 26 | * Derived classes must implement _accept_on_event_classes() |
| 27 | * to continue the traversal to the stream class' event classes. |
| 28 | */ |
| 29 | void accept(trace_class_visitor& visitor) const; |
| 30 | virtual ~stream_class() = default; |
| 31 | |
| 32 | virtual const lttng::sessiond::trace::type& get_context() const; |
| 33 | |
| 34 | const unsigned int id; |
| 35 | /* |
| 36 | * header_type is suffixed with '_' to work-around a bug in older |
| 37 | * GCCs (before 6) that do not recognize hidden/shadowed enumeration as valid |
| 38 | * nested-name-specifiers. |
| 39 | */ |
| 40 | const header_type header_type_; |
| 41 | |
| 42 | protected: |
| 43 | stream_class(unsigned int id, enum header_type header_type); |
| 44 | virtual void _accept_on_event_classes(trace_class_visitor& trace_class_visitor) const = 0; |
| 45 | |
| 46 | lttng::sessiond::trace::type::cuptr _context; |
| 47 | }; |
| 48 | |
| 49 | } /* namespace trace */ |
| 50 | } /* namespace sessiond */ |
| 51 | } /* namespace lttng */ |
| 52 | |
| 53 | #endif /* LTTNG_STREAM_CLASS_H */ |