libSBML C API  5.18.0
SBaseRef_t Class Reference

Detailed Description

comp Base class for references to objects.

The SBaseRef_t class was introduced by the SBML Level 3 Hierarchical Model_t Composition (“comp”) package as the principle way by which submodel elements may be referenced. The SBaseRef_t class is usually found as the base class of a Port_t, Deletion_t, ReplacedElement_t, or ReplacedBy_t class, but may appear as an child of one of the above classes if the parent object references a Submodel_t.

An SBaseRef_t object must reference an element using exactly one of the optional attributes of the class. Subclasses of SBaseRef_t may define additional optional attributes that are legal ways to reference an element.

SBaseRef_t objects may reference elements that do not live in the Model_t parent of the SBaseRef_t object. However, the SBaseRef_t class itself does not provide a method of determining which Model_t or Submodel_t is being referenced. The subclasses of SBaseRef_t provide methods for this instead.

Once the Model_t to which the SBaseRef_t object is referencing has been established, there are four optional attributes defined in the SBaseRef_t class that are each methods of referencing an element:

  • "portRef" (type PortSIdRef): As its name implies, this attribute is used to refer to a port identifier, in the case when the reference being constructed with the SBaseRef_t is intended to refer to a port on a submodel. The namespace of the PortSIdRef value is the set of identifiers of type PortSId defined in the submodel, not the parent model.
  • "idRef" (type SIdRef): As its name implies, this attribute is used to refer to a regular identifier (i.e., the value of an "id" attribute on some other object), in the case when the reference being constructed with the SBaseRef_t is intended to refer to an object that does not have a port identifier. The namespace of the SIdRef value is the set of identifiers of type SId defined in the submodel, not the parent model.
  • "unitRef" (type UnitSIdRef): This attribute is used to refer to the identifier of a UnitDefinition_t object. The namespace of the UnitSIdRef value is the set of unit identifiers defined in the submodel, not the parent model. (Note that even though this attribute is of type UnitSIdRef, the reserved unit identifiers that are defined by SBML Level 3 (see Section 3.1.10 of the core specification) are *not* permitted as values of "unitRef". Reserved unit identifiers may not be replaced or deleted.)
  • "metaIdRef" (type IDREF): This attribute is used to refer to a "metaid" attribute value on some other object, in the case when the reference being constructed with the SBaseRef_t is intended to refer to an object that does not have a port identifier. The namespace of the "metaIdRef" value is the entire document in which the referenced model resides, but must refer to a subelement of the referenced model. Since meta identifiers are optional attributes of SBase_t, all SBML objects have the potential to have a meta identifier value.

An SBaseRef_t object may have up to one subcomponent named "sBaseRef", of type SBaseRef_t. This permits recursive structures to be constructed so that objects inside submodels can be referenced.

The form of such recursive references must be as follows. The highest-level SBaseRef_t object of such a chain (which will necessarily be an object of class Port_t, Deletion_t, ReplacedElement_t or ReplacedBy_t, because they are the only classes derived from the class SBaseRef_t) must refer to a Submodel_t object in the containing model. All child SBaseRef_t objects in the chain must refer to components inside the Model_t instance to which the Submodel_t refers.

Public Member Functions

SBaseRef_tSBaseRef_clone (SBaseRef_t *sbr)
 Returns a copy of the given SBaseRef_t structure. More...
 
SBaseRef_tSBaseRef_create (unsigned int level, unsigned int version, unsigned int pkgVersion)
 Creates a new SBaseRef_t structure using the given SBML level and version, and the pkgVersion package version. More...
 
void SBaseRef_free (SBaseRef_t *sbr)
 Frees the given SBaseRef_t structure. More...
 
char * SBaseRef_getIdRef (SBaseRef_t *sbr)
 Takes a SBaseRef_t structure and returns its idRef. More...
 
char * SBaseRef_getMetaIdRef (SBaseRef_t *sbr)
 Takes a SBaseRef_t structure and returns its metaIdRef. More...
 
char * SBaseRef_getPortRef (SBaseRef_t *sbr)
 Takes a SBaseRef_t structure and returns its portRef. More...
 
SBaseRef_tSBaseRef_getSBaseRef (SBaseRef_t *sbr)
 Takes a SBaseRef_t structure and returns its child SBaseRef_t, or NULL if no such child exists. More...
 
char * SBaseRef_getUnitRef (SBaseRef_t *sbr)
 Takes a SBaseRef_t structure and returns its unitRef. More...
 
int SBaseRef_hasRequiredAttributes (SBaseRef_t *sbr)
 Predicate returning true or false depending on whether all the required attributes for the given SBaseRef_t structure have been set. More...
 
int SBaseRef_isSetIdRef (SBaseRef_t *sbr)
 Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's idRef is set. More...
 
int SBaseRef_isSetMetaIdRef (SBaseRef_t *sbr)
 Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's metaIdRef is set. More...
 
int SBaseRef_isSetPortRef (SBaseRef_t *sbr)
 Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's portRef is set. More...
 
int SBaseRef_isSetSBaseRef (SBaseRef_t *sbr)
 Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's child SBaseRef_t is set. More...
 
int SBaseRef_isSetUnitRef (SBaseRef_t *sbr)
 Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's unitRef is set. More...
 
int SBaseRef_setIdRef (SBaseRef_t *sbr, const char *idRef)
 Sets the idRef of the given SBaseRef_t to a copy of idRef. More...
 
int SBaseRef_setMetaIdRef (SBaseRef_t *sbr, const char *metaIdRef)
 Sets the metaIdRef of the given SBaseRef_t to a copy of metaIdRef. More...
 
int SBaseRef_setPortRef (SBaseRef_t *sbr, const char *portRef)
 Sets the portRef of the given SBaseRef_t to a copy of portRef. More...
 
int SBaseRef_setSBaseRef (SBaseRef_t *parent, SBaseRef_t *child)
 Sets the child SBaseRef_t of the parent SBaseRef_t to a copy of child. More...
 
int SBaseRef_setUnitRef (SBaseRef_t *sbr, const char *unitRef)
 Sets the unitRef of the given SBaseRef_t to a copy of unitRef. More...
 
int SBaseRef_unsetIdRef (SBaseRef_t *sbr)
 Unsets the "idRef" attribute of the given SBaseRef_t structure. More...
 
int SBaseRef_unsetMetaIdRef (SBaseRef_t *sbr)
 Unsets the "metaIdRef" attribute of the given SBaseRef_t structure. More...
 
int SBaseRef_unsetPortRef (SBaseRef_t *sbr)
 Unsets the "portRef" attribute of the given SBaseRef_t structure. More...
 
int SBaseRef_unsetSBaseRef (SBaseRef_t *sbr)
 Removes the SBaseRef_t child of the given SBaseRef_t structure. More...
 
int SBaseRef_unsetUnitRef (SBaseRef_t *sbr)
 Unsets the "unitRef" attribute of the given SBaseRef_t structure. More...
 

Member Function Documentation

SBaseRef_t * SBaseRef_clone ( SBaseRef_t sbr)

Returns a copy of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to copy.
Returns
a (deep) copy of the SBaseRef_t.
SBaseRef_t * SBaseRef_create ( unsigned int  level,
unsigned int  version,
unsigned int  pkgVersion 
)

Creates a new SBaseRef_t structure using the given SBML level and version, and the pkgVersion package version.

Parameters
levelan unsigned int, the SBML Level to assign to this SBaseRef_t.
versionan unsigned int, the SBML Version to assign to this SBaseRef_t.
pkgVersionan unsigned int, the SBML 'comp' package Version to assign to this SBaseRef_t.
Returns
a pointer to the newly created SBaseRef_t structure.
void SBaseRef_free ( SBaseRef_t sbr)

Frees the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to free.
char * SBaseRef_getIdRef ( SBaseRef_t sbr)

Takes a SBaseRef_t structure and returns its idRef.

Parameters
sbrthe SBaseRef_t whose idRef is sought.
Returns
the idRef of the given SBaseRef_t, as a pointer to a string.
char * SBaseRef_getMetaIdRef ( SBaseRef_t sbr)

Takes a SBaseRef_t structure and returns its metaIdRef.

Parameters
sbrthe SBaseRef_t whose metaIdRef is sought.
Returns
the metaIdRef of the given SBaseRef_t, as a pointer to a string.
char * SBaseRef_getPortRef ( SBaseRef_t sbr)

Takes a SBaseRef_t structure and returns its portRef.

Parameters
sbrthe SBaseRef_t whose portRef is sought.
Returns
the portRef of the given SBaseRef_t, as a pointer to a string.
SBaseRef_t * SBaseRef_getSBaseRef ( SBaseRef_t sbr)

Takes a SBaseRef_t structure and returns its child SBaseRef_t, or NULL if no such child exists.

Parameters
sbrthe SBaseRef_t whose child SBaseRef_t is sought.
Returns
the child SBaseRef_t of the given SBaseRef_t, or NULL if no such child exists.
char * SBaseRef_getUnitRef ( SBaseRef_t sbr)

Takes a SBaseRef_t structure and returns its unitRef.

Parameters
sbrthe SBaseRef_t whose unitRef is sought.
Returns
the unitRef of the given SBaseRef_t, as a pointer to a string.
int SBaseRef_hasRequiredAttributes ( SBaseRef_t sbr)

Predicate returning true or false depending on whether all the required attributes for the given SBaseRef_t structure have been set.

Note
The required attributes for a SBaseRef_t structure are that it must use exactly one attribute to refer to its target.
int SBaseRef_isSetIdRef ( SBaseRef_t sbr)

Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's idRef is set.

Parameters
sbrthe SBaseRef_t structure to query.
Returns
1 (true) if the "idRef" attribute of the given SBaseRef_t structure is set, 0 (false) otherwise.
int SBaseRef_isSetMetaIdRef ( SBaseRef_t sbr)

Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's metaIdRef is set.

Parameters
sbrthe SBaseRef_t structure to query.
Returns
1 (true) if the "metaIdRef" attribute of the given SBaseRef_t structure is set, 0 (false) otherwise.
int SBaseRef_isSetPortRef ( SBaseRef_t sbr)

Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's portRef is set.

Parameters
sbrthe SBaseRef_t structure to query.
Returns
1 (true) if the "portRef" attribute of the given SBaseRef_t structure is set, 0 (false) otherwise.
int SBaseRef_isSetSBaseRef ( SBaseRef_t sbr)

Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's child SBaseRef_t is set.

Parameters
sbrthe SBaseRef_t structure to query.
Returns
1 (true) if the SBaseRef_t child of the given SBaseRef_t structure is set, 0 (false) otherwise.
int SBaseRef_isSetUnitRef ( SBaseRef_t sbr)

Predicate returning 1 (true) or 0 (false) depending on whether the given SBaseRef_t structure's unitRef is set.

Parameters
sbrthe SBaseRef_t structure to query.
Returns
1 (true) if the "unitRef" attribute of the given SBaseRef_t structure is set, 0 (false) otherwise.
int SBaseRef_setIdRef ( SBaseRef_t sbr,
const char *  idRef 
)

Sets the idRef of the given SBaseRef_t to a copy of idRef.

Parameters
sbrthe SBaseRef_t structure to set.
idRefthe idRef to assign to the given SBaseRef_t's "idRef" attribute.
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:
Note
Using this function with the name set to NULL is equivalent to unsetting the "idRef" attribute.
int SBaseRef_setMetaIdRef ( SBaseRef_t sbr,
const char *  metaIdRef 
)

Sets the metaIdRef of the given SBaseRef_t to a copy of metaIdRef.

Parameters
sbrthe SBaseRef_t structure to set.
metaIdRefthe metaIdRef to assign to the given SBaseRef_t's "metaIdRef" attribute.
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:
Note
Using this function with the name set to NULL is equivalent to unsetting the "metaIdRef" attribute.
int SBaseRef_setPortRef ( SBaseRef_t sbr,
const char *  portRef 
)

Sets the portRef of the given SBaseRef_t to a copy of portRef.

Parameters
sbrthe SBaseRef_t structure to set.
portRefthe portRef to assign to the given SBaseRef_t's "portRef" attribute.
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:
Note
Using this function with the name set to NULL is equivalent to unsetting the "portRef" attribute.
int SBaseRef_setSBaseRef ( SBaseRef_t parent,
SBaseRef_t child 
)

Sets the child SBaseRef_t of the parent SBaseRef_t to a copy of child.

Parameters
parentthe parent SBaseRef_t structure.
childthe intended child SBaseRef_t structure to copy.
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 ( SBaseRef_t sbr,
const char *  unitRef 
)

Sets the unitRef of the given SBaseRef_t to a copy of unitRef.

Parameters
sbrthe SBaseRef_t structure to set.
unitRefthe unitRef to assign to the given SBaseRef_t's "unitRef" attribute.
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:
Note
Using this function with the name set to NULL is equivalent to unsetting the "unitRef" attribute.
int SBaseRef_unsetIdRef ( SBaseRef_t sbr)

Unsets the "idRef" attribute of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to unset.
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_unsetMetaIdRef ( SBaseRef_t sbr)

Unsets the "metaIdRef" attribute of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to unset.
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 ( SBaseRef_t sbr)

Unsets the "portRef" attribute of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to unset.
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 ( SBaseRef_t sbr)

Removes the SBaseRef_t child of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to unset.
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 ( SBaseRef_t sbr)

Unsets the "unitRef" attribute of the given SBaseRef_t structure.

Parameters
sbrthe SBaseRef_t structure to unset.
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: