nx_metadata_sdk 1.0 Metadata SDK

i_engine.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <nx/sdk/interface.h>
6 #include <nx/sdk/result.h>
7
8 #include <nx/sdk/i_device_info.h>
9 #include <nx/sdk/i_string.h>
10 #include <nx/sdk/i_plugin_diagnostic_event.h>
11
12 #include <nx/sdk/i_settings_response.h>
13
14 #include "i_device_agent.h"
15 #include "i_engine_info.h"
16 #include "i_action.h"
17
18 namespace nx {
19 namespace sdk {
20 namespace analytics {
21
22 class IPlugin; //< Forward declaration for the parent object.
23
37 class IEngine: public Interface<IEngine>
38 {
39 public:
40 static auto interfaceId() { return makeId("nx::sdk::analytics::IEngine"); }
41
42 class IHandler: public Interface<IHandler>
43 {
44 public:
45 static auto interfaceId() { return makeId("nx::sdk::analytics::IEngine::IHandler"); }
46
47 virtual ~IHandler() = default;
48 virtual void handlePluginDiagnosticEvent(IPluginDiagnosticEvent* event) = 0;
49 };
50
55 virtual void setEngineInfo(const IEngineInfo* engineInfo) = 0;
56
71 protected: virtual void doSetSettings(
72 Result<const IStringMap*>* outResult, const IStringMap* settings) = 0;
73 public: Result<const IStringMap*> setSettings(const IStringMap* settings)
74 {
75 Result<const IStringMap*> result;
76 doSetSettings(&result, settings);
77 return result;
78 }
79
93 protected: virtual void getPluginSideSettings(
94 Result<const ISettingsResponse*>* outResult) const = 0;
95 public: Result<const ISettingsResponse*> pluginSideSettings() const
96 {
97 Result<const ISettingsResponse*> result;
98 getPluginSideSettings(&result);
99 return result;
100 }
101
111 protected: virtual void getManifest(Result<const IString*>* outResult) const = 0;
112 public: Result<const IString*> manifest() const
113 {
114 Result<const IString*> result;
115 getManifest(&result);
116 return result;
117 }
118
123 virtual bool isCompatible(const IDeviceInfo* deviceInfo) const = 0;
124
134 protected: virtual void doObtainDeviceAgent(
135 Result<IDeviceAgent*>* outResult, const IDeviceInfo* deviceInfo) = 0;
136 public: Result<IDeviceAgent*> obtainDeviceAgent(const IDeviceInfo* deviceInfo)
137 {
138 Result<IDeviceAgent*> result;
139 doObtainDeviceAgent(&result, deviceInfo);
140 return result;
141 }
142
150 protected: virtual void doExecuteAction(
151 Result<IAction::Result>* outResult, const IAction* action) = 0;
152 public: Result<IAction::Result> executeAction(const IAction* action)
153 {
154 Result<IAction::Result> result;
155 doExecuteAction(&result, action);
156 return result;
157 }
158
163 virtual void setHandler(IHandler* handler) = 0;
164 };
165
166 } // namespace analytics
167 } // namespace sdk
168 } // namespace nx
nx::sdk::IPluginDiagnosticEvent
Definition: i_plugin_diagnostic_event.h:14
nx::sdk::IStringMap
Definition: i_string_map.h:10
nx::sdk::Interface
Definition: interface.h:28
nx::sdk::analytics::IEngine::getManifest
virtual void getManifest(Result< const IString *> *outResult) const =0
nx::sdk::analytics::IEngine::setEngineInfo
virtual void setEngineInfo(const IEngineInfo *engineInfo)=0
nx::sdk::analytics::IEngine::doObtainDeviceAgent
virtual void doObtainDeviceAgent(Result< IDeviceAgent *> *outResult, const IDeviceInfo *deviceInfo)=0
nx::sdk::analytics::IEngine::setHandler
virtual void setHandler(IHandler *handler)=0
nx::sdk::analytics::IEngine
Definition: i_engine.h:37
nx::sdk::analytics::IEngine::doSetSettings
virtual void doSetSettings(Result< const IStringMap *> *outResult, const IStringMap *settings)=0
nx::sdk::analytics::IEngine::isCompatible
virtual bool isCompatible(const IDeviceInfo *deviceInfo) const =0
nx::sdk::Result
Definition: result.h:47
nx
Definition: apple_utils.h:6
nx::sdk::analytics::IEngineInfo
Definition: i_engine_info.h:12
nx::sdk::analytics::IEngine::getPluginSideSettings
virtual void getPluginSideSettings(Result< const ISettingsResponse *> *outResult) const =0
nx::sdk::analytics::IEngine::IHandler
Definition: i_engine.h:42
nx::sdk::IRefCountable::makeId
static constexpr const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:78
nx::sdk::analytics::IEngine::doExecuteAction
virtual void doExecuteAction(Result< IAction::Result > *outResult, const IAction *action)=0