ADTF
Loading...
Searching...
No Matches
runtime.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <a_utils.h>
12#include <adtfucom3/object.h>
17#include <functional>
18
19namespace adtf
20{
21namespace ucom
22{
23
27class DOEXPORT cRuntime : public catwo::object<IRuntime, vision::IRuntimeArguments>
28{
30 A_UTILS_D(cRuntime)
31
32public:
33 cRuntime(int8_t nLastRunlevel);
34
41 cRuntime(int8_t nLastRunlevel, const adtf::util::cCommandLine& oCommandline);
42
43protected:
47 virtual ~cRuntime();
48
54 virtual const char* GetRunLevelString(int8_t i8Runlevel) const = 0;
55
56 tResult CallRuntimeHooks(int nHookId,
57 uint32_t ui32Param1 = 0,
58 uint32_t ui32Param2 = 0,
59 void* pvData = NULL,
60 int szData = 0,
61 const iobject_ptr<IObject>& pObject = object_ptr<IObject>());
62
63 tResult NotifyAllObjects(int nEventId,
64 uint32_t ui32Param1 = 0,
65 uint32_t ui32Param2 = 0,
66 void* pvData = NULL,
67 int szData = 0,
68 bool bBackwards = false);
69
70 void SetEventFilter(
71 std::function<tResult(int, uint32_t, uint32_t, void*, int, const iobject_ptr<IObject>&)> fnHookFilter,
72 std::function<tResult(int, uint32_t, uint32_t, void*, int, bool)> fnEventFilter);
73
74public: // implements IRuntime
75 // runlevel control
76 tResult SetRunLevel(int8_t i8RunlevelToChangeTo, bool bWait = true) override;
77
82 int8_t GetRunLevel() const override;
83
84 // object registry
85 tResult RegisterObject(const iobject_ptr<IObject>& pObject,
86 const char* strNameOID,
87 int8_t nRunLevel,
88 uint32_t ui32Flags = 0) override;
89
90 tResult UnregisterObject(const iobject_ptr<IObject>& pObject, const tChar* strNameOID = "") override;
97 tResult GetObjects(iobject_enum<IObject>& lstOfObjects) const override;
98
99 // plugin registry
100 tResult RegisterPlugin(const char* strUrl,
101 int8_t nRunLevel,
102 iobject_ptr<IPluginInfo>& pPluginInfo,
103 uint32_t ui32Flags = 0) override;
104
105 tResult UnregisterPlugin(const iobject_ptr<IPluginInfo>& pPluginInfo, uint32_t ui32Flags = 0) override;
106
107 tResult UnregisterAllPlugins(int8_t nRunLevel, uint32_t ui32Flags = 0) override;
108
109 tResult GetPlugins(iobject_enum<const IPluginInfo>& lstPluginInfos) const override;
110
111 // class registry
112 tResult RegisterClassFactory(const iobject_ptr<const IClassFactory>& pClassFactory,
113 uint32_t ui32Flags = 0) override;
114 tResult UnregisterClassFactory(const iobject_ptr<const IClassFactory>& pClassFactory) override;
115
116 tResult GetClasses(iobject_enum<const IClassInfo>& lstOfClasses) const override;
117 tResult GetClassFactories(iobject_enum<const IClassFactory>& lstOfClasses) const override;
118
121
124
125 // Get an object from the object registry
126 tResult GetObject(iobject_ptr<IObject>& pObject, const char* strNameOID) const override;
127 tResult GetObject(iobject_ptr<IObject>& pObject) const override;
128
129 // Create an instance of a concrete type
130 tResult CreateInstance(const char* strCID,
131 iobject_ptr<IObject>& oObject,
132 const tChar* strNameOfObject = "") const override;
133
134 tResult GetArguments(const adtf::ucom::nitro::ifunction<tResult(const char*)>& oCallback) const override;
135}; // class cRuntime
136
148template<int8_t LAST_RUN_LEVEL>
149class runtime : public cRuntime
150{
151public:
154 runtime() : cRuntime(LAST_RUN_LEVEL)
155 {
156 }
157
163 runtime(const adtf::util::cCommandLine& oCommandline) : cRuntime(LAST_RUN_LEVEL, oCommandline)
164 {
165 }
166
172 const char* GetRunLevelString(int8_t /* i8Runlevel */) const override
173 {
174 return "";
175 }
176};
177
178} // namespace ucom
179} // namespace adtf
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition runtime_intf.h:32
Definition object_list.h:22
Definition object_ptr.h:384
tResult GetObjects(iobject_enum< IObject > &lstOfObjects) const override
tResult RegisterHook(IRuntimeHook &pHook) override
Register a Hook.
cRuntime(int8_t nLastRunlevel, const adtf::util::cCommandLine &oCommandline)
int8_t GetRunLevel() const override
cRuntime(int8_t nLastRunlevel)
dptr impl
virtual const char * GetRunLevelString(int8_t i8Runlevel) const =0
tResult UnregisterHook(IRuntimeHook &pHook) override
Unregister a Hook.
Definition object.h:397
Definition function_ptr.h:28
runtime()
Definition runtime.h:154
const char * GetRunLevelString(int8_t) const override
Definition runtime.h:172
runtime(const adtf::util::cCommandLine &oCommandline)
Definition runtime.h:163
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:437
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14