libSBML C++ API
5.20.4
|
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.
There are differences in the definitions of components between different SBML Levels, as well as Versions within Levels. For example, the "sboTerm" attribute was not introduced until Level 2 Version 2, and then only on certain component classes; the SBML Level 2 Version 3 specification moved the "sboTerm" attribute to the SBase class, thereby allowing nearly all components to have SBO annotations. As a result of differences such as those, libSBML needs to track the SBML Level and Version of every object created.
The purpose of the SBMLNamespaces object class is to make it easier to communicate SBML Level and Version data between libSBML constructors and other methods. The SBMLNamespaces object class tracks 3-tuples (triples) consisting of SBML Level, Version, and the corresponding SBML XML namespace.
The plural name (SBMLNamespaces) is not a mistake, because in SBML Level 3, objects may have extensions added by Level 3 packages used by a given model and therefore may have multiple namespaces associated with them; however, until the introduction of SBML Level 3, the SBMLNamespaces object only records one SBML Level/Version/namespace combination at a time. Most constructors for SBML objects in libSBML take a SBMLNamespaces object as an argument, thereby allowing the constructor to produce the proper combination of attributes and other internal data structures for the given SBML Level and Version.
Public Member Functions | |
int | addNamespace (const std::string &uri, const std::string &prefix) |
Add an XML namespace (a pair of URI and prefix) to the set of namespaces within this SBMLNamespaces object. | |
int | addNamespaces (const XMLNamespaces *xmlns) |
Add the given XML namespaces list to the set of namespaces within this SBMLNamespaces object. | |
int | addPackageNamespace (const std::string &pkgName, unsigned int pkgVersion, const std::string &prefix="") |
Add an XML namespace (a pair of URI and prefix) of a package extension to the set of namespaces within this SBMLNamespaces object. | |
int | addPackageNamespaces (const XMLNamespaces *xmlns) |
Add the XML namespaces of package extensions in the given XMLNamespace object to the set of namespaces within this SBMLNamespaces object (Non-package XML namespaces are not added by this function). | |
virtual SBMLNamespaces * | clone () const |
Creates and returns a deep copy of this SBMLNamespaces object. | |
unsigned int | getLevel () |
Get the SBML Level of this SBMLNamespaces object. | |
unsigned int | getLevel () const |
Get the SBML Level of this SBMLNamespaces object. | |
XMLNamespaces * | getNamespaces () |
Get the XML namespaces list for this SBMLNamespaces object. | |
const XMLNamespaces * | getNamespaces () const |
Get the XML namespaces list for this SBMLNamespaces object. | |
virtual const std::string & | getPackageName () const |
Returns the name of the main package for this namespace. | |
virtual std::string | getURI () const |
Returns a string representing the SBML XML namespace of this object. | |
unsigned int | getVersion () |
Get the SBML Version of this SBMLNamespaces object. | |
unsigned int | getVersion () const |
Get the SBML Version of this SBMLNamespaces object. | |
bool | isValidCombination () |
Predicate returning true if the given set of namespaces represent a valid set. | |
SBMLNamespaces & | operator= (const SBMLNamespaces &rhs) |
Assignment operator for SBMLNamespaces. | |
int | removeNamespace (const std::string &uri) |
Removes an XML namespace from the set of namespaces within this SBMLNamespaces object. | |
int | removePackageNamespace (unsigned int level, unsigned version, const std::string &pkgName, unsigned int pkgVersion) |
Removes an XML namespace of a package extension from the set of namespaces within this SBMLNamespaces object. | |
SBMLNamespaces (const SBMLNamespaces &orig) | |
Copy constructor; creates a copy of a SBMLNamespaces. | |
SBMLNamespaces (unsigned int level, unsigned int version, const std::string &pkgName, unsigned int pkgVersion, const std::string pkgPrefix="") | |
(For extensions) Creates a new SBMLNamespaces object corresponding to the combination of (1) the given SBML level and version , and (2) the given package with the package version . | |
SBMLNamespaces (unsigned int level=SBML_DEFAULT_LEVEL, unsigned int version=SBML_DEFAULT_VERSION) | |
Creates a new SBMLNamespaces object corresponding to the given SBML level and version . | |
virtual | ~SBMLNamespaces () |
Destroys this SBMLNamespaces object. | |
Static Public Member Functions | |
static void | freeSBMLNamespaces (List *supportedNS) |
Frees the list of supported namespaces as generated by getSupportedNamespaces(). | |
static std::string | getSBMLNamespaceURI (unsigned int level, unsigned int version) |
Returns a string representing the SBML XML namespace for the given level and version of SBML. | |
static const List * | getSupportedNamespaces () |
Returns a list of all supported SBMLNamespaces in this version of libsbml. | |
static bool | isSBMLNamespace (const std::string &uri) |
Predicate returning true if the given URL is one of SBML XML namespaces. | |
SBMLNamespaces::SBMLNamespaces | ( | unsigned int | level = SBML_DEFAULT_LEVEL , |
unsigned int | version = SBML_DEFAULT_VERSION |
||
) |
Creates a new SBMLNamespaces object corresponding to the given SBML level
and version
.
The plural name (SBMLNamespaces) is not a mistake, because in SBML Level 3, objects may have extensions added by Level 3 packages used by a given model and therefore may have multiple namespaces associated with them. In SBML Levels below Level 3, the SBMLNamespaces object only records one SBML Level/Version/namespace combination at a time. Most constructors for SBML objects in libSBML take a SBMLNamespaces object as an argument, thereby allowing the constructor to produce the proper combination of attributes and other internal data structures for the given SBML Level and Version.
level | the SBML level. |
version | the SBML version. |
SBMLNamespaces::SBMLNamespaces | ( | unsigned int | level, |
unsigned int | version, | ||
const std::string & | pkgName, | ||
unsigned int | pkgVersion, | ||
const std::string | pkgPrefix = "" |
||
) |
(For extensions) Creates a new SBMLNamespaces object corresponding to the combination of (1) the given SBML level
and version
, and (2) the given package
with the package
version
.
(For Extension)
The plural name (SBMLNamespaces) is not a mistake, because in SBML Level 3, objects may have extensions added by Level 3 packages used by a given model and therefore may have multiple namespaces associated with them. In SBML Levels below Level 3, the SBMLNamespaces object only records one SBML Level/Version/namespace combination at a time. Most constructors for SBML objects in libSBML take a SBMLNamespaces object as an argument, thereby allowing the constructor to produce the proper combination of attributes and other internal data structures for the given SBML Level and Version.
level | the SBML Level. |
version | the SBML Version. |
pkgName | the string of package name (e.g. "layout", "multi"). |
pkgVersion | the package version. |
pkgPrefix | the prefix of the package namespace (e.g. "layout", "multi") to be added. The package's name will be used if the given string is empty (default). |
SBMLExtensionException | if the extension module that supports the combination of the given SBML Level, SBML Version, package name, and package version has not been registered with libSBML. |
Creates a new SBMLNamespaces object corresponding to the combination of (1) the given SBML level
and version
, and (2) the given package
with the package
version
.
|
virtual |
Destroys this SBMLNamespaces object.
SBMLNamespaces::SBMLNamespaces | ( | const SBMLNamespaces & | orig | ) |
Copy constructor; creates a copy of a SBMLNamespaces.
orig | the SBMLNamespaces instance to copy. |
int SBMLNamespaces::addNamespace | ( | const std::string & | uri, |
const std::string & | prefix | ||
) |
Add an XML namespace (a pair of URI and prefix) to the set of namespaces within this SBMLNamespaces object.
uri | the XML namespace to be added. |
prefix | the prefix of the namespace to be added. |
int SBMLNamespaces::addNamespaces | ( | const XMLNamespaces * | xmlns | ) |
Add the given XML namespaces list to the set of namespaces within this SBMLNamespaces object.
The following code gives an example of how one could add the XHTML namespace to the list of namespaces recorded by the top-level <sbml>
element of a model. It gives the new namespace a prefix of html
.
xmlns | the XML namespaces to be added. |
int SBMLNamespaces::addPackageNamespace | ( | const std::string & | pkgName, |
unsigned int | pkgVersion, | ||
const std::string & | prefix = "" |
||
) |
Add an XML namespace (a pair of URI and prefix) of a package extension to the set of namespaces within this SBMLNamespaces object.
The SBML Level and SBML Version of this object is used.
pkgName | the string of package name (e.g. "layout", "multi"). |
pkgVersion | the package version. |
prefix | the prefix of the package namespace to be added. The package's name will be used if the given string is empty (default). |
will be returned).
int SBMLNamespaces::addPackageNamespaces | ( | const XMLNamespaces * | xmlns | ) |
Add the XML namespaces of package extensions in the given XMLNamespace object to the set of namespaces within this SBMLNamespaces object (Non-package XML namespaces are not added by this function).
xmlns | the XML namespaces to be added. |
NULL
.
|
virtual |
Creates and returns a deep copy of this SBMLNamespaces object.
Reimplemented in SBMLExtensionNamespaces< SBMLExtensionType >.
|
static |
Frees the list of supported namespaces as generated by getSupportedNamespaces().
supportedNS | the list to be freed. |
unsigned int SBMLNamespaces::getLevel | ( | ) |
Get the SBML Level of this SBMLNamespaces object.
unsigned int SBMLNamespaces::getLevel | ( | ) | const |
Get the SBML Level of this SBMLNamespaces object.
XMLNamespaces * SBMLNamespaces::getNamespaces | ( | ) |
Get the XML namespaces list for this SBMLNamespaces object.
The plural name (SBMLNamespaces) is not a mistake, because in SBML Level 3, objects may have extensions added by Level 3 packages used by a given model and therefore may have multiple namespaces associated with them. In SBML Levels below Level 3, the SBMLNamespaces object only records one SBML Level/Version/namespace combination at a time. Most constructors for SBML objects in libSBML take a SBMLNamespaces object as an argument, thereby allowing the constructor to produce the proper combination of attributes and other internal data structures for the given SBML Level and Version.
const XMLNamespaces * SBMLNamespaces::getNamespaces | ( | ) | const |
Get the XML namespaces list for this SBMLNamespaces object.
The plural name (SBMLNamespaces) is not a mistake, because in SBML Level 3, objects may have extensions added by Level 3 packages used by a given model and therefore may have multiple namespaces associated with them. In SBML Levels below Level 3, the SBMLNamespaces object only records one SBML Level/Version/namespace combination at a time. Most constructors for SBML objects in libSBML take a SBMLNamespaces object as an argument, thereby allowing the constructor to produce the proper combination of attributes and other internal data structures for the given SBML Level and Version.
|
virtual |
Returns the name of the main package for this namespace.
Reimplemented in SBMLExtensionNamespaces< SBMLExtensionType >.
|
static |
Returns a string representing the SBML XML namespace for the given level
and version
of SBML.
level | the SBML level. |
version | the SBML version. |
|
static |
Returns a list of all supported SBMLNamespaces in this version of libsbml.
|
virtual |
Returns a string representing the SBML XML namespace of this object.
Reimplemented in SBMLExtensionNamespaces< SBMLExtensionType >.
unsigned int SBMLNamespaces::getVersion | ( | ) |
Get the SBML Version of this SBMLNamespaces object.
unsigned int SBMLNamespaces::getVersion | ( | ) | const |
Get the SBML Version of this SBMLNamespaces object.
|
static |
Predicate returning true
if the given URL is one of SBML XML namespaces.
uri | the URI of namespace. |
true
if the "uri" is one of SBML namespaces, false
otherwise.bool SBMLNamespaces::isValidCombination | ( | ) |
Predicate returning true
if the given set of namespaces represent a valid set.
true
if the set of namespaces is valid, false
otherwise. SBMLNamespaces & SBMLNamespaces::operator= | ( | const SBMLNamespaces & | rhs | ) |
Assignment operator for SBMLNamespaces.
rhs | the object whose values are used as the basis of the assignment. |
int SBMLNamespaces::removeNamespace | ( | const std::string & | uri | ) |
Removes an XML namespace from the set of namespaces within this SBMLNamespaces object.
uri | the XML namespace to be added. |
int SBMLNamespaces::removePackageNamespace | ( | unsigned int | level, |
unsigned | version, | ||
const std::string & | pkgName, | ||
unsigned int | pkgVersion | ||
) |
Removes an XML namespace of a package extension from the set of namespaces within this SBMLNamespaces object.
level | the SBML level. |
version | the SBML version. |
pkgName | the string of package name (e.g. "layout", "multi"). |
pkgVersion | the package version. |