File: utils.hpp

package info (click to toggle)
ltt-control 2.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,400 kB
  • sloc: cpp: 192,720; sh: 29,271; ansic: 10,960; python: 7,419; makefile: 3,534; java: 109; xml: 46
file content (49 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * SPDX-FileCopyrightText: 2024 Jérémie Galarneau <jeremie.galarneau@efficios.com>
 *
 * SPDX-License-Identifier: LGPL-2.1-only
 *
 */

#ifndef LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP
#define LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP

#include <common/make-unique-wrapper.hpp>

#include <babeltrace2/babeltrace.h>

namespace lttng {
namespace bt2 {
namespace internal {
static inline void bt_value_put_ref(bt_value *value)
{
	bt_value_put_ref(static_cast<const bt_value *>(value));
}
} /* namespace internal */

using value_ref = std::unique_ptr<
	bt_value,
	lttng::memory::create_deleter_class<bt_value, internal::bt_value_put_ref>::deleter>;

using event_class_const_ref = std::unique_ptr<
	const bt_event_class,
	lttng::memory::create_deleter_class<const bt_event_class, bt_event_class_put_ref>::deleter>;

static inline value_ref make_value_ref(bt_value *instance)
{
	const memory::create_deleter_class<bt_value, internal::bt_value_put_ref> unique_deleter;
	return unique_deleter(instance);
}

using message_const_ref = std::unique_ptr<
	const bt_message,
	lttng::memory::create_deleter_class<const bt_message, bt_message_put_ref>::deleter>;

using message_iterator_ref =
	std::unique_ptr<bt_message_iterator,
			lttng::memory::create_deleter_class<const bt_message_iterator,
							    bt_message_iterator_put_ref>::deleter>;
} /* namespace bt2 */
} /* namespace lttng */

#endif /* LTTNG_TEST_UTILS_BT2_PLUGIN_UTILS_HPP */