tests/lib: pass C++ wrapper types to `RunIn` callbacks
[babeltrace.git] / tests / lib / utils / run-in.hpp
CommitLineData
484a3024
SM
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Copyright (C) 2020-2023 EfficiOS, inc.
5 */
6
7#ifndef TESTS_LIB_UTILS_H
8#define TESTS_LIB_UTILS_H
9
484a3024
SM
10#include <functional>
11
c802cacb
SM
12#include <babeltrace2/babeltrace.h>
13
5d15e4ca
SM
14#include "cpp-common/bt2/self-component-class.hpp"
15#include "cpp-common/bt2/self-component-port.hpp"
16#include "cpp-common/bt2/self-message-iterator.hpp"
17
18using RunInCompClsQueryFunc = std::function<void(bt2::SelfComponentClass)>;
19using RunInCompClsInitFunc = std::function<void(bt2::SelfComponent)>;
20using RunInMsgIterClsInitFunc = std::function<void(bt2::SelfMessageIterator)>;
484a3024
SM
21
22/*
23 * Runs:
24 *
25 * • `compClsCtxFunc` in the context of a component class method,
26 * if not `nullptr`.
27 *
28 * • `compCtxFunc` in the context of a component method, if not
29 * `nullptr`.
30 *
31 * • `msgIterCtxFunc` in the context of a message iterator method, if
32 * not `nullptr`.
33 */
34void runIn(RunInCompClsQueryFunc compClsCtxFunc, RunInCompClsInitFunc compCtxFunc,
35 RunInMsgIterClsInitFunc msgIterCtxFunc);
36
37/*
38 * Runs `func` in the context of a component class method.
39 */
40void runInCompClsQuery(RunInCompClsQueryFunc func);
41
42/*
43 * Runs `func` in the context of a component method.
44 */
45void runInCompClsInit(RunInCompClsInitFunc func);
46
47/*
48 * Runs `func` in the context of a message iterator method.
49 */
50void runInMsgIterClsInit(RunInMsgIterClsInitFunc func);
51
52#endif /* TESTS_LIB_UTILS_H */
This page took 0.032276 seconds and 4 git commands to generate.