cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / cpp-common / bt2 / plugin-set.hpp
1 /*
2 * Copyright (c) 2024 EfficiOS, Inc.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP
9
10 #include <cstdint>
11
12 #include <babeltrace2/babeltrace.h>
13
14 #include "borrowed-object.hpp"
15 #include "shared-object.hpp"
16
17 namespace bt2 {
18 namespace internal {
19
20 struct PluginSetRefFuncs
21 {
22 static void get(const bt_plugin_set * const libObjPtr) noexcept
23 {
24 bt_plugin_set_get_ref(libObjPtr);
25 }
26
27 static void put(const bt_plugin_set * const libObjPtr) noexcept
28 {
29 bt_plugin_set_put_ref(libObjPtr);
30 }
31 };
32
33 } /* namespace internal */
34
35 class ConstPluginSet final : public BorrowedObject<const bt_plugin_set>
36 {
37 public:
38 using Shared = SharedObject<ConstPluginSet, const bt_plugin_set, internal::PluginSetRefFuncs>;
39
40 explicit ConstPluginSet(const bt_plugin_set * const plugin_set) :
41 _ThisBorrowedObject {plugin_set}
42 {
43 }
44
45 std::uint64_t length() const noexcept
46 {
47 return bt_plugin_set_get_plugin_count(this->libObjPtr());
48 }
49 };
50
51 } /* namespace bt2 */
52
53 #endif /* BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP */
This page took 0.029583 seconds and 4 git commands to generate.