DynamicPlugInFactory Class Reference

This class is used to perform dynamic plug-in registration. More...

#include <PlugInRegistration.h>

List of all members.

Public Member Functions

 DynamicPlugInFactory ()
virtual ~DynamicPlugInFactory ()
virtual void init (bool locate, std::vector< std::string > &dynamicPlugIns)=0
virtual PlugIncreatePlugIn (const std::string &name)=0


Detailed Description

This class is used to perform dynamic plug-in registration.

To perform dynamic plug-in registration, a subclass of this class must be created that performs the actual dynamic plug-in registration. The subclass must then be provided as the second argument to the REGISTER_DYNAMIC_MODULE() macro. Please read Advanced Plug-In Registration for more details.

Definition at line 219 of file PlugInRegistration.h.


Constructor & Destructor Documentation

DynamicPlugInFactory::DynamicPlugInFactory (  ) 

Constructor.

Warning:
Subclasses should NOT perform any logic in their constructors.

Definition at line 228 of file PlugInRegistration.h.

virtual DynamicPlugInFactory::~DynamicPlugInFactory (  )  [virtual]

Definition at line 229 of file PlugInRegistration.h.


Member Function Documentation

virtual void DynamicPlugInFactory::init ( bool  locate,
std::vector< std::string > &  dynamicPlugIns 
) [pure virtual]

Subclasses should perform any dynamic plug-in lookup in this function.

This function will be called once per application run, with a true value passed for the locate parameter. It is during this invocation, that this function should locate all dynamic plug-ins and insert unique string identifiers for each plug-in into the dynamicPlugIns vector. Every other time this function is invoked, the locate parameter will be passed a value of false. When this is done the previously located identifiers (those found when this function was called with a value of true for locate) will be provided to the dynamicPlugIns argument. The purpose of performing the additional calls to init() with locate having a value of false, is to allow the class instance to re-initialize any member state that might be necessary to implement the createPlugIn() function.

Note:
Any time this function is invoked, all the Opticks services will be constructed and valid. For example, this function's implementation can use Service<ConfigurationSettings>().
Parameters:
locate When true, this function should perform dynamic plug-in lookup and populate dynamicPlugIns with unique string identifiers for each plug-in. When false, this class can re-initialize any member state required for createPlugIn() to work properly. When false, the dynamicPlugIns argument will be pre-populated with the string identifiers located when function was called with this paramter having a value of true.
dynamicPlugIns The list of unique string identifiers for the dynamically located plug-ins. When the locate parameter is true, this list should be populated. When the locate parameter is false, this list will be pre-populated with the earlier values. When the locate paramter is false, any changes to this vector will be ignored by the invoking class. The string identifiers populated into this list, will be used when invoking createPlugIn().
See also:
Advanced Plug-In Registration

virtual PlugIn* DynamicPlugInFactory::createPlugIn ( const std::string &  name  )  [pure virtual]

Construct the given PlugIn instance.

Parameters:
name Construct the PlugIn instance associated with the unique string identifier. The string identifiers provided will be those returned from the init() function.
Returns:
The PlugIn instance associated with the given string identifier. If the data required to construct the dynamic plug-in is no longer available, please return NULL.


Software Development Kit - Opticks 4.9.0 Build 16218