cpp-common/bt2: make `bt2::BorrowedObject::LibObj` public
[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 "borrowed-object.hpp"
13
14 namespace bt2 {
15
16 class SelfComponentClass final : public BorrowedObject<bt_self_component_class>
17 {
18 public:
19 explicit SelfComponentClass(const LibObjPtr libObjPtr) noexcept :
20 _ThisBorrowedObject {libObjPtr}
21 {
22 }
23
24 explicit SelfComponentClass(bt_self_component_class_source * const libObjPtr) noexcept :
25 _ThisBorrowedObject {bt_self_component_class_source_as_self_component_class(libObjPtr)}
26 {
27 }
28
29 explicit SelfComponentClass(bt_self_component_class_filter * const libObjPtr) noexcept :
30 _ThisBorrowedObject {bt_self_component_class_filter_as_self_component_class(libObjPtr)}
31 {
32 }
33
34 explicit SelfComponentClass(bt_self_component_class_sink * const libObjPtr) noexcept :
35 _ThisBorrowedObject {bt_self_component_class_sink_as_self_component_class(libObjPtr)}
36 {
37 }
38
39 const char *name() const noexcept
40 {
41 return bt_component_class_get_name(this->_libCompClsPtr());
42 }
43
44 const char *description() const noexcept
45 {
46 return bt_component_class_get_description(this->_libCompClsPtr());
47 }
48
49 const char *help() const noexcept
50 {
51 return bt_component_class_get_help(this->_libCompClsPtr());
52 }
53
54 private:
55 const bt_component_class *_libCompClsPtr() const noexcept
56 {
57 return bt_self_component_class_as_component_class(this->libObjPtr());
58 }
59 };
60
61 } /* namespace bt2 */
62
63 #endif /* BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP */
This page took 0.031196 seconds and 4 git commands to generate.