X-Git-Url: http://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Fbt2_plugins%2Futils.hpp;fp=tests%2Futils%2Fbt2_plugins%2Futils.hpp;h=fcf76371cacaad6a016986524ffe904111b932f8;hp=0000000000000000000000000000000000000000;hb=d73aeddd1b4de7fadc7b6f6f5004c6298208602a;hpb=74021af62434d042d27e010d62d6b6a0717f246b diff --git a/tests/utils/bt2_plugins/utils.hpp b/tests/utils/bt2_plugins/utils.hpp new file mode 100644 index 000000000..fcf76371c --- /dev/null +++ b/tests/utils/bt2_plugins/utils.hpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Jérémie Galarneau + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP +#define LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP + +#include + +#include + +namespace lttng { +namespace bt2 { +namespace internal { +static inline void bt_value_put_ref(bt_value *value) +{ + bt_value_put_ref(const_cast(value)); +} +} /* namespace internal */ + +using value_ref = std::unique_ptr< + bt_value, + lttng::memory::create_deleter_class::deleter>; + +using event_class_const_ref = std::unique_ptr< + const bt_event_class, + lttng::memory::create_deleter_class::deleter>; + +static inline value_ref make_value_ref(bt_value *instance) +{ + const memory::create_deleter_class unique_deleter; + return unique_deleter(instance); +} + +using message_const_ref = std::unique_ptr< + const bt_message, + lttng::memory::create_deleter_class::deleter>; + +using message_iterator_ref = + std::unique_ptr::deleter>; +} /* namespace bt2 */ +} /* namespace lttng */ + +#endif /* LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP */