libSBML C++ API
libSBML 5.13.0 C++ API
|
{comp}
comp Indicates an object replaced by another.The ReplacedBy class was introduced by the SBML Level 3 Hierarchical Model Composition (“comp”) package to allow submodel elements to be 'canonical' versions of the element while still allowing the parent model to reference those elements. Whereas a ReplacedElement object indicates that the containing object replaces another, a ReplacedBy object indicates the converse: the parent object is to be replaced by another object.
As is the case with ReplacedElement, the ReplacedBy class inherits from SBaseRef. It additionally defines one required attribute ("submodelRef"), defined in libSBML in the Replacing class.
Public Member Functions | |
virtual void | clearReferencedElement () |
Removes the saved referenced element, if it had been saved earlier. More... | |
virtual ReplacedBy * | clone () const |
Creates and returns a deep copy of this ReplacedBy object. More... | |
SBaseRef * | createSBaseRef () |
Creates a new, empty SBaseRef, adds it to this SBaseRef and returns the created SBaseRef. More... | |
virtual List * | getAllElements (ElementFilter *filter=NULL) |
Returns a List of all child SBase* objects, including those nested to an arbitrary depth. More... | |
virtual SBase * | getElementByMetaId (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 SBase * | getElementBySId (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... | |
virtual const std::string & | getElementName () const |
Returns the XML element name of this SBML object. More... | |
virtual const std::string & | getIdRef () const |
Returns the value of the "idRef" attribute of this SBaseRef. More... | |
virtual const std::string & | getMetaIdRef () const |
Returns the value of the "metaIdRef" attribute of this SBaseRef. More... | |
virtual int | getNumReferents () const |
Returns how many elements are being referred to by this SBaseRef. More... | |
virtual const std::string & | getPortRef () const |
Returns the value of the "portRef" attribute of this SBaseRef. More... | |
virtual SBase * | getReferencedElement () |
Returns the object pointed to by this element. More... | |
virtual SBase * | getReferencedElementFrom (Model *model) |
Examines the referenced Model for the referenced object, and returns it, if found. More... | |
const SBaseRef * | getSBaseRef () const |
Get the child sBaseRef of this sBaseRef. More... | |
SBaseRef * | getSBaseRef () |
Get the child sBaseRef of this SBaseRef. More... | |
virtual const std::string & | getSubmodelRef () const |
Returns the value of the "submodelRef" attribute of this SBaseRef. More... | |
virtual int | getTypeCode () const |
Returns the libSBML type code of this object instance. More... | |
virtual const std::string & | getUnitRef () const |
Returns the value of the "unitRef" attribute of this SBaseRef. More... | |
virtual bool | hasRequiredAttributes () const |
Returns true if getNumReferents() is exactly 1 and if the submodelRef is set. More... | |
virtual bool | isSetIdRef () const |
Predicate returning true or false depending on whether this SBaseRef's "idRef" attribute has been set. More... | |
virtual bool | isSetMetaIdRef () const |
Predicate returning true or false depending on whether this SBaseRef's "metaIdRef" attribute has been set. More... | |
virtual bool | isSetPortRef () const |
Predicate returning true or false depending on whether this SBaseRef's "portRef" attribute has been set. More... | |
bool | isSetSBaseRef () const |
Predicate for testing whether the sBaseRef for this SBaseRef is set. More... | |
virtual bool | isSetSubmodelRef () const |
Predicate returning true or false depending on whether this SBaseRef's "submodelRef" attribute has been set. More... | |
virtual bool | isSetUnitRef () const |
Predicate returning true or false depending on whether this SBaseRef's "unitRef" attribute has been set. More... | |
ReplacedBy & | operator= (const ReplacedBy &source) |
Assignment operator. More... | |
virtual int | performDeletion () |
DEPRECATED FUNCTION: DO NOT USE. More... | |
virtual int | performReplacement () |
DEPRECATED FUNCTION: DO NOT USE. More... | |
virtual int | removeFromParentAndDelete () |
Finds this ReplacedBy's SBase parent, gets the “comp” plugin from it, and tells that to remove this. More... | |
virtual void | renameSIdRefs (const std::string &oldid, const std::string &newid) |
ReplacedBy (unsigned int level=CompExtension::getDefaultLevel(), unsigned int version=CompExtension::getDefaultVersion(), unsigned int pkgVersion=CompExtension::getDefaultPackageVersion()) | |
Creates a new ReplacedBy with the given level, version, and package version. More... | |
ReplacedBy (CompPkgNamespaces *compns) | |
Creates a new ReplacedBy with the given CompPkgNamespaces object. More... | |
ReplacedBy (const ReplacedBy &source) | |
Copy constructor. More... | |
virtual int | saveReferencedElement () |
Finds and stores the referenced object. More... | |
virtual int | setIdRef (const std::string &id) |
Sets the value of the "idRef" attribute of this SBaseRef. More... | |
virtual int | setMetaIdRef (const std::string &id) |
Sets the value of the "metaIdRef" attribute of this SBaseRef. More... | |
virtual int | setPortRef (const std::string &id) |
Sets the value of the "portRef" attribute of this SBaseRef. More... | |
int | setSBaseRef (const SBaseRef *sBaseRef) |
Sets the sBaseRef definition of this SBaseRef to a copy of the given SBaseRef object instance. More... | |
virtual int | setSubmodelRef (const std::string &id) |
Sets the value of the "submodelRef" attribute of this SBaseRef. More... | |
virtual int | setUnitRef (const std::string &id) |
Sets the value of the "unitRef" attribute of this SBaseRef. More... | |
virtual int | unsetIdRef () |
Unsets the value of the "idRef" attribute of this SBaseRef. More... | |
virtual int | unsetMetaIdRef () |
Unsets the value of the "metaIdRef" attribute of this SBaseRef. More... | |
virtual int | unsetPortRef () |
Unsets the value of the "portRef" attribute of this SBaseRef. More... | |
virtual int | unsetSBaseRef () |
Unsets the child SBaseRef of this SBaseRef. More... | |
virtual int | unsetSubmodelRef () |
Unsets the value of the "SubmodelRef" attribute of this SBaseRef. More... | |
virtual int | unsetUnitRef () |
Unsets the value of the "unitRef" attribute of this SBaseRef. More... | |
virtual | ~ReplacedBy () |
Destructor. More... | |
Protected Member Functions | |
virtual int | performReplacementAndCollect (std::set< SBase *> *removed, std::set< SBase *> *toremove) |
Updates all IDs and references to those IDs. More... | |
Friends | |
class | CompModelPlugin |
ReplacedBy::ReplacedBy | ( | unsigned int | level = CompExtension::getDefaultLevel() , |
unsigned int | version = CompExtension::getDefaultVersion() , |
||
unsigned int | pkgVersion = CompExtension::getDefaultPackageVersion() |
||
) |
Creates a new ReplacedBy with the given level, version, and package version.
level | the SBML Level |
version | the Version within the SBML Level |
pkgVersion | the version of the package |
ReplacedBy::ReplacedBy | ( | CompPkgNamespaces * | compns | ) |
Creates a new ReplacedBy with the given CompPkgNamespaces object.
compns | the namespace to use |
ReplacedBy::ReplacedBy | ( | const ReplacedBy & | source | ) |
Copy constructor.
|
virtual |
Destructor.
|
virtualinherited |
Removes the saved referenced element, if it had been saved earlier.
|
virtual |
Creates and returns a deep copy of this ReplacedBy object.
Reimplemented from SBaseRef.
|
inherited |
|
virtualinherited |
Returns a List of all child SBase* objects, including those nested to an arbitrary depth.
|
virtualinherited |
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.
metaid | string representing the metaid of objects to find |
metaid
.
|
virtualinherited |
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.
id | string representing the id of objects to find |
id
.
|
virtual |
Returns the XML element name of this SBML object.
Reimplemented from SBaseRef.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Returns how many elements are being referred to by this SBaseRef.
A valid SBaseRef will have exactly one. Possible referents are portRef, idRef, unitRef, and metaIdRef.
Reimplemented in ReplacedElement.
|
virtualinherited |
|
virtualinherited |
Returns the object pointed to by this element.
If that element was previously found and set with 'saveReferencedElement', that element is returned; otherwise, 'saveReferencedElement' is called first, and the found element is returned.
Examines the referenced Model for the referenced object, and returns it, if found.
Reimplemented in ReplacedElement.
|
inherited |
|
inherited |
|
virtualinherited |
|
virtual |
Returns the libSBML type code of this object instance.
SBML_
. The set of possible type codes for core elements is defined in the enumeration SBMLTypeCode_t, and in addition, libSBML plug-ins for SBML Level 3 packages define their own extra enumerations of type codes (e.g., SBMLLayoutTypeCode_t for the Level 3 Layout package). Note that different Level 3 package plug-ins may use overlapping type codes; to identify the package to which a given object belongs, call the getPackageName()
method on the object.Reimplemented from SBaseRef.
|
virtualinherited |
|
virtualinherited |
Returns true if getNumReferents() is exactly 1 and if the submodelRef is set.
Reimplemented from SBaseRef.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
|
inherited |
|
virtualinherited |
|
virtualinherited |
ReplacedBy & ReplacedBy::operator= | ( | const ReplacedBy & | source | ) |
Assignment operator.
|
virtualinherited |
DEPRECATED FUNCTION: DO NOT USE.
Deletes the referenced object, plus any other elements that element points to through ReplacedElement or ReplacedBy children. Instead of calling this function directly, use 'CompModelPlugin::instantiateSubmodels' instead, which deals with all the intricacies of replacements and deletions, and gives you access to the non-flattened hierarchical form of the model.
|
virtualinherited |
DEPRECATED FUNCTION: DO NOT USE.
To retain old functionality, this function calls performReplacementAndCollect, and then actually removes the now-redundant element. However, this can lead to doubly-deleted elements, as well as the incorrect interpretation of some models. The replacement function performReplacementAndCollect has been marked protected, in the hopes that people will instead simply use CompModelPlugin::instantiateSubmodels, which hides all the complexity while still allowing access to a non-flattened version of a hierarchical model.
|
protectedvirtual |
Updates all IDs and references to those IDs.
Does not actually remove the now-redundant element! The elements to be removed is instead added to 'toremove', allowing one to remove the element carefully to prevent double-deletion of elements, and to allow the correct interpretation of 'nested' replacements and deletions.
The 'removed' argument is present to ensure that the replaced element was not already removed, which would make it impossible to check it for its old IDs. In normal comp flattening, 'removed' will only contain comp elements, which should usually not be replaced, only deleted.
Implements Replacing.
|
virtual |
Finds this ReplacedBy's SBase parent, gets the “comp” plugin from it, and tells that to remove this.
Reimplemented from SBaseRef.
|
virtualinherited |
Reimplemented from SBaseRef.
Reimplemented in ReplacedElement.
|
virtualinherited |
|
virtualinherited |
Sets the value of the "idRef" attribute of this SBaseRef.
This method fails if the id is not a valid syntax for an SIdRef
(LIBSBML_INVALID_ATTRIBUTE_VALUEendif
|
virtualinherited |
Sets the value of the "metaIdRef" attribute of this SBaseRef.
This method fails if the id is not a valid syntax for an IDREF
(LIBSBML_INVALID_ATTRIBUTE_VALUEendif
|
virtualinherited |
Sets the value of the "portRef" attribute of this SBaseRef.
Fails if the id is not a valid syntax for a PortSIdRef
(LIBSBML_INVALID_ATTRIBUTE_VALUEendif
Reimplemented in Port.
|
inherited |
|
virtualinherited |
Sets the value of the "submodelRef" attribute of this SBaseRef.
Fails if the id is not a valid syntax for an SIdRef.
|
virtualinherited |
Sets the value of the "unitRef" attribute of this SBaseRef.
This method fails if the id is not a valid syntax for a UnitSIdRef
(LIBSBML_INVALID_ATTRIBUTE_VALUEendif
|
virtualinherited |
Unsets the value of the "idRef" attribute of this SBaseRef.
|
virtualinherited |
Unsets the value of the "metaIdRef" attribute of this SBaseRef.
|
virtualinherited |
Unsets the value of the "portRef" attribute of this SBaseRef.
|
virtualinherited |
|
virtualinherited |
Unsets the value of the "SubmodelRef" attribute of this SBaseRef.
|
virtualinherited |
Unsets the value of the "unitRef" attribute of this SBaseRef.
|
friend |