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
58 protected: virtual void doSetSettings(
59 Result<const ISettingsResponse*>* outResult, const IStringMap* settings) = 0;
75 public: Result<const ISettingsResponse*> setSettings(const IStringMap* settings)
76 {
77 Result<const ISettingsResponse*> result;
78 doSetSettings(&result, settings);
79 return result;
80 }
81
83 protected: virtual void getPluginSideSettings(
84 Result<const ISettingsResponse*>* outResult) const = 0;
96 public: Result<const ISettingsResponse*> pluginSideSettings() const
97 {
98 Result<const ISettingsResponse*> result;
99 getPluginSideSettings(&result);
100 return result;
101 }
102
104 protected: virtual void getManifest(Result<const IString*>* outResult) const = 0;
117 public: Result<const IString*> manifest() const
118 {
119 Result<const IString*> result;
120 getManifest(&result);
121 return result;
122 }
123
128 virtual bool isCompatible(const IDeviceInfo* deviceInfo) const = 0;
129
131 protected: virtual void doObtainDeviceAgent(
132 Result<IDeviceAgent*>* outResult, const IDeviceInfo* deviceInfo) = 0;
143 public: Result<IDeviceAgent*> obtainDeviceAgent(const IDeviceInfo* deviceInfo)
144 {
145 Result<IDeviceAgent*> result;
146 doObtainDeviceAgent(&result, deviceInfo);
147 return result;
148 }
149
151 protected: virtual void doExecuteAction(
152 Result<IAction::Result>* outResult, const IAction* action) = 0;
160 public: Result<IAction::Result> executeAction(const IAction* action)
161 {
162 Result<IAction::Result> result;
163 doExecuteAction(&result, action);
164 return result;
165 }
166
171 virtual void setHandler(IHandler* handler) = 0;
172 };
173 using IEngine0 = IEngine;
174
175 } // namespace analytics
176 } // namespace sdk
177 } // 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:49
nx::sdk::analytics::IAction
Definition: i_action.h:20
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::executeAction
Result< IAction::Result > executeAction(const IAction *action)
Definition: i_engine.h:160
nx::sdk::IDeviceInfo
Definition: i_device_info.h:14
nx::sdk::analytics::IEngine::isCompatible
virtual bool isCompatible(const IDeviceInfo *deviceInfo) const =0
nx::sdk::analytics::IEngine::pluginSideSettings
Result< const ISettingsResponse * > pluginSideSettings() const
Definition: i_engine.h:96
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::setSettings
Result< const ISettingsResponse * > setSettings(const IStringMap *settings)
Definition: i_engine.h:75
nx::sdk::analytics::IEngine::getPluginSideSettings
virtual void getPluginSideSettings(Result< const ISettingsResponse *> *outResult) const =0
nx::sdk::analytics::IEngine::doSetSettings
virtual void doSetSettings(Result< const ISettingsResponse *> *outResult, const IStringMap *settings)=0
nx::sdk::analytics::IEngine::obtainDeviceAgent
Result< IDeviceAgent * > obtainDeviceAgent(const IDeviceInfo *deviceInfo)
Definition: i_engine.h:143
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:77
nx::sdk::analytics::IEngine::manifest
Result< const IString * > manifest() const
Definition: i_engine.h:117
nx::sdk::analytics::IEngine::doExecuteAction
virtual void doExecuteAction(Result< IAction::Result > *outResult, const IAction *action)=0