7#ifndef _ADTF_UCOM_ANT_TESTING_RUNTIME_INCLUDES_HEADER_
8#define _ADTF_UCOM_ANT_TESTING_RUNTIME_INCLUDES_HEADER_
50const adtf_util::cFilename
find_plugin(
const adtf::util::cString& strPluginName);
70const adtf_util::cFilename
load_plugin(
const adtf::util::cString& strPluginName, int8_t ui8Level);
78const adtf_util::cFilename
load_plugin(
const adtf::util::cString& strPluginName);
89void load_service(
const adtf_util::cString& strPluginName,
const adtf_util::cString& strClassId,
90 const adtf_util::cString& strObjectId,
92 int8_t nServiceLevel);
103void load_service(
const adtf_util::cString& strPluginName,
const adtf_util::cString& strClassId,
104 const adtf_util::cString& strObjectId,
105 int8_t nServiceLevel);
119 std::thread m_oThread;
120 std::mutex m_oActionMutex;
121 typedef std::function<void()> action_type;
122 action_type m_fnAction;
123 bool m_bQuitThread =
false;
124 std::condition_variable m_oNewAction;
129 m_oThread = std::thread([&]
131 std::unique_lock<std::mutex> oLocker(m_oActionMutex);
134 m_oNewAction.wait(oLocker, [&]
136 return m_fnAction || m_bQuitThread;
145 m_fnAction = action_type();
153 std::lock_guard<std::mutex> oLocker(m_oActionMutex);
154 m_bQuitThread =
true;
157 m_oNewAction.notify_one();
163 std::promise<tResult> oPromisedResult;
164 auto oResult = oPromisedResult.get_future();
167 std::lock_guard<std::mutex> oLocker(m_oActionMutex);
170 oPromisedResult.set_value(fnAction());
174 m_oNewAction.notify_one();
175 return oResult.get();
183template<
typename RuntimeClass>
187 std::unique_ptr<RuntimeClass> m_pRuntime;
191 m_pRuntime(
new RuntimeClass)
193 _runtime = m_pRuntime.get();
202 tResult Exec(std::function<
void()> fnStartup)
213template<
typename ExecuteForward>
217 std::unique_ptr<ExecuteForward> m_pExecuteForward;
218 std::thread m_oExecWaitThread;
223 if (m_oExecWaitThread.joinable())
225 m_oExecWaitThread.join();
231 return Execute([&]() ->
tResult
233 m_pExecuteForward.reset(
new ExecuteForward());
240 if (m_oExecWaitThread.joinable())
245 std::promise<tResult> oExecLoopStarted;
246 auto oStarted = oExecLoopStarted.get_future();
247 m_oExecWaitThread = std::thread([&]
251 auto nExecResult = m_pExecuteForward->Exec([&]
253 oExecLoopStarted.set_value(ERR_NOERROR);
258 oExecLoopStarted.set_value(nExecResult);
264 return oStarted.get();
#define IS_FAILED(s)
Check if result is failed.
Definition result.h:20
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
Definition result.h:42
@ RL_Shutdown
The system is shut down.
Definition runtime_intf.h:117
Definition runtime_intf.h:104
@ RL_Shutdown
The system is shut down.
Definition runtime_intf.h:117
Definition test_runtime.h:33
cTestRuntime()
CTOR.
Definition test_runtime.h:39
Definition test_runtime.h:185
Definition test_runtime.h:215
Namespace for all functionality of the ADTF UCOM SDK provided since v3.0.
Definition adtf_system.h:328
tTestRL
Definition test_runtime.h:22
void load_service(const adtf_util::cString &strPluginName, const adtf_util::cString &strClassId, const adtf_util::cString &strObjectId, int8_t nPluginLevel, int8_t nServiceLevel)
const adtf_util::cFilename find_plugin(const adtf::util::cString &strPluginName)
const adtf_util::cFilename load_plugin(const adtf::util::cString &strPluginName, int8_t ui8Level, ucom::ant::IRuntime &oRuntime)
Namespace for all provided testing functionality helper.
Definition adtf_system.h:326
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14