libSBML C++ API  5.18.0
SBMLConverterRegister< SBMLConversionType > Class Template Reference

Detailed Description

template<class SBMLConversionType>
class SBMLConverterRegister< SBMLConversionType >

Template for SBML converter registry registrations.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.

The converter registry, implemented as a singleton object of class SBMLConverterRegistry, maintains a list of known converters and provides methods for discovering them. LibSBML comes with a number of converters built-in, but applications can create their own converters and add them to the set known to libSBML. Such converters would be subclasses of SBMLConverter.

To register themselves, the subclasses should provide an init() method that calls the SBMLConverterRegistry::addConverter() method on the SBMLConverter instance. For example, if a new converter class named SweetConverter were to be created, it should provide an init() method along the following lines:

#ifdef __cplusplus
#include <algorithm>
#include <string>
void SweetConverter::init()
{
}

Then, to perform the registration, the caller code should perform a final step of instantiatiating the template in a separate file used for this purpose for all user-defined converters:

static SBMLConverterRegister<SweetConverter> registerSweetConverter;
... other converter template instantiations here ...

For more information about the registry, please consult the introduction to the class SBMLRegistry.

Public Member Functions

 SBMLConverterRegister ()
 Constructor. More...
 

Constructor & Destructor Documentation

template<class SBMLConversionType>
SBMLConverterRegister< SBMLConversionType >::SBMLConverterRegister ( )
inline

Constructor.

This constructor invokes the init() method of the class given as the template parameter. When an object of the concrete class is created (typically as a static instance in the caller's code), the act of calling the init() method should do the steps of registering the converter with the SBML converter registry.