cpp-common/bt2: add `bt2::PrivateQueryExecutor`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 8 Nov 2023 14:53:39 +0000 (09:53 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
A very straightforward wrapper of `bt_private_query_executor`.

There should exist an asConstQueryExecutor() method, but
`bt2::ConstQueryExecutor` doesn't exist yet as we don't need it to write
plugins. Therefore the loggingLevel() and isInterrupted() use
bt_private_query_executor_as_query_executor_const() internally.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I87c26e14afa4aa7937692aefa981213ad6a7f566
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11298
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/Makefile.am
src/cpp-common/bt2/private-query-executor.hpp [new file with mode: 0644]

index 6f8b3ee8eafb79668efa12790af45848047edcaa..bab36f829f8576a4c1a2019c6979464a258ea1ec 100644 (file)
@@ -31,6 +31,7 @@ noinst_HEADERS = \
        cpp-common/bt2/message.hpp \
        cpp-common/bt2/shared-object.hpp \
        cpp-common/bt2/raw-value-proxy.hpp \
+       cpp-common/bt2/private-query-executor.hpp \
        cpp-common/bt2/self-component-port.hpp \
        cpp-common/bt2/self-message-iterator-configuration.hpp \
        cpp-common/bt2/self-message-iterator.hpp \
diff --git a/src/cpp-common/bt2/private-query-executor.hpp b/src/cpp-common/bt2/private-query-executor.hpp
new file mode 100644 (file)
index 0000000..76f1f09
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef BABELTRACE_CPP_COMMON_BT2_PRIVATE_QUERY_EXECUTOR_HPP
+#define BABELTRACE_CPP_COMMON_BT2_PRIVATE_QUERY_EXECUTOR_HPP
+
+#include <babeltrace2/babeltrace.h>
+
+#include "logging.hpp"
+
+#include "borrowed-object.hpp"
+
+namespace bt2 {
+
+class PrivateQueryExecutor final : public BorrowedObject<bt_private_query_executor>
+{
+public:
+    explicit PrivateQueryExecutor(const _LibObjPtr libObjPtr) noexcept :
+        _ThisBorrowedObject {libObjPtr}
+    {
+    }
+
+    bt2::LoggingLevel loggingLevel() const noexcept
+    {
+        return static_cast<bt2::LoggingLevel>(bt_query_executor_get_logging_level(
+            bt_private_query_executor_as_query_executor_const(this->libObjPtr())));
+    }
+
+    bool isInterrupted() const noexcept
+    {
+        return static_cast<bool>(bt_query_executor_is_interrupted(
+            bt_private_query_executor_as_query_executor_const(this->libObjPtr())));
+    }
+};
+
+} /* namespace bt2 */
+
+#endif /* BABELTRACE_CPP_COMMON_BT2_PRIVATE_QUERY_EXECUTOR_HPP */
This page took 0.026481 seconds and 4 git commands to generate.