Plug-in Manager. More...

#include <gpluginmanager.h>

Public Types

enum  tPluginsType { ptSelect, ptOrdered, ptList, ptListSelect }
 

Public Member Functions

 GPlugInManager (const R::RString &name, tPluginsType type)
 
R::RString GetName (void) const
 
R::RString GetVersion (void) const
 
tPluginsType GetPlugInType (void) const
 
int Compare (const GPlugInManager &pmng) const
 
int Compare (const R::RString &name) const
 
void ReOrder (void)
 
void Load (const R::RString &dll, void *handle, void *handleDlg)
 
void Create (GSession *session)
 
void Disconnect (GSession *session)
 
void Delete (void)
 
void CreateConfig (R::RConfig *config)
 
void ReadConfig (R::RConfig *config)
 
void SaveConfig (R::RConfig *config)
 
void InitPlugIns (GSession *session)
 
void RegisterPlugIn (GPlugIn *plugin, bool enable)
 
R::RCursor< GPlugInListGetPlugInLists (void) const
 
GPlugInListGetPlugInList (const R::RString &list, int need=1) const
 
GPlugInFactoryGetFactory (const R::RString &name, const R::RString &list, int need=1) const
 
GPlugInFactoryGetFactory (const R::RString &name, int need=1) const
 
size_t GetNbFactories (const R::RString &list=R::RString::Null) const
 
R::RCursor< GPlugInFactoryGetFactories (const R::RString &list=R::RString::Null) const
 
size_t GetNbPlugIns (const R::RString &list=R::RString::Null) const
 
template<class plugin >
plugin * GetPlugIn (const R::RString &name, const R::RString &list, int need=1) const
 
template<class plugin >
plugin * GetPlugIn (const R::RString &name, int need=1) const
 
template<class plugin >
R::RCastCursor< GPlugIn, plugin > GetPlugIns (const R::RString &list=R::RString::Null) const
 
void SetCurrentPlugIn (const R::RString &name, const R::RString &list, int need=1)
 
void SetCurrentPlugIn (const R::RString &name, int need=1)
 
template<class plugin >
plugin * GetCurrentPlugIn (const R::RString &list, int need=1) const
 
template<class plugin >
plugin * GetCurrentPlugIn (int need=1) const
 
GPlugInFactoryGetCurrentFactory (const R::RString &list, int need=1) const
 
GPlugInFactoryGetCurrentFactory (int need=1) const
 
virtual ~GPlugInManager (void)
 

Protected Attributes

R::RString Name
 
R::RString Version
 
tPluginsType PluginsType
 
union {
   GPlugInList *   List
 
   R::RContainer< GPlugInList,
true, true > *   Lists
 
Data
 

Detailed Description

Plug-in Manager.

The GPlugInManager class provides a plug-in manager (for example, a list of storages). There are different kind of plug-in manager depending on how their plug-ins are treated:

  • A list of plug-ins where one is the current one.
  • A list of plug-ins to execute in a given order.
  • A simple list of plug-ins.
  • Multiple lists of plug-ins with, for each list, a current plug-in (in particular for GMeasure plug-ins).

Several template methods are provided to get a plug-in, to get a cursor over plug-ins or to get the current one.

Member Enumeration Documentation

Types of plug-ins.

Enumerator
ptSelect 

Only one plug-in can be selected.

ptOrdered 

Plug-ins must be treated in a given order.

ptList 

Simple list of plug-ins.

ptListSelect 

Multiple lists of plug-ins where one plug-in can be selected in a given list.

Constructor & Destructor Documentation

GPlugInManager ( const R::RString name,
tPluginsType  type 
)

Constructor for the manager of plug-ins manager.

Parameters
nameName of the manager.
typeType of the manager.
virtual ~GPlugInManager ( void  )
virtual

Destructor the plug-ins manager.

Member Function Documentation

R::RString GetName ( void  ) const

Get the name of the current Manager.

R::RString GetVersion ( void  ) const

Get the version of the current Manager.

tPluginsType GetPlugInType ( void  ) const

Get the type of the plug-ins.

int Compare ( const GPlugInManager pmng) const

Comparison method needed by R::RContainer.

Parameters
pmngPlug-ins manager to compare.
int Compare ( const R::RString name) const

Comparison method needed by R::RContainer.

Parameters
nameName to compare.
void ReOrder ( void  )

ReOrder the containers of the manager. This method must be called if the level of a plug-in changes, and works only with an ordered list of plug-ins.

void Load ( const R::RString dll,
void *  handle,
void *  handleDlg 
)

Load a plug-in and its dialog boxes.

Parameters
dllName of the dynamic link library.
handleHandle to the library of the plug-in.
handleDlgHandle to the library of the dialogs.
void Create ( GSession session)

Create the plug-ins for a given session.

Parameters
sessionPointer to the session.
void Disconnect ( GSession session)

Disconnect the plug-ins for a given session.

void Delete ( void  )

Delete the plug-ins.

void CreateConfig ( R::RConfig config)

Create the configuration parameters in the configuration structure.

Parameters
configConfiguration structure.
void ReadConfig ( R::RConfig config)

Read the configuration parameters from the configuration structure.

Parameters
configConfiguration structure.
void SaveConfig ( R::RConfig config)

Save the configuration parameters in the configuration structure.

Parameters
configConfiguration structure.
void InitPlugIns ( GSession session)

Initialize the different plug-ins.

Parameters
sessionSession.
void RegisterPlugIn ( GPlugIn plugin,
bool  enable 
)

Register a plug-in as enabled or not.

Parameters
pluginPlugin.
enableEnabled ?
R::RCursor<GPlugInList> GetPlugInLists ( void  ) const
Returns
List of the plug-ins list if supported, or an empty cursor.
GPlugInList* GetPlugInList ( const R::RString list,
int  need = 1 
) const
Returns
a given plug-ins list.
Parameters
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugInFactory* GetFactory ( const R::RString name,
const R::RString list,
int  need = 1 
) const

Get a pointer to a given GPlugInFactory.

Parameters
nameName of the GPlugInFactory.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the GPlugInFactory, or null/exception if the GPlugInFactory does not exist.
GPlugInFactory* GetFactory ( const R::RString name,
int  need = 1 
) const

Get a pointer to a given GPlugInFactory.

Parameters
nameName of the GPlugInFactory.
needIf the parameter is non-null and the plug-in does doesn't exist, generate an exception.
Returns
Pointer to the GPlugInFactory, or null/exception if the GPlugInFactory does not exist.
size_t GetNbFactories ( const R::RString list = R::RString::Null) const

Get the number of factories registered.

Parameters
listList.
R::RCursor<GPlugInFactory> GetFactories ( const R::RString list = R::RString::Null) const

Get a cursor over the registered factories.

Parameters
listList.
size_t GetNbPlugIns ( const R::RString list = R::RString::Null) const

Get the number of enabled plug-ins.

Parameters
listList.
plugin* GetPlugIn ( const R::RString name,
const R::RString list,
int  need = 1 
) const

Get a pointer to a given plug-in.

Parameters
nameName of the plug-in.
listList.
needIf the parameter is not-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the plug-in, or null/exception if the name does not exist.
plugin* GetPlugIn ( const R::RString name,
int  need = 1 
) const

Get a pointer to a given plug-in.

Parameters
nameName of the plug-in.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the plug-in, or null/exception if the name does not exist.
R::RCastCursor<GPlugIn,plugin> GetPlugIns ( const R::RString list = R::RString::Null) const

Get a cursor over the enabled plug-ins.

Parameters
listList.
void SetCurrentPlugIn ( const R::RString name,
const R::RString list,
int  need = 1 
)

Set the current method if the plug-ins must have a selected one. An exception is generated if list doesn't exists, the plug-in doesn't exist or is not enabled

Parameters
nameName of the method.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
void SetCurrentPlugIn ( const R::RString name,
int  need = 1 
)

Set the current method if the plug-ins must have a selected one.

Parameters
nameName of the method.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
plugin* GetCurrentPlugIn ( const R::RString list,
int  need = 1 
) const

Get the current plug-in in a list.

Parameters
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the GPlugIn, or null/exception if no plug-in is selected or if the list does not need to select one.
plugin* GetCurrentPlugIn ( int  need = 1) const

Get the current plug-in in a list.

Parameters
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the GPlugIn, or null/exception if no plug-in is selected or if the list does not need to select one.
GPlugInFactory* GetCurrentFactory ( const R::RString list,
int  need = 1 
) const

Get the current GPlugInFactory.

Parameters
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the GPlugInFactory, or null/exception if no plug-in is selected or if the list does not need to select one.
GPlugInFactory* GetCurrentFactory ( int  need = 1) const

Get the current GPlugInFactory.

Parameters
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
Returns
Pointer to the GPlugInFactory, or null/exception if no plug-in is selected or if the list does not need to select one.

Member Data Documentation

R::RString Name
protected

Name of the manager.

R::RString Version
protected

Version of the manager.

tPluginsType PluginsType
protected

Types of plug-ins handle by the manager.

GPlugInList* List
R::RContainer<GPlugInList,true,true>* Lists
union { ... } Data

Plug-ins managed.