cpp-common/bt2: use universal reference for `Graph::addComponent()` initialization...
[babeltrace.git] / src / cpp-common / bt2 / plugin-set.hpp
CommitLineData
4993dc41
SM
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
17namespace bt2 {
18namespace internal {
19
20struct 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
35class ConstPluginSet final : public BorrowedObject<const bt_plugin_set>
36{
37public:
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.025158 seconds and 4 git commands to generate.