libSBML C++ API
5.20.2
|
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 class provides a central registry of all extensions known to libSBML. Each package extension must be registered with the registry. The registry class is accessed by various classes to retrieve information about known package extensions and to create additional attributes and/or elements by factory objects of the package extensions.
Public Member Functions | |
int | addExtension (const SBMLExtension *ext) |
Add the given SBMLExtension object to this SBMLExtensionRegistry. More... | |
void | addL2Namespaces (XMLNamespaces *xmlns) const |
Adds SBML Level 2 namespaces to the namespace list. More... | |
void | disableUnusedPackages (SBMLDocument *doc) |
Disables unused packages. More... | |
void | enableL2NamespaceForDocument (SBMLDocument *doc) const |
Enables package extensions that support serialization to SBML annotations. More... | |
const ASTBasePlugin * | getASTPlugin (unsigned int i) |
std::vector< ASTBasePlugin * > | getASTPlugins () |
SBMLExtension * | getExtension (const std::string &package) |
Returns an SBMLExtension object with the given package URI or package name. More... | |
unsigned int | getNumASTPlugins () |
unsigned int | getNumExtension (const SBaseExtensionPoint &extPoint) |
Returns the number of extensions that have a given extension point. More... | |
bool | isEnabled (const std::string &uri) |
Returns true if the given extension is enabled. More... | |
bool | isRegistered (const std::string &uri) |
Returns true if a package extension is registered for the corresponding package URI. More... | |
void | removeL2Namespaces (XMLNamespaces *xmlns) const |
Removes SBML Level 2 namespaces from the namespace list. More... | |
bool | setEnabled (const std::string &uri, bool isEnabled) |
Enables or disable the package with the given URI. More... | |
Static Public Member Functions | |
static void | disablePackage (const std::string &package) |
Disables the package with the given URI or name. More... | |
static void | enablePackage (const std::string &package) |
Enables the package with the given URI / name. More... | |
static std::vector< std::string > | getAllRegisteredPackageNames () |
Returns a list of registered packages. More... | |
static SBMLExtensionRegistry & | getInstance () |
Returns a singleton instance of the registry. More... | |
static unsigned int | getNumRegisteredPackages () |
Returns the number of registered packages. More... | |
static std::string | getRegisteredPackageName (unsigned int index) |
Returns the nth registered package. More... | |
static List * | getRegisteredPackageNames () |
Returns a list of registered packages. More... | |
static bool | isPackageEnabled (const std::string &package) |
Returns true if the named package is enabled. More... | |
Private Member Functions | |
const SBMLExtension * | getExtensionInternal (const std::string &package) |
Returns an SBMLExtension object with the given package URI or package name (string). More... | |
SBMLExtensionRegistry & | operator= (const SBMLExtensionRegistry &rhs) |
SBMLExtensionRegistry () | |
SBMLExtensionRegistry (const SBMLExtensionRegistry &orig) | |
~SBMLExtensionRegistry () | |
Static Private Attributes | |
static bool | registered |
|
private |
|
private |
|
private |
int SBMLExtensionRegistry::addExtension | ( | const SBMLExtension * | ext | ) |
Add the given SBMLExtension object to this SBMLExtensionRegistry.
ext | the SBMLExtension object to be added. |
void SBMLExtensionRegistry::addL2Namespaces | ( | XMLNamespaces * | xmlns | ) | const |
Adds SBML Level 2 namespaces to the namespace list.
This will call all overridden SBMLExtension::addL2Namespaces()
methods.
xmlns | an XMLNamespaces object providing one or more namespaces to be added. |
|
static |
Disables the package with the given URI or name.
package | a string representing the URI or name of the SBML package whose package extension is to be disabled. |
void SBMLExtensionRegistry::disableUnusedPackages | ( | SBMLDocument * | doc | ) |
Disables unused packages.
This method walks through all extensions in the list of plugins of the given SBML document doc
, and disables all that are not being used.
doc | the SBMLDocument object whose unused package extensions should be disabled. |
void SBMLExtensionRegistry::enableL2NamespaceForDocument | ( | SBMLDocument * | doc | ) | const |
Enables package extensions that support serialization to SBML annotations.
SBML Level 2 does not have a package mechanism in the way that SBML Level 3 does. However, SBML annotations can be used to store SBML constructs. In fact, a widely-used approach to developing SBML Level 3 packages involves first using them as annotations.
doc | the SBMLDocument object for which this should be enabled. |
|
static |
Enables the package with the given URI / name.
package | the name or URI of a package to enable. |
|
static |
Returns a list of registered packages.
This method returns a vector of strings containing the nicknames of the SBML packages for which package extensions are registered with this copy of libSBML. The vector will contain std::string
objects.
const ASTBasePlugin * SBMLExtensionRegistry::getASTPlugin | ( | unsigned int | i | ) |
std::vector< ASTBasePlugin * > SBMLExtensionRegistry::getASTPlugins | ( | ) |
SBMLExtension* SBMLExtensionRegistry::getExtension | ( | const std::string & | package | ) |
Returns an SBMLExtension object with the given package URI or package name.
package | a string representing the URI or name of the SBML package whose package extension is being sought. |
|
private |
Returns an SBMLExtension object with the given package URI or package name (string).
package | the URI or name of the package extension. |
|
static |
Returns a singleton instance of the registry.
Callers need to obtain a copy of the package extension registry before they can invoke its methods. The registry is implemented as a singleton, and this is the method callers can use to get a copy of it.
unsigned int SBMLExtensionRegistry::getNumASTPlugins | ( | ) |
unsigned int SBMLExtensionRegistry::getNumExtension | ( | const SBaseExtensionPoint & | extPoint | ) |
Returns the number of extensions that have a given extension point.
extPoint | the SBaseExtensionPoint object. |
|
static |
Returns the number of registered packages.
|
static |
Returns the nth registered package.
index | zero-based index of the package name to return. |
NULL
if none such exists.
|
static |
Returns a list of registered packages.
This method returns a List object containing the nicknames of the SBML packages for which package extensions are registered with this copy of libSBML. The list will contain strings (e.g., "layout"
, "fbc"
, etc.) and has to be freed by the caller.
bool SBMLExtensionRegistry::isEnabled | ( | const std::string & | uri | ) |
Returns true
if the given extension is enabled.
uri | the URI of the target package. |
false
if the given package is disabled or not registered, true
otherwise.
|
static |
Returns true
if the named package is enabled.
package | the name or URI of a package to test. |
true
if the package is enabled, false
otherwise. bool SBMLExtensionRegistry::isRegistered | ( | const std::string & | uri | ) |
Returns true
if a package extension is registered for the corresponding package URI.
uri | the URI of the target package. |
true
if the package with the given URI is registered, otherwise returns false
.
|
private |
void SBMLExtensionRegistry::removeL2Namespaces | ( | XMLNamespaces * | xmlns | ) | const |
Removes SBML Level 2 namespaces from the namespace list.
This will call all overridden SBMLExtension::removeL2Namespaces()
methods.
xmlns | an XMLNamespaces object listing one or more namespaces to be removed. |
bool SBMLExtensionRegistry::setEnabled | ( | const std::string & | uri, |
bool | isEnabled | ||
) |
Enables or disable the package with the given URI.
uri | the URI of the target package. |
isEnabled | true to enable the package, false to disable. |
false
if isEnabled
is false
or the given package is not registered, otherwise this method returns true
.
|
staticprivate |