cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / cpp-common / bt2 / self-component-class.hpp
1 /*
2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP
9
10 #include <babeltrace2/babeltrace.h>
11
12 #include "cpp-common/bt2c/c-string-view.hpp"
13
14 #include "borrowed-object.hpp"
15
16 namespace bt2 {
17
18 class SelfComponentClass final : public BorrowedObject<bt_self_component_class>
19 {
20 public:
21 explicit SelfComponentClass(const LibObjPtr libObjPtr) noexcept :
22 _ThisBorrowedObject {libObjPtr}
23 {
24 }
25
26 explicit SelfComponentClass(bt_self_component_class_source * const libObjPtr) noexcept :
27 _ThisBorrowedObject {bt_self_component_class_source_as_self_component_class(libObjPtr)}
28 {
29 }
30
31 explicit SelfComponentClass(bt_self_component_class_filter * const libObjPtr) noexcept :
32 _ThisBorrowedObject {bt_self_component_class_filter_as_self_component_class(libObjPtr)}
33 {
34 }
35
36 explicit SelfComponentClass(bt_self_component_class_sink * const libObjPtr) noexcept :
37 _ThisBorrowedObject {bt_self_component_class_sink_as_self_component_class(libObjPtr)}
38 {
39 }
40
41 bt2c::CStringView name() const noexcept
42 {
43 return bt_component_class_get_name(this->_libCompClsPtr());
44 }
45
46 bt2c::CStringView description() const noexcept
47 {
48 return bt_component_class_get_description(this->_libCompClsPtr());
49 }
50
51 bt2c::CStringView help() const noexcept
52 {
53 return bt_component_class_get_help(this->_libCompClsPtr());
54 }
55
56 private:
57 const bt_component_class *_libCompClsPtr() const noexcept
58 {
59 return bt_self_component_class_as_component_class(this->libObjPtr());
60 }
61 };
62
63 } /* namespace bt2 */
64
65 #endif /* BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP */
This page took 0.032753 seconds and 4 git commands to generate.