libSBML C++ API  5.18.0
SBasePluginCreator< SBasePluginType, SBMLExtensionType > Class Template Reference
Inheritance diagram for SBasePluginCreator< SBasePluginType, SBMLExtensionType >:
[legend]

Detailed Description

template<class SBasePluginType, class SBMLExtensionType>
class SBasePluginCreator< SBasePluginType, SBMLExtensionType >

Template for SBasePlugin factory objects.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

This is a template class that constitutes another piece of glue used to connect package extension objects to the overall package support framework in libSBML. This particular template class is used to create factory objects that in turn construct new instances of package plugin objects when necessary. These factories are invoked when, for example, libSBML encounters an SBML Level 3 package in an SBML document and needs to activate the corresponding libSBML package extension.

The use of SBasePluginCreator is a simple matter of invoking it on every object derived from SBasePlugin or SBMLDocumentPlugin (which is itself derived from SBasePlugin). The typical use is illustrated by the following code fragment:

SBaseExtensionPoint docExtPoint("core", SBML_DOCUMENT);
SBaseExtensionPoint modelExtPoint("core", SBML_MODEL);
SBasePluginCreator<GroupsModelPlugin, GroupsExtension> modelPluginCreator(modelExtPoint, pkgURIs);

The code above is typically placed in the implementation of the init() method of the package class derived from SBMLExtension. (For the example above, it would be in the GroupsExtension.cpp file.)

Public Types

typedef std::vector< std::string > SupportedPackageURIList
 
typedef std::vector< std::string >::iterator SupportedPackageURIListIter
 

Public Member Functions

virtual SBasePluginCreatorclone () const
 Creates and returns a deep copy of this SBasePluginCreator object. More...
 
virtual SBasePluginType * createPlugin (const std::string &uri, const std::string &prefix, const XMLNamespaces *xmlns) const
 Creats an SBasePlugin object with a given URI and namespace prefix. More...
 
unsigned int getNumOfSupportedPackageURI () const
 Returns the number of package URIs supported by this creator object. More...
 
std::string getSupportedPackageURI (unsigned int i) const
 Returns the URI of the ith package supported by this creator object. More...
 
const SBaseExtensionPointgetTargetExtensionPoint () const
 Returns an SBaseExtensionPoint object tied to this creator object. More...
 
const std::string & getTargetPackageName () const
 Returns the target package name of this creator object. More...
 
int getTargetSBMLTypeCode () const
 Returns a libSBML type code tied to this creator object. More...
 
bool isSupported (const std::string &uri) const
 Returns true if a package with the given namespace URI is supported. More...
 
 SBasePluginCreator (const SBaseExtensionPoint &extPoint, const std::vector< std::string > &packageURIs)
 Constructor for SBasePluginCreator. More...
 
 SBasePluginCreator (const SBasePluginCreator &orig)
 Copy constructor for SBasePluginCreator. More...
 
virtual ~SBasePluginCreator ()
 Destroys this object. More...
 

Member Typedef Documentation

typedef std::vector<std::string> SBasePluginCreatorBase::SupportedPackageURIList
inherited
typedef std::vector<std::string>::iterator SBasePluginCreatorBase::SupportedPackageURIListIter
inherited

Constructor & Destructor Documentation

template<class SBasePluginType, class SBMLExtensionType>
SBasePluginCreator< SBasePluginType, SBMLExtensionType >::SBasePluginCreator ( const SBaseExtensionPoint extPoint,
const std::vector< std::string > &  packageURIs 
)
inline

Constructor for SBasePluginCreator.

Parameters
extPointthe SBaseExtensionPoint object that defines the extension point.
packageURIsa vector of XML namespace URIs that identifies the SBML package namespaces to which this extension applies.
template<class SBasePluginType, class SBMLExtensionType>
SBasePluginCreator< SBasePluginType, SBMLExtensionType >::SBasePluginCreator ( const SBasePluginCreator< SBasePluginType, SBMLExtensionType > &  orig)
inline

Copy constructor for SBasePluginCreator.

Parameters
origthe object to copy.
template<class SBasePluginType, class SBMLExtensionType>
virtual SBasePluginCreator< SBasePluginType, SBMLExtensionType >::~SBasePluginCreator ( )
inlinevirtual

Destroys this object.

Member Function Documentation

template<class SBasePluginType, class SBMLExtensionType>
virtual SBasePluginCreator* SBasePluginCreator< SBasePluginType, SBMLExtensionType >::clone ( ) const
inlinevirtual

Creates and returns a deep copy of this SBasePluginCreator object.

Returns
the (deep) copy of this SBasePluginCreator object.

Implements SBasePluginCreatorBase.

template<class SBasePluginType, class SBMLExtensionType>
virtual SBasePluginType* SBasePluginCreator< SBasePluginType, SBMLExtensionType >::createPlugin ( const std::string &  uri,
const std::string &  prefix,
const XMLNamespaces xmlns 
) const
inlinevirtual

Creats an SBasePlugin object with a given URI and namespace prefix.

Parameters
urithe XML namespace URI for the SBML package implemented by this libSBML package extension.
prefixthe XML namespace prefix of the package (e.g., "layout", "multi").
xmlnsan XMLNamespaces object that identifies namespaces in use by this package extension

Implements SBasePluginCreatorBase.

unsigned int SBasePluginCreatorBase::getNumOfSupportedPackageURI ( ) const
inherited

Returns the number of package URIs supported by this creator object.

Returns
the number of package URIs supported.
See also
getSupportedPackageURI()
std::string SBasePluginCreatorBase::getSupportedPackageURI ( unsigned int  i) const
inherited

Returns the URI of the ith package supported by this creator object.

Parameters
ithe index of the URI being sought.
Returns
the URI being sought, in the form of a string. If no such URI exists, this method will return an empty string.
See also
getNumOfSupportedPackageURI()
const SBaseExtensionPoint& SBasePluginCreatorBase::getTargetExtensionPoint ( ) const
inherited

Returns an SBaseExtensionPoint object tied to this creator object.

Returns
the extension point associated with this creator object.
const std::string& SBasePluginCreatorBase::getTargetPackageName ( ) const
inherited

Returns the target package name of this creator object.

Returns
a string, the package name.
int SBasePluginCreatorBase::getTargetSBMLTypeCode ( ) const
inherited

Returns a libSBML type code tied to this creator object.

Returns
the integer type code.
bool SBasePluginCreatorBase::isSupported ( const std::string &  uri) const
inherited

Returns true if a package with the given namespace URI is supported.

Parameters
urithe XML namespace URI to test.
Returns
true if the URI applies to this package extension, false otherwise.