2 * SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2020-2023 EfficiOS, inc.
7 #ifndef TESTS_LIB_UTILS_H
8 #define TESTS_LIB_UTILS_H
12 #include <babeltrace2/babeltrace.h>
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"
18 using RunInCompClsQueryFunc = std::function<void(bt2::SelfComponentClass)>;
19 using RunInCompClsInitFunc = std::function<void(bt2::SelfComponent)>;
20 using RunInMsgIterClsInitFunc = std::function<void(bt2::SelfMessageIterator)>;
25 * • `compClsCtxFunc` in the context of a component class method,
28 * • `compCtxFunc` in the context of a component method, if not
31 * • `msgIterCtxFunc` in the context of a message iterator method, if
34 void runIn(RunInCompClsQueryFunc compClsCtxFunc, RunInCompClsInitFunc compCtxFunc,
35 RunInMsgIterClsInitFunc msgIterCtxFunc);
38 * Runs `func` in the context of a component class method.
40 void runInCompClsQuery(RunInCompClsQueryFunc func);
43 * Runs `func` in the context of a component method.
45 void runInCompClsInit(RunInCompClsInitFunc func);
48 * Runs `func` in the context of a message iterator method.
50 void runInMsgIterClsInit(RunInMsgIterClsInitFunc func);
52 #endif /* TESTS_LIB_UTILS_H */