ADTF  3.18.2
runtime_intf.h
Go to the documentation of this file.
1 
7 #ifndef _ADTF_UCOM_ANT_RUNTIME_RUNTIME_HOOK_INTERFACE_INCLUDES_HEADER_
8 #define _ADTF_UCOM_ANT_RUNTIME_RUNTIME_HOOK_INTERFACE_INCLUDES_HEADER_
9 
10 #ifdef GetObject
11 #undef GetObject
12 #endif
13 
14 namespace adtf
15 {
16 namespace ucom
17 {
18 namespace ant
19 {
20 
75 class DOEXPORT IRuntimeHook
76 {
77  public:
83  typedef struct
84  {
85  uint32_t idHook;
86  uint32_t ui32Param1;
87  uint32_t ui32Param2;
88  void* pvData;
89  size_t szData;
90  } tHookInfo;
91 
92  public:
101  virtual tResult RuntimeHook(const tHookInfo& sHookInfo,
102  const iobject_ptr<IObject>& pObject) = 0;
103 };
104 
110 class DOEXPORT IRuntime : public IObject
111 {
112 public:
117  ADTF_IID(IRuntime, "runtime.ant.ucom.adtf.iid");
118 
119 public:
121  enum tRunLevel : int8_t
122  {
124  RL_Shutdown = 0,
125 
127  RL_Internal = 99
128  };
129 
131  enum tRuntimeHookId : uint32_t
132  {
135 
138 
141 
144 
151 
157 
163 
169 
176 
181 
188 
193 
198 
203 
208 
213 
217 
221 
225 
229 
233 
236  RHI_RunLevelDecrementing
237  };
238 
240  enum tChangeRunLevelFlags : uint32_t
241  {
243  CRLF_None = 0x0,
244 
246  CRLF_PreIncrementLevel = 0x1,
247 
249  CRLF_PostIncrementLevel = 0x2,
250 
252  CRLF_PreDecrementLevel = 0x4,
253 
255  CRLF_PostDecrementLevel = 0x8
256  } ;
257 
259  enum tUnregisterObjectFlags : uint32_t
260  {
262  UOF_None = 0x0,
263 
265  UOF_Manually = 0x1,
266 
268  UOF_Automatically = 0x2
269  };
270 
272  enum tObjectRegistryFlags : uint32_t
273  {
274  ORF_None = 0,
275  ORF_MarkedForDeletion = 0x1,
276  ORF_ServiceIsShutdown = 0x2,
277  ORF_RegisterOnChangingRL = 0x4
278  } ;
279 
281  enum tPluginFlags : uint8_t
282  {
283  PF_NONE = 0x0,
284  PF_UNMANAGED = 0x1,
287  PF_MARKEDFORDELETION = 0x2
288  } ;
289 
291  enum tClassRegistryFlags : uint32_t
292  {
294  CRF_None = 0x0,
295 
297  CRF_NoHookOnCreation = 0x1,
298 
300  CRF_FastCreation = 0x2,
301 
303  CRF_NoAutoDeregistration = 0x4
304  };
305 
306  public:
317  virtual tResult SetRunLevel(int8_t nRunLevel, bool bWait = true) = 0;
318 
324  virtual int8_t GetRunLevel() const = 0;
325 
336  uint32_t ui32Flags = 0) = 0;
337 
349 
357  virtual tResult GetClasses(iobject_enum<const IClassInfo>& lstOfClasses) const = 0;
358 
368  virtual tResult GetClassFactories(iobject_enum<const IClassFactory>& lstOfClassFactories) const = 0;
369 
383  const char* strNameOID,
384  int8_t nRunLevel,
385  uint32_t ui32Flags = 0) = 0;
386 
396  const tChar* strNameOID = "") = 0;
397 
407  virtual tResult GetObjects(iobject_enum<IObject>& lstOfObjects) const = 0;
408 
421  virtual tResult RegisterPlugin(const char* strUrl,
422  int8_t nRunLevel,
423  iobject_ptr<IPluginInfo>& pPluginInfo,
424  uint32_t ui32Flags = 0) = 0;
425 
435  virtual tResult UnregisterPlugin(const iobject_ptr<IPluginInfo>& pPluginInfo, uint32_t ui32Flags = 0) = 0;
436 
446  virtual tResult UnregisterAllPlugins(int8_t nRunLevel,
447  uint32_t ui32Flags=0) = 0;
448 
457  virtual tResult GetPlugins(iobject_enum<const IPluginInfo>& lstPluginInfos) const = 0;
458 
468  virtual tResult RegisterHook(IRuntimeHook& oHook) = 0;
469 
479  virtual tResult UnregisterHook(IRuntimeHook& oHook) = 0;
480 
497  virtual tResult GetObject(iobject_ptr<IObject>& pObject, const char* strNameOID) const = 0;
511  virtual tResult GetObject(iobject_ptr<IObject>& pObject) const = 0;
512 
526  virtual tResult CreateInstance(const char* strCID,
527  iobject_ptr<IObject>& pObject,
528  const tChar* strNameOfObject = "") const = 0;
529 
530 protected:
532  ~IRuntime() = default;
533 };//class IRuntime
534 
535 }//namespace ant
536 
537 namespace spider
538 {
539 
540 class DOEXPORT IRuntimeStartup : public ant::IObject
541 {
542 public:
547  ADTF_IID(IRuntimeStartup, "runtime_startup.spider.ucom.adtf.iid");
548 
553  virtual bool StartupCompleted() const = 0;
554 };
555 
556 }
557 
559 using ant::IRuntimeHook;
560 
562 using ant::IRuntime;
563 
565 
566 }//namespace ucom
567 }//namespace adtf
568 
569 #endif //_ADTF_UCOM_ANT_RUNTIME_RUNTIME_HOOK_INTERFACE_INCLUDES_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
Base class for every interface type within the uCOM.
Definition: object_intf.h:31
The IRuntimeHook interface provides a hook callback interface.
Definition: runtime_intf.h:76
virtual tResult RuntimeHook(const tHookInfo &sHookInfo, const iobject_ptr< IObject > &pObject)=0
This method will be called at specific stages during runtime operation, see IRuntime::tRuntimeHookId.
The IRuntime interface controls global system startup and shutdown.
Definition: runtime_intf.h:111
virtual tResult UnregisterHook(IRuntimeHook &oHook)=0
Unregister hook.
virtual tResult GetPlugins(iobject_enum< const IPluginInfo > &lstPluginInfos) const =0
Gets a object reference list of registered plugins.
virtual tResult CreateInstance(const char *strCID, iobject_ptr< IObject > &pObject, const tChar *strNameOfObject="") const =0
Creates a new instance of an object.
virtual tResult UnregisterAllPlugins(int8_t nRunLevel, uint32_t ui32Flags=0)=0
Unregister all plugin from plugin registry.
virtual tResult GetObjects(iobject_enum< IObject > &lstOfObjects) const =0
Get a list (enumeration) of registered instances.
virtual tResult SetRunLevel(int8_t nRunLevel, bool bWait=true)=0
Set run level.
virtual tResult RegisterObject(const iobject_ptr< IObject > &pObject, const char *strNameOID, int8_t nRunLevel, uint32_t ui32Flags=0)=0
Register object at object registry.
virtual tResult GetClasses(iobject_enum< const IClassInfo > &lstOfClasses) const =0
Returns a list of classes.
virtual tResult RegisterClassFactory(const iobject_ptr< const IClassFactory > &pClassFactory, uint32_t ui32Flags=0)=0
Register class at class registry The RegisterClass method registers all classes of the given factory ...
virtual tResult UnregisterPlugin(const iobject_ptr< IPluginInfo > &pPluginInfo, uint32_t ui32Flags=0)=0
Unregister plugin from plugin registry.
virtual tResult RegisterPlugin(const char *strUrl, int8_t nRunLevel, iobject_ptr< IPluginInfo > &pPluginInfo, uint32_t ui32Flags=0)=0
Register plugin at the plugin registry.
tClassRegistryFlags
Flags to affect the creation speed of classes.
Definition: runtime_intf.h:292
virtual tResult RegisterHook(IRuntimeHook &oHook)=0
Register hook.
virtual tResult GetClassFactories(iobject_enum< const IClassFactory > &lstOfClassFactories) const =0
Gets a list for all registered class factories.
virtual tResult GetObject(iobject_ptr< IObject > &pObject) const =0
Get registered object from object registry by interface.
tRuntimeHookId
Runtime hook identifiers.
Definition: runtime_intf.h:132
@ RHI_RunLevelPreDecrement
Called before the run level is decremented.
Definition: runtime_intf.h:224
@ RHI_RunLevelPostIncrement
Called after the run level was incremented.
Definition: runtime_intf.h:220
@ RHI_ServiceStarted
Called after a service was started.
Definition: runtime_intf.h:202
@ RHI_RunLevelIncrementing
Called before the run level is incrementing.
Definition: runtime_intf.h:232
@ RHI_UnregisterPlugin
Called before a plugin is unregistered.
Definition: runtime_intf.h:180
@ RHI_Start
Called after the runtime instance was started.
Definition: runtime_intf.h:137
@ RHI_RunLevelPostDecrement
Called after the run level was decremented.
Definition: runtime_intf.h:228
@ RHI_ServiceStopped
Called after a service has been stopped.
Definition: runtime_intf.h:212
@ RHI_RegisterObject
Called after an object has been registered.
Definition: runtime_intf.h:150
@ RHI_Stop
Called before the runtime instance is stopped.
Definition: runtime_intf.h:140
@ RHI_ServiceStarting
Called before a service is started.
Definition: runtime_intf.h:197
@ RHI_UnregisterObject
Called before an object is unregistered.
Definition: runtime_intf.h:156
@ RHI_LoadPlugin
Called after a plugin has been loaded.
Definition: runtime_intf.h:187
@ RHI_ServiceStopping
Called before a service is stopped.
Definition: runtime_intf.h:207
@ RHI_RegisterPlugin
Called after a plugin has been registered, after it has been loaded, see RHI_LoadPlugin.
Definition: runtime_intf.h:175
@ RHI_RunLevelPreIncrement
Called before the run level is incremented.
Definition: runtime_intf.h:216
@ RHI_CreateInstance
Called after an instance has been created.
Definition: runtime_intf.h:192
@ RHI_Destroy
Called before the runtime instance is destroyed.
Definition: runtime_intf.h:143
@ RHI_Create
Called after the runtime instance was created.
Definition: runtime_intf.h:134
@ RHI_RegisterClass
Called after a class has been registered.
Definition: runtime_intf.h:162
@ RHI_UnregisterClass
Called before a class is unregistered.
Definition: runtime_intf.h:168
tUnregisterObjectFlags
Run level change flags.
Definition: runtime_intf.h:260
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
tPluginFlags
InternalFlags.
Definition: runtime_intf.h:282
ADTF_IID(IRuntime, "runtime.ant.ucom.adtf.iid")
Marks the IRuntime to be castable with the ucom_cast<>
tChangeRunLevelFlags
Run level change flags.
Definition: runtime_intf.h:241
~IRuntime()=default
Protected destructor --> Use implemented Destroy() instead of delete!
virtual tResult UnregisterClassFactory(const iobject_ptr< const IClassFactory > &pClassFactory)=0
Unregister a class factory from class registry.
virtual int8_t GetRunLevel() const =0
Get current run level.
virtual tResult UnregisterObject(const iobject_ptr< IObject > &pObject, const tChar *strNameOID="")=0
Unregister object from object registry.
Interface definition for a container of objects.
Definition: object_list.h:22
Base object pointer to realize binary compatible reference counting in interface methods.
virtual bool StartupCompleted() const =0
ADTF_IID(IRuntimeStartup, "runtime_startup.spider.ucom.adtf.iid")
Marks the IRuntimeStartup to be castable with the ucom_cast<>
@ RL_Internal
internal runlevel Is not for users !
Definition: adtf_runtime.h:42
Namespace for entire ADTF SDK.
uint32_t idHook
Defines event type (IRuntime::tRuntimeHookId)
Definition: runtime_intf.h:85
void * pvData
optional data pointer.
Definition: runtime_intf.h:88
uint32_t ui32Param1
Depends on idHook.
Definition: runtime_intf.h:86
uint32_t ui32Param2
Depends on idHook.
Definition: runtime_intf.h:87
size_t szData
size of the data provided through pvData.
Definition: runtime_intf.h:89