libSBML Perl API  libSBML 5.10.0 Perl API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CompSBasePlugin Class Reference
Inheritance diagram for CompSBasePlugin:
[legend]

Detailed Description

{comp} Implementation of the “comp” package extention to the SBase construct.

The CompSBasePlugin class inherits from the SBasePlugin class, and codifies the extentions to the SBase class defined in the Hierarchical Model Composition package (“comp”). This extention allows the modeler to define one or more submodel elements which the parent SBase object replaces, and/or a single submodel element which replaces the parent SBase object.

This is accomplished through the addition of an optional ListOfReplacedElements child, which may contain one or more ReplacedElement objects, each of which references a submodel object to be replaced by the containing SBase object, and through the addition of a single optional ReplacedBy child, which references a submodel object which is to replace the containing SBase object.

If a single SBase element both contains a ListOfReplacedElements and has a ReplacedBy child, it and all the referenced ReplacedElement objects are to be replaced by the object referenced by the ReplacedBy element.

See also
ReplacedElement
ReplacedBy

Public Member Functions

int addReplacedElement (const ReplacedElement *replacedElement)
 Adds a copy of the given ReplacedElement object to the list of ReplacedElements. More...
 
virtual void clearReplacedElements ()
 Remove all ReplacedElements, if any exist. More...
 
virtual CompSBasePluginclone () const
 Creates and returns a deep copy of this CompSBasePlugin object. More...
 
 CompSBasePlugin (const std::string &uri, const std::string &prefix, CompPkgNamespaces *compns)
 Constructor. More...
 
 CompSBasePlugin (const CompSBasePlugin &orig)
 Copy constructor. More...
 
ReplacedBycreateReplacedBy ()
 Creates a new, empty ReplacedBy, adds it to this CompSBasePlugin and returns the created ReplacedBy. More...
 
ReplacedElementcreateReplacedElement ()
 Creates a ReplacedElement object, adds it to the end of the ReplacedElement objects list and returns a pointer to the newly created object. More...
 
virtual ListgetAllElements (ElementFilter *filter=NULL)
 Returns a List of all child SBase objects, including those nested to an arbitrary depth. More...
 
virtual SBasegetElementByMetaId (const std::string &metaid)
 Returns the first child element it can find with the given metaid, or itself if it has the given metaid, or NULL if no such object is found. More...
 
virtual SBasegetElementBySId (const std::string &id)
 Returns the first child element found that has the given id in the model-wide SId namespace, or NULL if no such object is found. More...
 
const std::string & getElementNamespace () const
 Returns the XML namespace (URI) of the package extension of this plugin object. More...
 
unsigned int getLevel () const
 Returns the SBML level of the package extension of this plugin object. More...
 
const ListOfReplacedElementsgetListOfReplacedElements () const
 Returns the ListOf object that holds all replacedElements. More...
 
unsigned int getNumReplacedElements () const
 Returns the number of ReplacedElements for this CompSBasePlugin. More...
 
const std::string & getPackageName () const
 Returns the package name of this plugin object. More...
 
unsigned int getPackageVersion () const
 Returns the package version of the package extension of this plugin object. More...
 
SBasegetParentSBMLObject ()
 Returns the parent SBase object to which this plugin object connected. More...
 
const SBasegetParentSBMLObject () const
 Returns the parent SBase object to which this plugin object connected. More...
 
const std::string & getPrefix () const
 Returns the prefix of the package extension of this plugin object. More...
 
const ReplacedBygetReplacedBy () const
 Get the child ReplacedBy of this SBase. More...
 
ReplacedBygetReplacedBy ()
 Get the child ReplacedBy of this SBase. More...
 
ReplacedElementgetReplacedElement (unsigned int n)
 Returns the ReplacedElement with the given index. More...
 
const ReplacedElementgetReplacedElement (unsigned int n) const
 Returns the ReplacedElement with the given index. More...
 
SBMLDocumentgetSBMLDocument ()
 Returns the parent SBMLDocument of this plugin object. More...
 
const SBMLDocumentgetSBMLDocument () const
 Returns the parent SBMLDocument of this plugin object. More...
 
std::string getURI () const
 Gets the URI to which this element belongs to. More...
 
unsigned int getVersion () const
 Returns the SBML version of the package extension of this plugin object. More...
 
bool isSetReplacedBy () const
 Predicate for testing whether the ReplacedBy for this SBase is set. More...
 
virtual void logInvalidId (const std::string &attribute, const std::string &wrongattribute)
 Helper to log a common type of error. More...
 
CompSBasePluginoperator= (const CompSBasePlugin &orig)
 Assignment operator for CompSBasePlugin. More...
 
ReplacedElementremoveReplacedElement (unsigned int index)
 Removes the ReplacedElement with the given index. More...
 
int setElementNamespace (const std::string &uri)
 Sets the XML namespace to which this element belongs to. More...
 
int setReplacedBy (const ReplacedBy *replacedBy)
 Sets the ReplacedBy definition of this SBase to a copy of the given ReplacedBy object instance. More...
 
virtual int unsetReplacedBy ()
 Unsets the child ReplacedBy of this SBase. More...
 
virtual ~CompSBasePlugin ()
 Destroy this object. More...
 

Constructor & Destructor Documentation

CompSBasePlugin::CompSBasePlugin ( const std::string &  uri,
const std::string &  prefix,
CompPkgNamespaces compns 
)

Constructor.

CompSBasePlugin::CompSBasePlugin ( const CompSBasePlugin orig)

Copy constructor.

Creates a copy of this CompSBasePlugin object.

CompSBasePlugin::~CompSBasePlugin ( )
virtual

Destroy this object.

Member Function Documentation

int CompSBasePlugin::addReplacedElement ( const ReplacedElement replacedElement)

Adds a copy of the given ReplacedElement object to the list of ReplacedElements.

Parameters
replacedElementthe ReplacedElement object to be added to the list of ReplacedElements. Fails if the added ReplacedElement is NULL, does not match the level/version/package of the parent object, or cannot be added to the list of replaced elements.
Returns
integer value indicating success/failure of the operation. The possible return values are:
void CompSBasePlugin::clearReplacedElements ( )
virtual

Remove all ReplacedElements, if any exist.

CompSBasePlugin * CompSBasePlugin::clone ( ) const
virtual

Creates and returns a deep copy of this CompSBasePlugin object.

Returns
a (deep) copy of this CompSBasePlugin object

Implements SBasePlugin.

Reimplemented in CompModelPlugin.

ReplacedBy * CompSBasePlugin::createReplacedBy ( )

Creates a new, empty ReplacedBy, adds it to this CompSBasePlugin and returns the created ReplacedBy.

Returns
the newly created ReplacedBy object instance
ReplacedElement * CompSBasePlugin::createReplacedElement ( )

Creates a ReplacedElement object, adds it to the end of the ReplacedElement objects list and returns a pointer to the newly created object.

Returns
a newly created ReplacedElement object
List * CompSBasePlugin::getAllElements ( ElementFilter *  filter = NULL)
virtual

Returns a List of all child SBase objects, including those nested to an arbitrary depth.

Returns
a List of pointers to all children objects.

Reimplemented from SBasePlugin.

Reimplemented in CompModelPlugin.

SBase * CompSBasePlugin::getElementByMetaId ( const std::string &  metaid)
virtual

Returns the first child element it can find with the given metaid, or itself if it has the given metaid, or NULL if no such object is found.

Parameters
metaidstring representing the metaid of objects to find
Returns
a pointer to the SBase element with the given metaid.

Reimplemented from SBasePlugin.

Reimplemented in CompModelPlugin.

SBase * CompSBasePlugin::getElementBySId ( const std::string &  id)
virtual

Returns the first child element found that has the given id in the model-wide SId namespace, or NULL if no such object is found.

Parameters
idstring representing the id of objects to find
Returns
a pointer to the SBase element with the given id.

Reimplemented from SBasePlugin.

Reimplemented in CompModelPlugin.

const std::string & SBasePlugin::getElementNamespace ( ) const
inherited

Returns the XML namespace (URI) of the package extension of this plugin object.

Returns
the URI of the package extension of this plugin object.
unsigned int SBasePlugin::getLevel ( ) const
inherited

Returns the SBML level of the package extension of this plugin object.

Returns
the SBML level of the package extension of this plugin object.
const ListOfReplacedElements * CompSBasePlugin::getListOfReplacedElements ( ) const

Returns the ListOf object that holds all replacedElements.

Returns
the ListOf object that holds all replacedElements.
unsigned int CompSBasePlugin::getNumReplacedElements ( ) const

Returns the number of ReplacedElements for this CompSBasePlugin.

Returns
the number of ReplacedElements for this CompSBasePlugin.
const std::string & SBasePlugin::getPackageName ( ) const
inherited

Returns the package name of this plugin object.

Returns
the package name of this plugin object.
unsigned int SBasePlugin::getPackageVersion ( ) const
inherited

Returns the package version of the package extension of this plugin object.

Returns
the package version of the package extension of this plugin object.
SBase * SBasePlugin::getParentSBMLObject ( )
inherited

Returns the parent SBase object to which this plugin object connected.

Returns
the parent SBase object to which this plugin object connected.
const SBase * SBasePlugin::getParentSBMLObject ( ) const
inherited

Returns the parent SBase object to which this plugin object connected.

Returns
the parent SBase object to which this plugin object connected.
const std::string & SBasePlugin::getPrefix ( ) const
inherited

Returns the prefix of the package extension of this plugin object.

Returns
the prefix of the package extension of this plugin object.
const ReplacedBy * CompSBasePlugin::getReplacedBy ( ) const

Get the child ReplacedBy of this SBase.

Returns
the const ReplacedBy child of this SBase
ReplacedBy * CompSBasePlugin::getReplacedBy ( )

Get the child ReplacedBy of this SBase.

Returns
the ReplacedBy child of this SBase.
ReplacedElement * CompSBasePlugin::getReplacedElement ( unsigned int  n)

Returns the ReplacedElement with the given index.

Parameters
nthe index number of the ReplacedElement to get.
Returns
the nth ReplacedElement in the ListOfReplacedElements. If the index is invalid, NULL is returned.
const ReplacedElement * CompSBasePlugin::getReplacedElement ( unsigned int  n) const

Returns the ReplacedElement with the given index.

Parameters
nthe index number of the ReplacedElement to get.
Returns
the nth ReplacedElement in the ListOfReplacedElements. If the index is invalid, NULL is returned.
SBMLDocument * SBasePlugin::getSBMLDocument ( )
inherited

Returns the parent SBMLDocument of this plugin object.

Returns
the parent SBMLDocument object of this plugin object.
const SBMLDocument * SBasePlugin::getSBMLDocument ( ) const
inherited

Returns the parent SBMLDocument of this plugin object.

Returns
the parent SBMLDocument object of this plugin object.
std::string SBasePlugin::getURI ( ) const
inherited

Gets the URI to which this element belongs to.

For example, all elements that belong to SBML Level 3 Version 1 Core must would have the URI "http://www.sbml.org/sbml/level3/version1/core"; all elements that belong to Layout Extension Version 1 for SBML Level 3 Version 1 Core must would have the URI "http://www.sbml.org/sbml/level3/version1/layout/version1/"

Unlike getElementNamespace, this function first returns the URI for this element by looking into the SBMLNamespaces object of the document with the its package name. if not found it will return the result of getElementNamespace

Returns
the URI this elements
See also
getPackageName()
getElementNamespace()
SBMLDocument::getSBMLNamespaces()
getSBMLDocument()
unsigned int SBasePlugin::getVersion ( ) const
inherited

Returns the SBML version of the package extension of this plugin object.

Returns
the SBML version of the package extension of this plugin object.
bool CompSBasePlugin::isSetReplacedBy ( ) const

Predicate for testing whether the ReplacedBy for this SBase is set.

Returns
true if the ReplacedBy of this SBase is set, false otherwise.
void CompSBasePlugin::logInvalidId ( const std::string &  attribute,
const std::string &  wrongattribute 
)
virtual

Helper to log a common type of error.

CompSBasePlugin & CompSBasePlugin::operator= ( const CompSBasePlugin orig)

Assignment operator for CompSBasePlugin.

ReplacedElement * CompSBasePlugin::removeReplacedElement ( unsigned int  index)

Removes the ReplacedElement with the given index.

A pointer to the ReplacedElement that was removed is returned. If no ReplacedElement has been removed, NULL is returned.

Parameters
indexthe index of the ReplacedElement object to remove
Returns
the ReplacedElement object removed. As mentioned above, the caller owns the returned object. NULL is returned if the given index is out of range.
int SBasePlugin::setElementNamespace ( const std::string &  uri)
inherited

Sets the XML namespace to which this element belongs to.

For example, all elements that belong to SBML Level 3 Version 1 Core must set the namespace to "http://www.sbml.org/sbml/level3/version1/core"; all elements that belong to Layout Extension Version 1 for SBML Level 3 Version 1 Core must set the namespace to "http://www.sbml.org/sbml/level3/version1/layout/version1/"

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
int CompSBasePlugin::setReplacedBy ( const ReplacedBy replacedBy)

Sets the ReplacedBy definition of this SBase to a copy of the given ReplacedBy object instance.

This method fails if the added ReplacedBy does not match the level/version/package of the parent object or if the added ReplacedBy cannot be copied.

Parameters
replacedBythe ReplacedBy object instance to use.
Returns
integer value indicating success/failure of the operation. The possible return values are:
int CompSBasePlugin::unsetReplacedBy ( )
virtual

Unsets the child ReplacedBy of this SBase.

Returns
integer value indicating success/failure of the operation. The possible return values are: