tests/lib: C++ify run-in and condition trigger code
Change the design of the "run in" test util.
Currently, the util exposes separate functions taking a function pointer
(for all contexts where it's possible to run code in),
Change it to a single function accepting a reference to an object of
type `RunIn`, a class with virtual methods corresponding to each
context. Clients are expected to define classes derived from `RunIn`
and override only the methods they need.
One advantage of this is that it allows a client to override multiple
methods in order to test a scenario that requires executing code in
multiple contexts. And it allows it to keep some data in the derived
class to use across the callbacks.
Adjust `tests/lib/conds/utils.{cpp,hpp}`, which is based on `RunIn`.
Replace the open struct `cond_trigger` with:
- a base class `CondTrigger`, with a virtual pure `operator()`.
- an implementation `SimpleCondTrigger`, which executes a simple
callback in `operator()`.
- an implementation `RunInCondTrigger`, which calls `runIn` in
`operator()`, with a user-provided `RunIn` object.
Update `conds-triggers.cpp`, which is based on `utils.{cpp,hpp}`.
Implement the condition triggers using the C++ bindings.
Do some more miscellaneous C++ification in `utils.cpp` and
`conds-triggers.cpp`.
Change-Id: I483dd1a49bc7fb1e1fc1b19e0fc01b97d4ea627f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11795
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.032777 seconds and 4 git commands to generate.