ADTF  3.14.3
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 
21 namespace adtf
22 {
23 namespace system
24 {
25 namespace ant
26 {
27 
31 class cADTFSystem final
32 {
35 
36 protected:
38  cADTFSystem(const cADTFSystem&) = delete;
40  cADTFSystem& operator=(const cADTFSystem&) = delete;
42  cADTFSystem(cADTFSystem&&) = delete;
45 
46 public:
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 
220  tResult Launch(adtf::ucom::ant::IRuntime& oRuntime);
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 };
264 
265 }
266 
267 using ant::cADTFSystem;
268 
269 namespace testing
270 {
271 namespace ant
272 {
273 
284 tResult create_adtf_default_system(const adtf::util::cFilename& strCorePlugin = adtf::util::cFilename(),
285  bool bLogging = false,
286  const adtf::util::cString& strRPCURL = adtf::util::cString(),
287  bool bProfiler = false,
288  unsigned int nProfilingPort = 28077);
289 
290 template<typename T>
292 
293 } // ant
294 
295 using ant::create_adtf_default_system;
297 
298 } // testing
299 } // system
300 
301 namespace ucom
302 {
303 namespace testing
304 {
305 namespace ant
306 {
307 
308 template<>
310 {
311  private:
312  std::unique_ptr<adtf::system::ant::cADTFSystem> m_pSystem;
313 
314  public:
315  exec_forward():
316  m_pSystem(new adtf::system::ant::cADTFSystem())
317  {
318  tResult nLaunchResult = m_pSystem->Launch(adtf::util::cCommandLine());
319  A_UTILS_ASSERT(nLaunchResult.IsOk());
320  }
321 
322  ~exec_forward()
323  {
324  if (m_pSystem)
325  {
326  _runtime->SetRunLevel(adtf::base::ant::tADTFRunLevel::RL_Shutdown, true);
327  }
328  }
329 
330  tResult Exec(std::function<void()> fnStartup)
331  {
332  return m_pSystem->Exec(adtf::base::ant::tADTFRunLevel::RL_System,
333  adtf::util::cCommandLine(),
334  fnStartup);
335  }
336 };
337 
338 } //ant
339 } //testing
340 } //ucom
341 } //adtf
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.
ADTF System Creation Class.
Definition: adtf_system.h:32
tResult Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine &oCommandLine, std::function< void()> fnStartup, bool bContinueInCaseOfError)
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.
void SetADTFCorePlugin(const util::cFilename &strCorePluginPath)
Sets the path to the adtf_core.plugin which contains the the core objects implementations.
cADTFSystem & operator=(cADTFSystem &&)=delete
move operator
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.
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 Exec(int8_t nFirstRunLevel, const adtf::util::cCommandLine &oCommandLine, std::function< void()> fnStartup)
Launches the system and create a adtf::base::ant::cADTFRuntime.
cADTFSystem & operator=(const cADTFSystem &)=delete
copy operator
The IRuntime interface controls global system startup and shutdown.
Definition: runtime_intf.h:111
virtual tResult SetRunLevel(int8_t nRunLevel, bool bWait=true)=0
Set run level.
This template makes will forward the runtime_executor function calls to the RuntimeClass.
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::...
Definition: adtf_runtime.h:23
Namespace for entire ADTF SDK.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)