libSBML C++ API  5.11.0
Deletion Class Reference
Inheritance diagram for Deletion:
[legend]

Detailed Description

comp Deletion of an object from a submodel.

The Deletion class was introduced by the SBML Level 3 Hierarchical Model Composition package (“comp”) to allow elements of submodels to be removed before instantiation.

The Deletion object class is used to define a deletion operation to be applied when a submodel instantiates a model definition. Deletions may be useful in hierarchical model composition scenarios for various reasons. For example, some components in a submodel may be redundant in the composed model, perhaps because the same features are implemented in a different way in the new model.

Deletions function as follows. When the Model to which the Submodel object refers (via the "modelRef" attribute) is read and processed for inclusion into the composed model, each Deletion object identifies an object to remove from that Model instance. The resulting submodel instance consists of everything in the Model object instance minus the entities referenced by the list of Deletion objects.

As might be expected, deletions can have wide-ranging implications, especially when the object deleted has substantial substructure, as in the case of reactions. The following are rules regarding deletions and their effects.

  • An object that has been deleted is considered inaccessible. Any element that has been deleted (or replaced) may not be referenced by an SBaseRef object.
  • If the deleted object has child objects and other structures, the child objects and substructure are also considered to be deleted.
  • It is not an error to delete explicitly an object that is already deleted by implication (for example as a result of the second point above). The resulting model is the same.
  • If the deleted object is from an SBML namespace that is not understood by the interpreter, the deletion must be ignored—the object will not need to be deleted, as the interpreter could not understand the package. If an interpreter cannot tell whether a referenced object does not exist or if exists in an unparsed namespace it may produce a warning.

The Deletion object class is subclassed from SBaseRef, and reuses all the machinery provided by SBaseRef. In addition, it defines two optional attributes, "id" and "name". The "id" attribute can be used to give an identifier to a given deletion operation. The identifier has no mathematical meaning, but it may be useful for creating submodels that can be manipulated more directly by other submodels. (Indeed, it is legitimate for an enclosing model definition to delete a deletion!)

The optional "name" attribute is provided on Deletion for the same reason it is provided on other elements that have identifiers; viz., to provide for the possibility of giving a human-readable name to the object. The name may be useful in situations when deletions are displayed to modelers.

Examples:
spec_example3.cpp, and spec_example4.cpp.

Public Member Functions

virtual bool accept (SBMLVisitor &v) const
 Accepts the given SBMLVisitor. More...
 
virtual void clearReferencedElement ()
 Removes the saved referenced element, if it had been saved earlier. More...
 
virtual Deletionclone () const
 Creates and returns a deep copy of this Deletion object. More...
 
SBaseRefcreateSBaseRef ()
 Creates a new, empty SBaseRef, adds it to this SBaseRef and returns the created SBaseRef. More...
 
 Deletion (unsigned int level=CompExtension::getDefaultLevel(), unsigned int version=CompExtension::getDefaultVersion(), unsigned int pkgVersion=CompExtension::getDefaultPackageVersion())
 Creates a new Deletion with the given level, version, and package version. More...
 
 Deletion (CompPkgNamespaces *compns)
 Creates a new Deletion with the given CompPkgNamespaces object. More...
 
 Deletion (const Deletion &source)
 Copy constructor. 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...
 
virtual const std::string & getElementName () const
 Returns the XML element name of this SBML object. More...
 
virtual const std::string & getId () const
 Returns the value of the "id" attribute of this Deletion. 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 const std::string & getName () const
 Returns the value of the "name" attribute of this Deletion. 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 SBasegetReferencedElement ()
 Returns the object pointed to by this element. More...
 
virtual SBasegetReferencedElementFrom (Model *model)
 Examines the referenced Model for the referenced object, and returns it, if found. More...
 
const SBaseRefgetSBaseRef () const
 Get the child sBaseRef of this sBaseRef. More...
 
SBaseRefgetSBaseRef ()
 Get the child sBaseRef 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. More...
 
virtual bool isSetId () const
 Predicate returning true or false depending on whether this object's "id" attribute has been 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 isSetName () const
 Predicate returning true or false depending on whether this object's "name" 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 isSetUnitRef () const
 Predicate returning true or false depending on whether this SBaseRef's "unitRef" attribute has been set. More...
 
Deletionoperator= (const Deletion &source)
 Assignment operator. More...
 
virtual int performDeletion ()
 DEPRECATED FUNCTION: DO NOT USE. More...
 
virtual int removeFromParentAndDelete ()
 Finds this SBaseRef's parent, which can either be a List or can be another SBaseRef, and tells it to remove this. More...
 
virtual void renameSIdRefs (const std::string &oldid, const std::string &newid)
 Replaces all uses of a given SIdRef type attribute value with another value. More...
 
virtual int saveReferencedElement ()
 Finds and stores the referenced object. More...
 
virtual int setId (const std::string &id)
 Sets the value of the "id" attribute of this Deletion. 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 setName (const std::string &name)
 Sets the value of the "name" attribute of this Deletion. 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 setUnitRef (const std::string &id)
 Sets the value of the "unitRef" attribute of this SBaseRef. More...
 
virtual int unsetId ()
 Unsets the value of the "id" attribute of this Deletion. 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 unsetName ()
 Unsets the value of the "name" attribute of this Deletion. 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 unsetUnitRef ()
 Unsets the value of the "unitRef" attribute of this SBaseRef. More...
 
virtual ~Deletion ()
 Destructor. More...
 

Constructor & Destructor Documentation

Deletion::Deletion ( unsigned int  level = CompExtension::getDefaultLevel(),
unsigned int  version = CompExtension::getDefaultVersion(),
unsigned int  pkgVersion = CompExtension::getDefaultPackageVersion() 
)

Creates a new Deletion with the given level, version, and package version.

Parameters
levelthe SBML Level
versionthe Version within the SBML Level
pkgVersionthe version of the package
Deletion::Deletion ( CompPkgNamespaces compns)

Creates a new Deletion with the given CompPkgNamespaces object.

Deletion::Deletion ( const Deletion source)

Copy constructor.

Deletion::~Deletion ( )
virtual

Destructor.

Member Function Documentation

bool SBaseRef::accept ( SBMLVisitor v) const
virtualinherited

Accepts the given SBMLVisitor.

Returns
the result of calling v.visit(), which indicates whether or not the Visitor would like to visit the SBML object's next sibling object (if available).

Reimplemented in Replacing.

void SBaseRef::clearReferencedElement ( )
virtualinherited

Removes the saved referenced element, if it had been saved earlier.

Deletion * Deletion::clone ( ) const
virtual

Creates and returns a deep copy of this Deletion object.

Returns
a (deep) copy of this Deletion object

Reimplemented from SBaseRef.

SBaseRef * SBaseRef::createSBaseRef ( )
inherited

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

Returns
the newly created SBaseRef object instance.
List * SBaseRef::getAllElements ( ElementFilter filter = NULL)
virtualinherited

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

Returns
a List* of pointers to all children objects.
SBase * SBaseRef::getElementByMetaId ( const std::string &  metaid)
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.

Parameters
metaidstring representing the metaid of objects to find
Returns
a pointer to the SBase element with the given metaid.
SBase * SBaseRef::getElementBySId ( const std::string &  id)
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.

Parameters
idstring representing the id of objects to find
Returns
a pointer to the SBase element with the given id.
const std::string & Deletion::getElementName ( ) const
virtual

Returns the XML element name of this SBML object.

Returns
the name of this element, as a text string.

Reimplemented from SBaseRef.

const string & Deletion::getId ( ) const
virtual

Returns the value of the "id" attribute of this Deletion.

Returns
the name of this Deletion.
const string & SBaseRef::getIdRef ( ) const
virtualinherited

Returns the value of the "idRef" attribute of this SBaseRef.

Returns
the value of the "idRef" attribute of this SBaseRef.
const string & SBaseRef::getMetaIdRef ( ) const
virtualinherited

Returns the value of the "metaIdRef" attribute of this SBaseRef.

Returns
the value of the "metaIdRef" attribute of this SBaseRef.
const string & Deletion::getName ( ) const
virtual

Returns the value of the "name" attribute of this Deletion.

Returns
the name of this Deletion.
int SBaseRef::getNumReferents ( ) const
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.

Returns
integer value between 0 and 4: the number of different ways this element points to its referent.

Reimplemented in ReplacedElement.

const string & SBaseRef::getPortRef ( ) const
virtualinherited

Returns the value of the "portRef" attribute of this SBaseRef.

Returns
the value of the "portRef" attribute of this SBaseRef.
SBase * SBaseRef::getReferencedElement ( )
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.

SBase * SBaseRef::getReferencedElementFrom ( Model model)
virtualinherited

Examines the referenced Model for the referenced object, and returns it, if found.

Parameters
modelthe Model in which to look for the object referenced by this SBaseRef.
Returns
the element in the referenced Model to which this SBaseRef refers. If this object references an object in a Submodel, the returned object will be in the instantiated Model in that Submodel.

Reimplemented in ReplacedElement.

const SBaseRef * SBaseRef::getSBaseRef ( ) const
inherited

Get the child sBaseRef of this sBaseRef.

Returns
the const SBaseRef child of this SBaseRef, or NULL if none exists.
SBaseRef * SBaseRef::getSBaseRef ( )
inherited

Get the child sBaseRef of this SBaseRef.

Returns
the SBaseRef child of this SBaseRef, or NULL if none exists.
int Deletion::getTypeCode ( ) const
virtual

Returns the libSBML type code of this object instance.

LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters 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.
Returns
the SBML type code for this object: SBML_COMP_DELETION
Warning
The specific integer values of the possible type codes may be reused by different Level 3 package plug-ins. Thus, to identifiy the correct code, it is necessary to invoke both getTypeCode() and getPackageName().
See also
getElementName()
getPackageName()

Reimplemented from SBaseRef.

const string & SBaseRef::getUnitRef ( ) const
virtualinherited

Returns the value of the "unitRef" attribute of this SBaseRef.

Returns
the value of the "unitRef" attribute of this SBaseRef.
bool SBaseRef::hasRequiredAttributes ( ) const
virtualinherited

Returns true if getNumReferents() is exactly 1.

Returns
boolean: 'true' if the attributes are correctly set; 'false' if not.

Reimplemented in Port, and Replacing.

bool Deletion::isSetId ( ) const
virtual

Predicate returning true or false depending on whether this object's "id" attribute has been set.

Some words of explanation about the set/unset/isSet methods: The SBML specifications define certain attributes on some classes of objects as being optional. This requires an application to be careful about the distinction between two cases when reading a model: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value if one exists, and (2) a given attribute has been set to a value, but the value happens to be an empty string. The situation can be ambiguous when reading a model from a file or data stream and then examining the data objects that libSBML constructs as a result. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
Returns
true if the "id" attribute of this object has been set, false otherwise.
bool SBaseRef::isSetIdRef ( ) const
virtualinherited

Predicate returning true or false depending on whether this SBaseRef's "idRef" attribute has been set.

Returns
true if this SBaseRef's "idRef" attribute has been set, otherwise false is returned.
bool SBaseRef::isSetMetaIdRef ( ) const
virtualinherited

Predicate returning true or false depending on whether this SBaseRef's "metaIdRef" attribute has been set.

Returns
true if this SBaseRef's "metaIdRef" attribute has been set, otherwise false is returned.
bool Deletion::isSetName ( ) const
virtual

Predicate returning true or false depending on whether this object's "name" attribute has been set.

Some words of explanation about the set/unset/isSet methods: The SBML specifications define certain attributes on some classes of objects as being optional. This requires an application to be careful about the distinction between two cases when reading a model: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value if one exists, and (2) a given attribute has been set to a value, but the value happens to be an empty string. The situation can be ambiguous when reading a model from a file or data stream and then examining the data objects that libSBML constructs as a result. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
Returns
true if the "name" attribute of this object has been set, false otherwise.
bool SBaseRef::isSetPortRef ( ) const
virtualinherited

Predicate returning true or false depending on whether this SBaseRef's "portRef" attribute has been set.

Returns
true if this SBaseRef's "portRef" attribute has been set, otherwise false is returned.
bool SBaseRef::isSetSBaseRef ( ) const
inherited

Predicate for testing whether the sBaseRef for this SBaseRef is set.

Returns
true if the sBaseRef of this SBaseRef is set, false otherwise.
bool SBaseRef::isSetUnitRef ( ) const
virtualinherited

Predicate returning true or false depending on whether this SBaseRef's "unitRef" attribute has been set.

Returns
true if this SBaseRef's "unitRef" attribute has been set, otherwise false is returned.
Deletion & Deletion::operator= ( const Deletion source)

Assignment operator.

int SBaseRef::performDeletion ( )
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.

int SBaseRef::removeFromParentAndDelete ( )
virtualinherited

Finds this SBaseRef's parent, which can either be a List or can be another SBaseRef, and tells it to remove this.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:

Reimplemented in ReplacedBy.

void SBaseRef::renameSIdRefs ( const std::string &  oldid,
const std::string &  newid 
)
virtualinherited

Replaces all uses of a given SIdRef type attribute value with another value.

In SBML, object identifiers are of a data type called SId. In SBML Level 3, an explicit data type called SIdRef was introduced for attribute values that refer to SId values; in previous Levels of SBML, this data type did not exist and attributes were simply described to as "referring to an identifier", but the effective data type was the same as SIdRefin Level 3. These and other methods of libSBML refer to the type SIdRef for all Levels of SBML, even if the corresponding SBML specification did not explicitly name the data type.

This method works by looking at all attributes and (if appropriate) mathematical formulas in MathML content, comparing the referenced identifiers to the value of oldid. If any matches are found, the matching values are replaced with newid. The method does not descend into child elements.

Parameters
oldidthe old identifier
newidthe new identifier

Reimplemented in ReplacedElement, Port, and Replacing.

int Deletion::saveReferencedElement ( )
virtual

Finds and stores the referenced object.

It finds its Submodel parent, gets its instantiated Model object, calls 'getReferencedElementFrom' on that model, and stores the result.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:

Reimplemented from SBaseRef.

int Deletion::setId ( const std::string &  id)
virtual

Sets the value of the "id" attribute of this Deletion.

This method fails if the id is not a valid syntax for an SId.

Parameters
idthe identifier to use
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Examples:
spec_example4.cpp.
int SBaseRef::setIdRef ( const std::string &  id)
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_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). A sBaseRef must use exactly one method to point to a submodel element.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Examples:
spec_example2.cpp, spec_example3.cpp, and spec_example4.cpp.
int SBaseRef::setMetaIdRef ( const std::string &  id)
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_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). An sBaseRef must use exactly one method to point to a submodel element.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Deletion::setName ( const std::string &  name)
virtual

Sets the value of the "name" attribute of this Deletion.

The string in name is copied.

Parameters
namethe new name for the Deletion
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::setPortRef ( const std::string &  id)
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_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). An SBaseRef must use exactly one method to point to a submodel element.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:

Reimplemented in Port.

Examples:
spec_example3.cpp, and spec_example4.cpp.
int SBaseRef::setSBaseRef ( const SBaseRef sBaseRef)
inherited

Sets the sBaseRef definition of this SBaseRef to a copy of the given SBaseRef object instance.

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

Parameters
sBaseRefthe SBaseRef object instance to use.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::setUnitRef ( const std::string &  id)
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_VALUE), or if the SBaseRef already points to an element of the submodel using a different interface (LIBSBML_OPERATION_FAILED). A sBaseRef must use exactly one method to point to a submodel element.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Deletion::unsetId ( )
virtual

Unsets the value of the "id" attribute of this Deletion.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::unsetIdRef ( )
virtualinherited

Unsets the value of the "idRef" attribute of this SBaseRef.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Examples:
spec_example3.cpp, and spec_example4.cpp.
int SBaseRef::unsetMetaIdRef ( )
virtualinherited

Unsets the value of the "metaIdRef" attribute of this SBaseRef.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Deletion::unsetName ( )
virtual

Unsets the value of the "name" attribute of this Deletion.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::unsetPortRef ( )
virtualinherited

Unsets the value of the "portRef" attribute of this SBaseRef.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::unsetSBaseRef ( )
virtualinherited

Unsets the child SBaseRef of this SBaseRef.

Deletes the former SBaseRef child, if one existed.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBaseRef::unsetUnitRef ( )
virtualinherited

Unsets the value of the "unitRef" attribute of this SBaseRef.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are: