libSBML C++ API
libSBML 5.17.2 C++ API
|
{core}
Base class for SBML Level 3 package plug-ins.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.
The SBMLExtension class is a component of the libSBML package extension mechanism. It is an abstract class that is extended by each package extension implementation. The SBMLExtension class provides methods for managing common attributes of package extensions (e.g., package name, package version), registration of instantiated SBasePluginCreator objects, and initialization/registration of package extensions when the library code for the package is loaded.
Public Member Functions | |
virtual void | addL2Namespaces (XMLNamespaces *xmlns) const |
Adds the package's Level 2 namespace(s). More... | |
virtual SBMLExtension * | clone () const =0 |
Creates and returns a deep copy of this SBMLExtension object. More... | |
virtual void | enableL2NamespaceForDocument (SBMLDocument *doc) const |
Called to enable the package on the SBMLDocument object. More... | |
virtual unsigned int | getLevel (const std::string &uri) const =0 |
Returns the SBML Level associated with the given XML namespace URI. More... | |
virtual const std::string & | getName () const =0 |
Returns the nickname of this package. More... | |
int | getNumOfSBasePlugins () const |
Returns the number of SBasePluginCreatorBase objects stored in this object. More... | |
unsigned int | getNumOfSupportedPackageURI () const |
Returns the number of supported package namespace URIs. More... | |
virtual unsigned int | getPackageVersion (const std::string &uri) const =0 |
Returns the package version associated with the given XML namespace URI. More... | |
virtual SBMLNamespaces * | getSBMLExtensionNamespaces (const std::string &uri) const =0 |
Returns a specialized SBMLNamespaces object corresponding to a given namespace URI. More... | |
virtual const char * | getStringFromTypeCode (int typeCode) const =0 |
Returns a string representation of a type code. More... | |
const std::string & | getSupportedPackageURI (unsigned int n) const |
Returns the nth XML namespace URI. More... | |
virtual const std::string & | getURI (unsigned int sbmlLevel, unsigned int sbmlVersion, unsigned int pkgVersion) const =0 |
Returns the XML namespace URI for a given Level and Version. More... | |
virtual unsigned int | getVersion (const std::string &uri) const =0 |
Returns the SBML Version associated with the given XML namespace URI. More... | |
bool | isEnabled () const |
Returns true if this package is enabled. More... | |
virtual bool | isInUse (SBMLDocument *doc) const |
Indicates whether this extension is being used by the given SBMLDocument. More... | |
bool | isSupported (const std::string &uri) const |
Returns true if the given XML namespace URI is supported by this package extension. More... | |
SBMLExtension & | operator= (const SBMLExtension &rhs) |
Assignment operator for SBMLExtension. More... | |
virtual void | removeL2Namespaces (XMLNamespaces *xmlns) const |
Removes the package's Level 2 namespace(s). More... | |
SBMLExtension () | |
Constructor; creates a new SBMLExtension object. More... | |
SBMLExtension (const SBMLExtension &orig) | |
Copy constructor. More... | |
bool | setEnabled (bool isEnabled) |
Enable or disable this package. More... | |
virtual | ~SBMLExtension () |
Destroy this SBMLExtension object. More... | |
SBMLExtension::SBMLExtension | ( | ) |
Constructor; creates a new SBMLExtension object.
SBMLExtension::SBMLExtension | ( | const SBMLExtension & | orig | ) |
Copy constructor.
This creates a copy of an SBMLExtension object.
orig | the SBMLExtension object to copy. |
|
virtual |
Destroy this SBMLExtension object.
|
virtual |
Adds the package's Level 2 namespace(s).
This virtual method should be overridden by all package extensions that want to serialize to an SBML Level 2 annotation. In Level 2, the XML namespace declaration for the package is not placed on the top-level SBML document object but rather inside individual annotations. addL2Namespaces() is invoked automatically for Level 2 documents when an SBMLExtensionNamespace object is created; removeL2Namespaces() is automatically invoked by SBMLDocument to prevent the namespace(s) from being put on the top-level SBML Level 2 element (because Level 2 doesn't support namespaces there); and enableL2NamespaceForDocument() is called automatically when any SBML document (of any Level/Version) is read in.
xmlns | an XMLNamespaces object that will be used for the annotation. Implementation should override this method with something that adds the package's namespace(s) to the set of namespaces in xmlns . For instance, here is the code from the Layout package extension: if (!xmlns->containsUri( LayoutExtension::getXmlnsL2())) xmlns->add(LayoutExtension::getXmlnsL2(), "layout"); |
Reimplemented in LayoutExtension, and RenderExtension.
|
pure virtual |
Creates and returns a deep copy of this SBMLExtension object.
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
|
virtual |
Called to enable the package on the SBMLDocument object.
This virtual method should be overridden by all package extensions that want to serialize to an SBML Level 2 annotation. In Level 2, the XML namespace declaration for the package is not placed on the top-level SBML document object but rather inside individual annotations. addL2Namespaces() is invoked automatically for Level 2 documents when an SBMLExtensionNamespace object is created; removeL2Namespaces() is automatically invoked by SBMLDocument to prevent the namespace(s) from being put on the top-level SBML Level 2 element (because Level 2 doesn't support namespaces there); and enableL2NamespaceForDocument() is called automatically when any SBML document (of any Level/Version) is read in.
doc | the SBMLDocument object for the model. Implementations should override this method with something that enables the package based on the package's namespace(s). For example, here is the code from the Layout package extension: if (doc->getLevel() == 2) |
Reimplemented in LayoutExtension, and RenderExtension.
|
pure virtual |
Returns the SBML Level associated with the given XML namespace URI.
uri | the string of URI that represents a version of the package. |
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
|
pure virtual |
Returns the nickname of this package.
This returns the short-form name of an SBML Level 3 package implemented by a given SBMLExtension-derived class. Examples of such names are "layout", "fbc", etc.
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
int SBMLExtension::getNumOfSBasePlugins | ( | ) | const |
Returns the number of SBasePluginCreatorBase objects stored in this object.
unsigned int SBMLExtension::getNumOfSupportedPackageURI | ( | ) | const |
Returns the number of supported package namespace URIs.
|
pure virtual |
Returns the package version associated with the given XML namespace URI.
uri | the string of URI that represents a version of this package. |
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
|
pure virtual |
Returns a specialized SBMLNamespaces object corresponding to a given namespace URI.
LibSBML package extensions each define a subclass of SBMLExtensionNamespaces. This object has the form
SBMLExtensionNamespaces<class SBMLExtensionType>
For example, this kind of object for the Layout package is
SBMLExtensionNamespaces<LayoutExtension>
The present method returns the appropriate object corresponding to the given XML namespace URI in argument uri
.
uri | the namespace URI that represents one of versions of the package implemented in this extension. |
NULL
if the given uri
is not defined in the corresponding package.Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
|
pure virtual |
Returns a string representation of a type code.
This method takes a numerical type code typeCode
for a component object implemented by this package extension, and returns a string representing that type code.
typeCode | the type code to turn into a string. |
typeCode
.Implemented in FbcExtension, LayoutExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
const std::string & SBMLExtension::getSupportedPackageURI | ( | unsigned int | n | ) | const |
Returns the nth XML namespace URI.
n | the index number of the namespace URI being sought. |
|
pure virtual |
Returns the XML namespace URI for a given Level and Version.
sbmlLevel | the SBML Level. |
sbmlVersion | the SBML Version. |
pkgVersion | the version of the package. |
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
|
pure virtual |
Returns the SBML Version associated with the given XML namespace URI.
uri | the string of URI that represents a version of the package. |
Implemented in LayoutExtension, FbcExtension, MultiExtension, CompExtension, QualExtension, GroupsExtension, and RenderExtension.
bool SBMLExtension::isEnabled | ( | ) | const |
Returns true
if this package is enabled.
true
if this package is enabled, false
otherwise.
|
virtual |
Indicates whether this extension is being used by the given SBMLDocument.
The default implementation returns true
. This means that when a document had this extension enabled, it will not be possible to convert it to SBML Level 2 as we cannot make sure that the extension can be converted.
doc | the SBML document to test. |
Reimplemented in LayoutExtension, and RenderExtension.
bool SBMLExtension::isSupported | ( | const std::string & | uri | ) | const |
Returns true
if the given XML namespace URI is supported by this package extension.
true
if the given XML namespace URI (equivalent to a package version) is supported by this package extension, false
otherwise. SBMLExtension & SBMLExtension::operator= | ( | const SBMLExtension & | rhs | ) |
Assignment operator for SBMLExtension.
rhs | the object whose values are used as the basis of the assignment. |
|
virtual |
Removes the package's Level 2 namespace(s).
This virtual method should be overridden by all package extensions that want to serialize to an SBML Level 2 annotation. In Level 2, the XML namespace declaration for the package is not placed on the top-level SBML document object but rather inside individual annotations. addL2Namespaces() is invoked automatically for Level 2 documents when an SBMLExtensionNamespace object is created; removeL2Namespaces() is automatically invoked by SBMLDocument to prevent the namespace(s) from being put on the top-level SBML Level 2 element (because Level 2 doesn't support namespaces there); and enableL2NamespaceForDocument() is called automatically when any SBML document (of any Level/Version) is read in.
xmlns | an XMLNamespaces object that will be used for the annotation. Implementations should override this method with something that removes the package's namespace(s) from the set of namespaces in xmlns . For instance, here is the code from the Layout package extension: for (int n = 0; n < xmlns->getNumNamespaces(); n++) { if (xmlns->getURI(n) == LayoutExtension::getXmlnsL2()) xmlns->remove(n); } |
Reimplemented in LayoutExtension, and RenderExtension.
bool SBMLExtension::setEnabled | ( | bool | isEnabled | ) |
Enable or disable this package.
isEnabled | flag indicating whether to enable (if true ) or disable (false ) this package extension. |
true
if this call succeeded; false
otherwise.