ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
adtf_system.h
Go to the documentation of this file.
1
7#pragma once
9
11#define SESSION_MANAGER_DEFAULT_NAME "session_manager.system.adtf"
13#define LOGGING_DEFAULT_NAME "logging.system.adtf"
15#define RPC_OBJECT_REGISTRY_DEFAULT_NAME "rpc_object_server_registry.system.adtf"
17#define SAMPLE_STREAM_TRACER_DEFAULT_NAME "sample_stream_tracer.system.adtf"
19#define MACRO_RESOLVER_DEFAULT_NAME "macro_resolver.system.adtf"
20
21namespace adtf
22{
23namespace system
24{
25namespace ant
26{
27
31class cADTFSystem final
32{
35
36protected:
38 cADTFSystem(const cADTFSystem&) = delete;
45
46public:
51
62 void EnableSessionManagerCreation(bool bEnable = true);
63
73 void EnableLogging(bool bEnable = true);
74
85 void EnableRPCObjectRegistry(bool bEnable = true);
86
96 void EnableMacroResolver(bool bEnable = true);
97
106 void EnableProfiler(bool bEnable = true, unsigned int nPort = 28077, const char* strDumpFile = nullptr);
107
117 void EnableSampleStreamTracer(bool bEnable = true);
118
128 void EnableAutoQuit(bool bEnable = true, base::tADTFRunLevel eLevel = base::tADTFRunLevel::RL_Running);
129
139 void SetSessionManagerCID(const util::cString& strSessionManagerCID);
140
147 void SetADTFDIR(const util::cFilename& strADTFDIR);
148
156 void SetADTFCorePlugin(const util::cFilename& strCorePluginPath);
157
169 void SetLoggingParameter(unsigned int nStdOutLogLevel,
170 unsigned int nStdErrLogLevel,
171 unsigned int nDebugLogLevel,
172 tTimeStamp tmQueueProcessingInterval);
173
187 void SetLoggingParameter(unsigned int nStdOutMinLogLevel,
188 unsigned int nStdOutMaxLogLevel,
189 unsigned int nStdErrMinLogLevel,
190 unsigned int nStdErrMaxLogLevel,
191 unsigned int nDebugMinLogLevel,
192 unsigned int nDebugMaxLogLevel,
193 tTimeStamp tmQueueProcessingInterval);
194
200 void SetAdditionalInitFunction(std::function<tResult()> fnInitFunction);
201
211 void SetRPCURL(const util::cString& strRPCUrl);
212
221
232 tResult Launch(const adtf::util::cCommandLine& oCommandLine);
233
253 tResult Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine& oCommandLine, std::function<void()> fnStartup);
262 tResult Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine& oCommandLine, std::function<void()> fnStartup, bool bContinueInCaseOfError);
263
274 const adtf::util::cCommandLine& oCommandLine,
275 std::function<void()> fnStartup, bool bContinueInCaseOfError);
276};
277
278}
279
280using ant::cADTFSystem;
281
282namespace testing
283{
284namespace ant
285{
286
297tResult create_adtf_default_system(const adtf::util::cFilename& strCorePlugin = adtf::util::cFilename(),
298 bool bLogging = false,
299 const adtf::util::cString& strRPCURL = adtf::util::cString(),
300 bool bProfiler = false,
301 unsigned int nProfilingPort = 28077);
302
303template<typename T>
305
306} // ant
307
309using ant::system_executor;
310
311} // testing
312} // system
313
314namespace ucom
315{
316namespace testing
317{
318namespace ant
319{
320
321template<>
322class exec_forward<adtf::system::ant::cADTFSystem>
323{
324 private:
325 std::unique_ptr<adtf::system::ant::cADTFSystem> m_pSystem;
326
327 public:
328 exec_forward():
329 m_pSystem(new adtf::system::ant::cADTFSystem())
330 {
331 tResult nLaunchResult = m_pSystem->Launch(adtf::util::cCommandLine());
332 A_UTILS_ASSERT(nLaunchResult.IsOk());
333 }
334
335 ~exec_forward()
336 {
337 if (m_pSystem)
338 {
339 _runtime->SetRunLevel(adtf::base::ant::tADTFRunLevel::RL_Shutdown, true);
340 }
341 }
342
343 tResult Exec(std::function<void()> fnStartup)
344 {
345 return m_pSystem->Exec(adtf::base::ant::tADTFRunLevel::RL_System,
346 adtf::util::cCommandLine(),
347 fnStartup);
348 }
349};
350
351} //ant
352} //testing
353} //ucom
354} //adtf
#define A_UTILS_ASSERT
This macro is used for platform independent assertion expressions.
Copyright © Audi Electronics Venture GmbH.
tResult create_adtf_default_system(const adtf::util::cFilename &strCorePlugin=adtf::util::cFilename(), bool bLogging=false, const adtf::util::cString &strRPCURL=adtf::util::cString(), bool bProfiler=false, unsigned int nProfilingPort=28077)
This helper function will add the ADTF core objects to an existing _runtime.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
tADTFMicroRunLevel
Micro Runlevels offer more fine grained control to initialization etc.
ADTF System Creation Class.
Definition adtf_system.h:32
cADTFSystem(const cADTFSystem &)=delete
copy CTOR
void SetLoggingParameter(unsigned int nStdOutLogLevel, unsigned int nStdErrLogLevel, unsigned int nDebugLogLevel, tTimeStamp tmQueueProcessingInterval)
Sets the logging parameter of the Logging serive These core objects define the ADTF System.
void EnableSampleStreamTracer(bool bEnable=true)
Enables the sample stream tracer core object creation.
tResult Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine &oCommandLine, std::function< void()> fnStartup, bool bContinueInCaseOfError)
cADTFSystem & operator=(cADTFSystem &&)=delete
move operator
void SetADTFCorePlugin(const util::cFilename &strCorePluginPath)
Sets the path to the adtf_core.plugin which contains the the core objects implementations.
void SetSessionManagerCID(const util::cString &strSessionManagerCID)
Sets the class id used for creation of the session manager core object (EnableSessionManagerCreation)...
void SetLoggingParameter(unsigned int nStdOutMinLogLevel, unsigned int nStdOutMaxLogLevel, unsigned int nStdErrMinLogLevel, unsigned int nStdErrMaxLogLevel, unsigned int nDebugMinLogLevel, unsigned int nDebugMaxLogLevel, tTimeStamp tmQueueProcessingInterval)
Sets the log levels that are output via a specific channel.
void EnableLogging(bool bEnable=true)
Enables the logging core object creation.
tResult Launch(const adtf::util::cCommandLine &oCommandLine)
Launches the system and create a adtf::base::ant::cADTFRuntime.
void EnableRPCObjectRegistry(bool bEnable=true)
Enables the rpc object registry core object creation.
cADTFSystem & operator=(const cADTFSystem &)=delete
copy operator
tResult Launch(adtf::ucom::ant::IRuntime &oRuntime)
Launches the system and its core objects to an existing runtime.
void EnableProfiler(bool bEnable=true, unsigned int nPort=28077, const char *strDumpFile=nullptr)
Enables the profiler.
void EnableAutoQuit(bool bEnable=true, base::tADTFRunLevel eLevel=base::tADTFRunLevel::RL_Running)
Enables to shutdown automatically if the given runlevel is left by decrementing.
void EnableMacroResolver(bool bEnable=true)
Enables macro resolver core object creation.
void SetRPCURL(const util::cString &strRPCUrl)
Sets the URL for the rpc object registry core object.
cADTFSystem(cADTFSystem &&)=delete
move CTOR
void EnableSessionManagerCreation(bool bEnable=true)
Enables the session manager core object creation.
void SetAdditionalInitFunction(std::function< tResult()> fnInitFunction)
Adds an additional Initialization function that is called right atfer the logging has been set up.
void SetADTFDIR(const util::cFilename &strADTFDIR)
Sets the environment variable ADTF_DIR.
tResult ExecMicro(adtf::base::quiet::IADTFRuntime::tADTFMicroRunLevel nFirstMicroRunLevel, const adtf::util::cCommandLine &oCommandLine, std::function< void()> fnStartup, bool bContinueInCaseOfError)
tResult Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine &oCommandLine, std::function< void()> fnStartup)
Launches the system and create a adtf::base::ant::cADTFRuntime.
The IRuntime interface controls global system startup and shutdown.
This template makes sure to create and execute an instance of a runtime in a separate thread.
tADTFRunLevel
The ADTF Runtime Level State are used to define a ADTF Runtime specialization for a adtf::ucom::ant::...
@ RL_Shutdown
The system is shut down.
@ RL_System
The system level.
Namespace for all functionality of the ADTF System SDK provided since v3.0.
Namespace for all testing functionality of the ADTF System SDK.
Namespace for the ADTF Testing SDK.
Namespace for the ADTF uCOM3 SDK.
Namespace for entire ADTF SDK.