nx_server_plugin_sdk  1.0
Server Plugin SDK
plugin_api.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 // TODO: When Storage and Camera SDKs are merged into Analytics SDK, rename this file and keep
6 // only Setting, Plugin and Plugin2 (renamed as `deprecated`) to be used when loading old plugins.
7 
9 
23 namespace nxpl {
24 
26 struct NX_GUID
27 {
29  unsigned char bytes[16];
30 };
31 
32 // {E03B8532-9531-41d6-982A-CA7BF0269780}
33 static const nxpl::NX_GUID IID_PluginInterface =
34  {{0xe0,0x3b,0x85,0x32,0x95,0x31,0x41,0xd6,0x98,0x2a,0xca,0x7b,0xf0,0x26,0x97,0x80}};
35 
37 
45 {
46 public:
47  virtual ~PluginInterface() {}
48 
50 
55  virtual void* queryInterface( const nxpl::NX_GUID& interfaceID ) = 0;
57 
61  virtual int addRef() const = 0;
63 
68  virtual int releaseRef() const = 0;
69 };
70 
71 struct Setting
72 {
76  const char* name;
77 
79  const char* value;
80 
81  Setting(): name(nullptr), value(nullptr) {}
82  Setting(const char* name, const char* value): name(name), value(value) {}
83 };
84 
85 static const nxpl::NX_GUID IID_Plugin =
86  {{0xe5,0x3c,0xf9,0x3d,0x61,0xd3,0x42,0x61,0x9d,0x25,0x9b,0x7b,0x3f,0x3a,0x81,0x2b}};
87 
94 {
95 public:
97  virtual const char* name() const = 0;
98 
105  virtual void setSettings(const nxpl::Setting* settings, int count) = 0;
106 };
107 
108 static const nxpl::NX_GUID IID_Plugin2 =
109  {{0x10,0x0a,0xfc,0x3e,0xca,0x63,0x47,0xfb,0x9d,0x5d,0x4,0x40,0xfc,0x59,0xf8,0x66}};
110 
111 class Plugin2: public Plugin
112 {
113 public:
118  virtual void setPluginContainer(nxpl::PluginInterface* pluginContainer) = 0;
119 };
120 
124 {
125  static constexpr char kFuncName[] = "createNXPluginInstance";
126  using Func = createNXPluginInstance*;
127 };
128 
129 } // namespace nxpl
virtual int addRef() const =0
Increment reference counter.
const char * value
Definition: plugin_api.h:79
virtual const char * name() const =0
Definition: plugin_api.h:71
virtual void * queryInterface(const nxpl::NX_GUID &interfaceID)=0
Cast to type, specified by interfaceID.
Definition: plugin_api.h:123
const char * name
Definition: plugin_api.h:76
virtual void setPluginContainer(nxpl::PluginInterface *pluginContainer)=0
unsigned char bytes[16]
GUID bytes.
Definition: plugin_api.h:29
Base class for every interface, provided by plugin.
Definition: plugin_api.h:44
Definition: plugin_api.h:111
GUID of plugin interface.
Definition: plugin_api.h:26
VMS dynamic plugin API (c++)
Definition: plugin_api.h:23
Definition: plugin_api.h:93
virtual void setSettings(const nxpl::Setting *settings, int count)=0
PluginInterface * createNXPluginInstance()
Definition: plugin_api.h:122
virtual int releaseRef() const =0
Decrement reference counter.