cpp-common/bt2: move `ConstPluginSet` to `plugin-set.hpp`
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 16 Feb 2024 19:31:12 +0000 (14:31 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 29 Feb 2024 23:46:23 +0000 (18:46 -0500)
A subsequent patch will introduce `bt2::ConstPlugin`.  It makes more
sense to have `bt2::ConstPluginSet` in `plugin-set.hpp`.

Change-Id: I84996f34aec325eb2336335a73fdb5e857253c96
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11820
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/Makefile.am
src/cpp-common/bt2/plugin-set.hpp [new file with mode: 0644]
src/cpp-common/bt2/plugin.hpp
tests/lib/test-plugin-init-fail.cpp

index f9b2b3c3414eff5e64b94d46ce91b9d795bff556..873ccf8560a32058f3243393e294c3d6106b6232 100644 (file)
@@ -135,6 +135,7 @@ cpp_common_libcpp_common_la_SOURCES = \
        cpp-common/bt2/message.hpp \
        cpp-common/bt2/optional-borrowed-object.hpp \
        cpp-common/bt2/plugin-dev.hpp \
+       cpp-common/bt2/plugin-set.hpp \
        cpp-common/bt2/plugin.hpp \
        cpp-common/bt2/private-query-executor.hpp \
        cpp-common/bt2/query-executor.hpp \
diff --git a/src/cpp-common/bt2/plugin-set.hpp b/src/cpp-common/bt2/plugin-set.hpp
new file mode 100644 (file)
index 0000000..57ce92e
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2024 EfficiOS, Inc.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP
+#define BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP
+
+#include <cstdint>
+
+#include <babeltrace2/babeltrace.h>
+
+#include "borrowed-object.hpp"
+#include "shared-object.hpp"
+
+namespace bt2 {
+namespace internal {
+
+struct PluginSetRefFuncs
+{
+    static void get(const bt_plugin_set * const libObjPtr) noexcept
+    {
+        bt_plugin_set_get_ref(libObjPtr);
+    }
+
+    static void put(const bt_plugin_set * const libObjPtr) noexcept
+    {
+        bt_plugin_set_put_ref(libObjPtr);
+    }
+};
+
+} /* namespace internal */
+
+class ConstPluginSet final : public BorrowedObject<const bt_plugin_set>
+{
+public:
+    using Shared = SharedObject<ConstPluginSet, const bt_plugin_set, internal::PluginSetRefFuncs>;
+
+    explicit ConstPluginSet(const bt_plugin_set * const plugin_set) :
+        _ThisBorrowedObject {plugin_set}
+    {
+    }
+
+    std::uint64_t length() const noexcept
+    {
+        return bt_plugin_set_get_plugin_count(this->libObjPtr());
+    }
+};
+
+} /* namespace bt2 */
+
+#endif /* BABELTRACE_CPP_COMMON_BT2_PLUGIN_SET_HPP */
index 0a1c1c4648f17017855e21887eaf32a320c32454..6d1a71a67846eed409c91e5781f28783d1f19cec 100644 (file)
 #include <babeltrace2/babeltrace.h>
 
 #include "common/common.h"
-#include "cpp-common/bt2/borrowed-object.hpp"
-#include "cpp-common/bt2/exc.hpp"
-#include "cpp-common/bt2/shared-object.hpp"
 #include "cpp-common/bt2c/c-string-view.hpp"
 
-namespace bt2 {
-namespace internal {
-
-struct PluginSetRefFuncs
-{
-    static void get(const bt_plugin_set * const libObjPtr) noexcept
-    {
-        bt_plugin_set_get_ref(libObjPtr);
-    }
-
-    static void put(const bt_plugin_set * const libObjPtr) noexcept
-    {
-        bt_plugin_set_put_ref(libObjPtr);
-    }
-};
-
-} /* namespace internal */
+#include "exc.hpp"
+#include "plugin-set.hpp"
 
-class ConstPluginSet final : public BorrowedObject<const bt_plugin_set>
-{
-public:
-    using Shared = SharedObject<ConstPluginSet, const bt_plugin_set, internal::PluginSetRefFuncs>;
-
-    explicit ConstPluginSet(const bt_plugin_set * const plugin_set) :
-        _ThisBorrowedObject {plugin_set}
-    {
-    }
-
-    std::uint64_t length() const noexcept
-    {
-        return bt_plugin_set_get_plugin_count(this->libObjPtr());
-    }
-};
+namespace bt2 {
 
 inline ConstPluginSet::Shared findAllPluginsFromDir(const bt2c::CStringView path,
                                                     const bool recurse, const bool failOnLoadError)
index 8d8fd411a7177695bd5cfc9c022cc3106439ef85..8a0fde626734f76ac7bb620b28237b9ff4f928d5 100644 (file)
@@ -4,13 +4,13 @@
  * Copyright (C) 2024 EfficiOS, Inc.
  */
 
-#include <cpp-common/bt2/plugin.hpp>
-
-#include <cpp-common/vendor/fmt/format.h>
-
 #include <babeltrace2/babeltrace.h>
 
+#include "common/common.h"
+#include "cpp-common/bt2/exc.hpp"
+#include "cpp-common/bt2/plugin.hpp"
 #include "cpp-common/bt2c/c-string-view.hpp"
+#include "cpp-common/vendor/fmt/core.h"
 
 #include "tap/tap.h"
 
This page took 0.027491 seconds and 4 git commands to generate.