From e2a8620d29038f61c5f82c0252ba33aa3b06114b Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 8 Nov 2023 09:53:39 -0500 Subject: [PATCH] cpp-common/bt2: add `bt2::PrivateQueryExecutor` 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 Change-Id: I87c26e14afa4aa7937692aefa981213ad6a7f566 Reviewed-on: https://review.lttng.org/c/babeltrace/+/11298 CI-Build: Simon Marchi Tested-by: jenkins Reviewed-by: Simon Marchi --- src/Makefile.am | 1 + src/cpp-common/bt2/private-query-executor.hpp | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/cpp-common/bt2/private-query-executor.hpp diff --git a/src/Makefile.am b/src/Makefile.am index 6f8b3ee8..bab36f82 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index 00000000..76f1f09d --- /dev/null +++ b/src/cpp-common/bt2/private-query-executor.hpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023 Philippe Proulx + * + * SPDX-License-Identifier: MIT + */ + +#ifndef BABELTRACE_CPP_COMMON_BT2_PRIVATE_QUERY_EXECUTOR_HPP +#define BABELTRACE_CPP_COMMON_BT2_PRIVATE_QUERY_EXECUTOR_HPP + +#include + +#include "logging.hpp" + +#include "borrowed-object.hpp" + +namespace bt2 { + +class PrivateQueryExecutor final : public BorrowedObject +{ +public: + explicit PrivateQueryExecutor(const _LibObjPtr libObjPtr) noexcept : + _ThisBorrowedObject {libObjPtr} + { + } + + bt2::LoggingLevel loggingLevel() const noexcept + { + return static_cast(bt_query_executor_get_logging_level( + bt_private_query_executor_as_query_executor_const(this->libObjPtr()))); + } + + bool isInterrupted() const noexcept + { + return static_cast(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 */ -- 2.34.1