nx_metadata_sdk 1.0 Metadata SDK

plugin.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 <string>
6 #include <functional>
7
8 #include <nx/sdk/i_utility_provider.h>
9 #include <nx/sdk/analytics/i_plugin.h>
10 #include <nx/sdk/helpers/ref_countable.h>
11 #include <nx/sdk/ptr.h>
12
13 #include "engine.h"
14
15 namespace nx {
16 namespace sdk {
17 namespace analytics {
18
23 class Plugin: public RefCountable<IPlugin>
24 {
25 public:
26 using CreateEngine = std::function<IEngine*(Plugin* plugin)>;
27
32 Plugin(std::string pluginManifest, CreateEngine createEngine);
33
34 virtual ~Plugin() override;
35
36 Ptr<IUtilityProvider> utilityProvider() const { return m_utilityProvider; }
37
38 //-------------------------------------------------------------------------------------------------
39 // Not intended to be used by a descendant.
40
41 public:
42 virtual void setUtilityProvider(IUtilityProvider* utilityProvider) override;
43
44 protected:
45 virtual void getManifest(Result<const IString*>* outResult) const override;
46 virtual void doCreateEngine(Result<IEngine*>* outResult) override;
47
48 private:
49 const std::string m_jsonManifest;
50
51 CreateEngine m_createEngine;
52 Ptr<IUtilityProvider> m_utilityProvider;
53 };
54
55 } // namespace analytics
56 } // namespace sdk
57 } // namespace nx
nx::sdk::analytics::Plugin::Plugin
Plugin(std::string pluginManifest, CreateEngine createEngine)
Definition: plugin.cpp:17
nx::sdk::Ptr
Definition: ptr.h:18
nx::sdk::analytics::Plugin::setUtilityProvider
virtual void setUtilityProvider(IUtilityProvider *utilityProvider) override
Definition: plugin.cpp:28
nx::sdk::Result
Definition: result.h:47
nx::sdk::IUtilityProvider
Definition: i_utility_provider.h:22
nx
Definition: apple_utils.h:6
nx::sdk::RefCountable
Definition: ref_countable.h:84
nx::sdk::analytics::Plugin
Definition: plugin.h:23