libSBML C API  5.18.0
Port_t Class Reference

Detailed Description

comp An interface to be used in composition.

The Port_t class was introduced by the SBML Level 3 Hierarchical Model_t Composition (“comp”) package to allow a Model_t to define a standard interface between it and other models that might use it as a submodel. It derives from the SBaseRef_t class, and the elements defined there refer to elements in the same parent Model_t as the Port_t object. A Port_t object instance therefore uses those attributes to define a port for a component in a model. When other SBaseRef_t or SBaseRef_t-derived classes refer to a Port_t object using a "portRef" attribute, the element being referenced is the element the Port_t object itself points to.

In the present formulation of the Hierarchical Model Composition package, the use of ports is not enforced, nor is there any mechanism to restrict which ports may be used in what ways—they are only an advisory construct. Future versions of this SBML package may provide additional functionality to support explicit restrictions on port use. For the present definition of Hierarchical Model Composition, users of models containing ports are encouraged to respect the modeler's intention in defining ports, and use the port definitions to interact with components through their ports (when they have ports defined) rather than interact directly with the components.

The required attribute "id" is used to give an identifier to a Port_t object so that other objects can refer to it. The attribute has type PortSId and is essentially identical to the SBML primitive type SId, except that its namespace is limited to the identifiers of Port_t objects defined within a Model_t object. In parallel, the PortSId type has a companion type, PortSIdRef, that corresponds to the SBML primitive type SIdRef; the value space of PortSIdRef is limited to PortSId values.

Public Member Functions

Port_tPort_clone (Port_t *p)
 Returns a copy of the given Port_t structure. More...
 
Port_tPort_create (unsigned int level, unsigned int version, unsigned int pkgVersion)
 Creates a new Port_t structure using the given SBML level and version, and the pkgVersion package version. More...
 
void Port_free (Port_t *p)
 Frees the given Port_t structure. More...
 
char * Port_getId (Port_t *p)
 Takes an Port_t structure and returns its identifier. More...
 
char * Port_getName (Port_t *p)
 Takes a Port_t structure and returns its name. More...
 
int Port_hasRequiredAttributes (Port_t *p)
 Predicate returning true or false depending on whether all the required attributes for the given Port_t structure have been set. More...
 
int Port_isSetId (Port_t *p)
 Predicate returning 1 (true) or 0 (false) depending on whether the given Port_t structure's identifier is set. More...
 
int Port_isSetName (Port_t *p)
 Predicate returning 1 (true) or 0 (false) depending on whether the given Port_t structure's name is set. More...
 
int Port_setId (Port_t *p, const char *sid)
 Assigns the identifier of an Port_t structure. More...
 
int Port_setName (Port_t *p, const char *name)
 Sets the name of the given Port_t to a copy of name. More...
 
int Port_unsetId (Port_t *p)
 Unsets the "id" attribute of the given Port_t structure. More...
 
int Port_unsetName (Port_t *p)
 Unsets the "name" attribute of the given Port_t structure. More...
 

Member Function Documentation

Port_t * Port_clone ( Port_t p)

Returns a copy of the given Port_t structure.

Parameters
pthe Port_t structure to copy.
Returns
a (deep) copy of the Port_t.
Port_t * Port_create ( unsigned int  level,
unsigned int  version,
unsigned int  pkgVersion 
)

Creates a new Port_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 Port_t.
versionan unsigned int, the SBML Version to assign to this Port_t.
pkgVersionan unsigned int, the SBML 'comp' package Version to assign to this Port_t.
Returns
a pointer to the newly created Port_t structure.
void Port_free ( Port_t p)

Frees the given Port_t structure.

Parameters
pthe Port_t structure to free.
char * Port_getId ( Port_t p)

Takes an Port_t structure and returns its identifier.

Parameters
pthe Port_t structure whose identifier is sought.
Returns
the identifier of the given Port_t, as a pointer to a string.
char * Port_getName ( Port_t p)

Takes a Port_t structure and returns its name.

Parameters
pthe Port_t whose name is sought.
Returns
the name of the given Port_t, as a pointer to a string.
int Port_hasRequiredAttributes ( Port_t p)

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

Note
The required attributes for a Port_t structure are that it uses exactly one attribute to refer to its target, and that 'id' is set.
int Port_isSetId ( Port_t p)

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

Parameters
pthe Port_t structure to query.
Returns
1 (true) if the "id" attribute of the given Port_t structure is set, 0 (false) otherwise.
int Port_isSetName ( Port_t p)

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

Parameters
pthe Port_t structure to query.
Returns
1 (true) if the "name" attribute of the given Port_t structure is set, 0 (false) otherwise.
int Port_setId ( Port_t p,
const char *  sid 
)

Assigns the identifier of an Port_t structure.

This makes a copy of the string passed in the parameter sid.

Parameters
pthe Port_t structure to set.
sidthe string to use as the identifier.
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 an sid of NULL is equivalent to unsetting the "id" attribute.
int Port_setName ( Port_t p,
const char *  name 
)

Sets the name of the given Port_t to a copy of name.

Parameters
pthe Port_t structure to set.
namethe name to assign to the given Port_t's "name" 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 "name" attribute.
int Port_unsetId ( Port_t p)

Unsets the "id" attribute of the given Port_t structure.

Parameters
pthe Port_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 Port_unsetName ( Port_t p)

Unsets the "name" attribute of the given Port_t structure.

Parameters
pthe Port_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: