stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nx::sdk::analytics::Engine Class Referenceabstract

#include <engine.h>

Inheritance diagram for nx::sdk::analytics::Engine:
nx::sdk::RefCountable< IEngine > nx::vms_server_plugins::analytics::stub::Engine

Public Member Functions

virtual IPluginplugin () const override
 
virtual void setEngineInfo (const IEngineInfo *engineInfo) override
 
virtual void setSettings (const nx::sdk::IStringMap *settings) override
 
virtual nx::sdk::IStringMappluginSideSettings () const override
 
virtual const IStringmanifest (Error *error) const override
 
virtual void executeAction (IAction *action, Error *outError) override
 
virtual nx::sdk::Error setHandler (IEngine::IHandler *handler) override
 
virtual bool isCompatible (const nx::sdk::IDeviceInfo *deviceInfo) const override
 
- Public Member Functions inherited from nx::sdk::RefCountable< IEngine >
 RefCountable (const RefCountable &)=delete
 
 RefCountable (RefCountable &&)=delete
 
RefCountableoperator= (const RefCountable &)=delete
 
RefCountableoperator= (RefCountable &&)=delete
 
virtual int addRef () const override
 
virtual int releaseRef () const override
 
int refCount () const
 
virtual IRefCountablequeryInterface (InterfaceId id)
 
const IRefCountablequeryInterface (InterfaceId id) const
 
InterfacequeryInterface ()
 
const InterfacequeryInterface () const
 

Protected Member Functions

 Engine (IPlugin *plugin, bool enableOutput, const std::string &printPrefix="")
 
virtual std::string manifest () const =0
 
virtual void settingsReceived ()
 
std::string getParamValue (const char *paramName)
 
virtual void executeAction (const std::string &, Uuid, Uuid, int64_t, const std::map< std::string, std::string > &, std::string *, std::string *, Error *)
 
void pushPluginEvent (nx::sdk::IPluginEvent::Level level, std::string caption, std::string description)
 
template<typename DerivedPlugin >
DerivedPlugin * pluginCasted ()
 
IEngine::IHandlerhandler () const
 

Protected Attributes

LogUtils logUtils
 

Detailed Description

Base class for a typical implementation of an Analytics Engine. Hides many technical details of the Analytics Plugin SDK, but may limit plugin capabilities - use only when suitable.

To use NX_PRINT/NX_OUTPUT in a derived class with the prefix defined by this class, add the following to the derived class .cpp:


    #define NX_PRINT_PREFIX (this->logUtils.printPrefix)
    #include <nx/kit/debug.h>

Constructor & Destructor Documentation

◆ Engine()

nx::sdk::analytics::Engine::Engine ( IPlugin plugin,
bool  enableOutput,
const std::string &  printPrefix = "" 
)
protected
Parameters
enableOutputEnables NX_OUTPUT. Typically, use NX_DEBUG_ENABLE_OUTPUT as a value.
printPrefixPrefix for NX_PRINT and NX_OUTPUT. If empty, will be made from libName.

Member Function Documentation

◆ executeAction()

void nx::vms_server_plugins::analytics::stub::Engine::executeAction ( const std::string &  actionId,
Uuid  objectId,
Uuid  ,
int64_t  ,
const std::map< std::string, std::string > &  params,
std::string *  outActionUrl,
std::string *  outMessageToUser,
Error *  error 
)
inlineprotectedvirtual

Action handler. Called when some action defined by this engine is triggered by Server.

Parameters
actionIdId of the action being triggered.
objectIdId of a metadata object for which the action has been triggered.
paramsIf the engine manifest defines params for the action being triggered, contains their values after they are filled by the user via Client form. Otherwise, empty.
outActionUrlIf set by this call, Client will open this URL in an embedded browser.
outMessageToUserIf set by this call, Client will show this text to the user.

Reimplemented in nx::vms_server_plugins::analytics::stub::Engine.

◆ getParamValue()

std::string nx::sdk::analytics::Engine::getParamValue ( const char *  paramName)
protected

Provides access to the Plugin global settings stored by the server.

Returns
Param value, or an empty string if such param does not exist, having logged the error.

◆ pluginCasted()

template<typename DerivedPlugin >
DerivedPlugin* nx::sdk::analytics::Engine::pluginCasted ( )
inlineprotected

Intended to be called from a method of a derived class overriding plugin().

Returns
Parent Plugin, casted to the specified type.

◆ pushPluginEvent()

void nx::sdk::analytics::Engine::pushPluginEvent ( nx::sdk::IPluginEvent::Level  level,
std::string  caption,
std::string  description 
)
protected

Sends a PluginEvent to the Server. Can be called from any thread, but if called before settingsReceived() was called, will be ignored in case setHandler() was not called yet.

◆ settingsReceived()

void nx::vms_server_plugins::analytics::stub::Engine::settingsReceived ( )
inlineprotectedvirtual

Called when the settings are received from the server (even if the values are not changed). Should perform any required (re)initialization. Called even if the settings model is empty.

Reimplemented in nx::vms_server_plugins::analytics::stub::Engine.


The documentation for this class was generated from the following files: