libRoadRunner Plugin C++ API  1.0.0
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rrp::Plugin Class Referenceabstract

#include <rrPlugin.h>

Inheritance diagram for rrp::Plugin:
rrp::CPlugin rrp::CPPPlugin

Public Member Functions

 Plugin (const string &name=gEmptyString, const string &cat=gNoneString, RoadRunner *aRR=NULL, const string &language=gNoneString, const PluginManager *pm=NULL)
 
virtual ~Plugin ()
 
string getName ()
 
string getLibraryName ()
 
string getAuthor ()
 
string getCategory ()
 
string getVersion ()
 
string getCopyright ()
 
RoadRunner * getRoadRunnerInstance ()
 
virtual string getInfo ()
 
virtual string getExtendedInfo ()
 
virtual unsigned char * getManualAsPDF () const
 
virtual unsigned int getPDFManualByteSize ()
 
ParametersgetParameters ()
 
StringList getParameterNames ()
 
string getPluginPropertiesAsXML ()
 
PluginParametergetParameter (const string &param, const string &capability="")
 
PluginParametergetParameter (const string &param, Capability &capability)
 
bool setParameter (const string &nameOf, const char *value)
 
bool setParameter (const string &nameOf, const char *value, Capability &capability)
 
void terminate ()
 
bool isBeingTerminated ()
 
bool wasTerminated ()
 check if the plugin was terminated
 
virtual bool isWorking ()
 check if the plugin is working
 
bool assignRoadRunnerInstance (RoadRunner *rr)
 Assign a roadrunner instance for the plugin to use.
 
virtual bool assignOnStartedEvent (PluginEvent pluginStarted, void *userData1=NULL, void *userData2=NULL)
 
virtual bool assignOnProgressEvent (PluginEvent pluginsProgress, void *userData1=NULL, void *userData2=NULL)
 
virtual bool assignOnFinishedEvent (PluginEvent pluginsFinished, void *userData1=NULL, void *userData2=NULL)
 
virtual string getResult ()
 
virtual bool resetPlugin ()
 
virtual bool assignInput (void *data)
 
virtual string getStatus ()
 
virtual string getImplementationLanguage ()=0
 
virtual bool execute (bool inAThread=false)=0
 

Protected Member Functions

void setLibraryName (const string &libName)
 

Protected Attributes

string mName
 Name of Plugin.
 
string mLibraryName
 Name of compiled shared library implementing the Plugin.
 
string mAuthor
 Name of plugin author(s)
 
string mCategory
 Plugin category.
 
string mVersion
 Plugin version.
 
string mCopyright
 Plugin copyright language.
 
string mImplementationLanguage
 Plugin implementation language.
 
bool mTerminate
 Boolean flag indicating if a user wants to terminate the work in a plugin.
 
bool mIsWorking
 Boolean flag indicating if the plugin is working.
 
RoadRunner * mRR
 
const PluginManagermPM
 
PluginEvent mWorkStartedEvent
 
PluginEvent mWorkProgressEvent
 
PluginEvent mWorkFinishedEvent
 
void * mWorkStartedData1
 
void * mWorkStartedData2
 
void * mWorkProgressData1
 
void * mWorkProgressData2
 
void * mWorkFinishedData1
 
void * mWorkFinishedData2
 
Capabilities mCapabilities
 
void * mClientData
 

Detailed Description

The Plugin class is a base class for all RoadRunner plugins. A Plugin is implemented in a shared library, e.g. a DLL on Windows, and loaded at runtime by a PluginManager. Any RoadRunner Plugin need to inherit from the Plugin class or any of its descendants. Here are the main characteristics of a Plugin:

  1. The Plugin class do contain the bulk of how a Plugin is handled by the Plugin manager and any clients of the plugin, while the atcual custom functionality is implmemented in a descendant Plugin.
  2. A plugin may belong to a category and is identified by a name. It has properties like Author, Version, Copyright etc.
  3. A Plugin typically expose various Capabilities, available to a client of a plugin trough the Capabilites conatiner.
  4. Each Capability may have various numbers of Parameters that a client of the Plugin may set or get.
  5. The internal work a plugin is designed to do may be executed in a separate thread, and various functions to monitor and manage the work of a Plugin is exposed, e.g. isWorking(), terminate(), isBeingTerminated() etc.
  6. A Plugin may implement various event functions in order to communicate data or progress to a client. The Plugin class exposes three events, PluginStarted, PluginProgress and a PluginFinish event. Each event may communicate two opaque data parameters. Its up to the plugin implementor to make use of these events and what data to pass.
  7. A plugin have access to other plugins through the PluginManager. Thus, a plugin may depend on other plugins.
  8. A plugin may embed documentation in various forms, e.g. PDF (getPDFManual(), or simple text getExtendedInfo().

Constructor & Destructor Documentation

rrp::Plugin::Plugin ( const string &  name = gEmptyString,
const string &  cat = gNoneString,
RoadRunner *  aRR = NULL,
const string &  language = gNoneString,
const PluginManager pm = NULL 
)

Create a plugin

rrp::Plugin::~Plugin ( )
virtual

Destroy the plugin.

Member Function Documentation

bool rrp::Plugin::assignInput ( void *  data)
virtual

Function allowing opaque data being passed to a plugin. This

bool rrp::Plugin::assignOnFinishedEvent ( PluginEvent  pluginsFinished,
void *  userData1 = NULL,
void *  userData2 = NULL 
)
virtual

Assign function pointer and data the event

bool rrp::Plugin::assignOnProgressEvent ( PluginEvent  pluginsProgress,
void *  userData1 = NULL,
void *  userData2 = NULL 
)
virtual

Assign function pointer and data the event

bool rrp::Plugin::assignOnStartedEvent ( PluginEvent  pluginStarted,
void *  userData1 = NULL,
void *  userData2 = NULL 
)
virtual

Assign function pointer and data the event

virtual bool rrp::Plugin::execute ( bool  inAThread = false)
pure virtual

Execute the plugin

Implemented in rrp::CPlugin.

string rrp::Plugin::getAuthor ( )

Get the name of plugin author(s)

string rrp::Plugin::getCategory ( )

Get plugin category

string rrp::Plugin::getCopyright ( )

Get plugin copyright text

string rrp::Plugin::getExtendedInfo ( )
virtual

Retrieve more information than getInfo()

virtual string rrp::Plugin::getImplementationLanguage ( )
pure virtual

Retrieve the implementation language of the plugin.

Implemented in rrp::CPlugin, and rrp::CPPPlugin.

string rrp::Plugin::getInfo ( )
virtual

Retrieves various plugin information

string rrp::Plugin::getLibraryName ( )

Get the name of the compiled shared library that implemements the plugin.

unsigned char * rrp::Plugin::getManualAsPDF ( ) const
virtual

Retrieve a plugins documentation embedded as PDF. May be NULL

string rrp::Plugin::getName ( )

Get the name of the plugin.

PluginParameter * rrp::Plugin::getParameter ( const string &  param,
const string &  capability = "" 
)

Retieves a specific parameter, in a specific capability.

PluginParameter * rrp::Plugin::getParameter ( const string &  param,
Capability capability 
)

Retieves a specific parameter, in a specific capability.

StringList rrp::Plugin::getParameterNames ( )

Retieves the names of the parameters

Parameters * rrp::Plugin::getParameters ( )

Retieves the parameters

unsigned int rrp::Plugin::getPDFManualByteSize ( )
virtual

Retrieve the size in bytes of the PDF string.

string rrp::Plugin::getPluginPropertiesAsXML ( )

Retieves a plugin properties, as XML

string rrp::Plugin::getResult ( )
virtual

Function returnin a plugins "result", as a string

RoadRunner * rrp::Plugin::getRoadRunnerInstance ( )

Retrieves the RoadRunner instance the plugin is using. Can be NULL.

string rrp::Plugin::getStatus ( )
virtual

Retrieve the status of the plugin.

string rrp::Plugin::getVersion ( )

Get plugin version information

bool rrp::Plugin::isBeingTerminated ( )

Check if the plugin worker is in the process of being terminated

bool rrp::Plugin::resetPlugin ( )
virtual

Reset the plugin.

void rrp::Plugin::setLibraryName ( const string &  libName)
protected

Set the name of the shared library

bool rrp::Plugin::setParameter ( const string &  nameOf,
const char *  value 
)

Sets the value of specified Parameter with value as specified

bool rrp::Plugin::setParameter ( const string &  nameOf,
const char *  value,
Capability capability 
)

Sets the value of specified Parameter with value as specified

void rrp::Plugin::terminate ( )

If the work of the plugin is carried out in a separate thread, terminate() will signal termination of such work.

Member Data Documentation

Capabilities rrp::Plugin::mCapabilities
protected

Capabilities container. Descendant add capabilites to this container, as they wish. It is basically a container for parameter data that can be exchanged to/from the plugin by using parameters

void* rrp::Plugin::mClientData
protected

Opaque data pointer. Plugin designer may use this to communicat data of any type out/in to the plugin using the assignPluginInput() function.

const PluginManager* rrp::Plugin::mPM
protected

A pointer to the PluginManager that loaded the Plugin uses.

RoadRunner* rrp::Plugin::mRR
protected

A pointer to a RoadRunner instance which the plugin uses.

void* rrp::Plugin::mWorkFinishedData1
protected

Opaque data parameter 1 passed in the WorkFinished event function

void* rrp::Plugin::mWorkFinishedData2
protected

Opaque data parameter 2 passed in the WorkFinished event function

PluginEvent rrp::Plugin::mWorkFinishedEvent
protected

WorkFinished event function pointer

void* rrp::Plugin::mWorkProgressData1
protected

Opaque data parameter 1 passed in the WorkProgress event function

void* rrp::Plugin::mWorkProgressData2
protected

Opaque data parameter 2 passed in the WorkProgress event function

PluginEvent rrp::Plugin::mWorkProgressEvent
protected

Work In progress event function pointer

void* rrp::Plugin::mWorkStartedData1
protected

Opaque data parameter 1 passed in the WorkStarted event function

void* rrp::Plugin::mWorkStartedData2
protected

Opaque data parameter 2 passed in the WorkStarted event function

PluginEvent rrp::Plugin::mWorkStartedEvent
protected

WorkStarted event function pointer


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