2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP
10 #include <babeltrace2/babeltrace.h>
12 #include "cpp-common/bt2c/c-string-view.hpp"
14 #include "borrowed-object.hpp"
18 class SelfComponentClass final : public BorrowedObject<bt_self_component_class>
21 explicit SelfComponentClass(const LibObjPtr libObjPtr) noexcept :
22 _ThisBorrowedObject {libObjPtr}
26 explicit SelfComponentClass(bt_self_component_class_source * const libObjPtr) noexcept :
27 _ThisBorrowedObject {bt_self_component_class_source_as_self_component_class(libObjPtr)}
31 explicit SelfComponentClass(bt_self_component_class_filter * const libObjPtr) noexcept :
32 _ThisBorrowedObject {bt_self_component_class_filter_as_self_component_class(libObjPtr)}
36 explicit SelfComponentClass(bt_self_component_class_sink * const libObjPtr) noexcept :
37 _ThisBorrowedObject {bt_self_component_class_sink_as_self_component_class(libObjPtr)}
41 bt2c::CStringView name() const noexcept
43 return bt_component_class_get_name(this->_libCompClsPtr());
46 bt2c::CStringView description() const noexcept
48 return bt_component_class_get_description(this->_libCompClsPtr());
51 bt2c::CStringView help() const noexcept
53 return bt_component_class_get_help(this->_libCompClsPtr());
57 const bt_component_class *_libCompClsPtr() const noexcept
59 return bt_self_component_class_as_component_class(this->libObjPtr());
65 #endif /* BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_CLASS_HPP */