Clean-up: tests: bt2 plug-ins: modernize the plug-ins
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 8 Mar 2024 21:18:29 +0000 (16:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Mar 2024 15:09:06 +0000 (11:09 -0400)
commitd73aeddd1b4de7fadc7b6f6f5004c6298208602a
treeae6b47741003a9fd8b1f602a2b6c11382236b395
parent74021af62434d042d27e010d62d6b6a0717f246b
Clean-up: tests: bt2 plug-ins: modernize the plug-ins

By virtue of their use of the C Babeltrace 2 APIs, the test plug-ins
perform a fair amount of manual resource management.

To make it possible to adopt a more modern C++ style in those plug-ins,
a number of helpers are introduced.

Introduce reference wrappers for the Babeltrace 2 interface:
  - value_ref: wraps a bt_value reference using std::unique_ptr
  - message_const_ref: wraps a constant message reference using a
    unique_ptr
  - message_iterator_ref: wraps a message iterator reference using a
    unique_ptr
  - event_class_const_ref: wraps a constant event class reference using
    a unique_ptr

A specialized random_access_container_wrapper is specialized to wrap
bt_value arrays of strings.

In doing so, it is possible to eliminate the use of gotos and manual
reference management on error paths. Some struct/classes are renamed to
eliminate ambiguities that arose over the refactoring.

The changes allow some simplifications of the code flow in places which
are applied directly.

Change-Id: I25c148d7970cb89add55a86f2c162973d3d27e4a
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/container-wrapper.hpp
tests/utils/bt2_plugins/Makefile.am
tests/utils/bt2_plugins/event_name/event_name.cpp
tests/utils/bt2_plugins/event_name/event_name.hpp
tests/utils/bt2_plugins/field_stats/field_stats.cpp
tests/utils/bt2_plugins/field_stats/field_stats.hpp
tests/utils/bt2_plugins/utils.hpp [new file with mode: 0644]
This page took 0.0262 seconds and 4 git commands to generate.