libSBML C API  5.18.0
CompModelPlugin_t Class Reference

Detailed Description

comp Extension of Model_t.

The CompModelPlugin_t class inherits from the SBMLSBasePlugin class, and codifies the extensions to the Model_t class defined in the SBML Level 3 Hierarchical Model_t Composition (“comp”) package. This extension allows a Model_t to define Submodels (other Models that are instantiated as new parts of the parent Model_t), and Ports, a defined interface for including the given Model_t as a Submodel_t of a different Model_t.

Submodels are stored in an optional child ListOfSubmodels_t object, which, if present, must contain one or more Submodel_t objects. All of the Submodels present in the ListOfSubmodels_t are defined to be instantiated in the 'complete' Model_t.

Ports are stored in an optional child ListOfPorts_t object, which, if present, must contain one or more Port_t objects. All of the Ports present in the ListOfPorts_t collectively define the 'port interface' of the Model_t.

Examples:
spec_example1.c.

Public Member Functions

int CompModelPlugin_addPort (CompModelPlugin_t *cmp, const Port_t *p)
 Adds a copy of the given Port_t to this CompModelPlugin_t. More...
 
int CompModelPlugin_addSubmodel (CompModelPlugin_t *cmp, const Submodel_t *s)
 Adds a copy of the given Submodel_t to this CompModelPlugin_t. More...
 
Port_tCompModelPlugin_createPort (CompModelPlugin_t *cmp)
 Creates a new Port_t object, adds it to this CompModelPlugin_t object and returns the Port_t object created. More...
 
Submodel_tCompModelPlugin_createSubmodel (CompModelPlugin_t *cmp)
 Creates a new Submodel_t, adds it to this CompModelPlugin_t and returns the Submodel_t created. More...
 
ListOf_tCompModelPlugin_getListOfPorts (CompModelPlugin_t *cmp)
 Returns a ListOf_t * containing Port_t objects from this CompModelPlugin_t. More...
 
ListOf_tCompModelPlugin_getListOfSubmodels (CompModelPlugin_t *cmp)
 Returns a ListOf_t * containing Submodel_t objects from this CompModelPlugin_t. More...
 
unsigned int CompModelPlugin_getNumPorts (CompModelPlugin_t *cmp)
 Get the number of Port_t objects in this CompModelPlugin_t. More...
 
unsigned int CompModelPlugin_getNumSubmodels (CompModelPlugin_t *cmp)
 Get the number of Submodel_t objects in this CompModelPlugin_t. More...
 
Port_tCompModelPlugin_getPort (CompModelPlugin_t *cmp, unsigned int n)
 Get a Port_t from the CompModelPlugin_t. More...
 
Port_tCompModelPlugin_getPortById (CompModelPlugin_t *cmp, const char *sid)
 Get a Port_t from the CompModelPlugin_t based on its identifier. More...
 
Submodel_tCompModelPlugin_getSubmodel (CompModelPlugin_t *cmp, unsigned int n)
 Get a Submodel_t from the CompModelPlugin_t. More...
 
Submodel_tCompModelPlugin_getSubmodelById (CompModelPlugin_t *cmp, const char *sid)
 Get a Submodel_t from the CompModelPlugin_t based on its identifier. More...
 
Port_tCompModelPlugin_removePort (CompModelPlugin_t *cmp, unsigned int n)
 Removes the nth Port_t from this CompModelPlugin_t and returns a pointer to it. More...
 
Submodel_tCompModelPlugin_removeSubmodel (CompModelPlugin_t *cmp, unsigned int n)
 Removes the nth Submodel_t from this CompModelPlugin_t and returns a pointer to it. More...
 

Member Function Documentation

int CompModelPlugin_addPort ( CompModelPlugin_t cmp,
const Port_t p 
)

Adds a copy of the given Port_t to this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to which the Port_t should be added.
pthe Port_t object to add.
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 CompModelPlugin_addSubmodel ( CompModelPlugin_t cmp,
const Submodel_t s 
)

Adds a copy of the given Submodel_t to this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to which the Submodel_t should be added.
sthe Submodel_t object to add.
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:
Port_t * CompModelPlugin_createPort ( CompModelPlugin_t cmp)

Creates a new Port_t object, adds it to this CompModelPlugin_t object and returns the Port_t object created.

Parameters
cmpthe CompModelPlugin_t structure to which the Port_t should be added.
Returns
a new Port_t object instance.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Submodel_t * CompModelPlugin_createSubmodel ( CompModelPlugin_t cmp)

Creates a new Submodel_t, adds it to this CompModelPlugin_t and returns the Submodel_t created.

Parameters
cmpthe CompModelPlugin_t structure to which the Submodel_t should be added.
Returns
a new Submodel_t instance.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Examples:
spec_example1.c.
ListOf_t * CompModelPlugin_getListOfPorts ( CompModelPlugin_t cmp)

Returns a ListOf_t * containing Port_t objects from this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure whose ListOfPorts_t is sought.
Returns
the ListOfPorts_t from this CompModelPlugin_t as a ListOf_t *.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
See also
CompModelPlugin_addPort()
CompModelPlugin_createPort()
CompModelPlugin_getPortById()
CompModelPlugin_getPort()
CompModelPlugin_getNumPorts()
CompModelPlugin_removePort()
ListOf_t * CompModelPlugin_getListOfSubmodels ( CompModelPlugin_t cmp)

Returns a ListOf_t * containing Submodel_t objects from this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure whose ListOfSubmodels_t is sought.
Returns
the ListOfSubmodels_t from this CompModelPlugin_t as a ListOf_t *.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
See also
CompModelPlugin_addSubmodel()
CompModelPlugin_createSubmodel()
CompModelPlugin_getSubmodelById()
CompModelPlugin_getSubmodel()
CompModelPlugin_getNumSubmodels()
CompModelPlugin_removeSubmodel()
unsigned int CompModelPlugin_getNumPorts ( CompModelPlugin_t cmp)

Get the number of Port_t objects in this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to query.
Returns
the number of Port_t objects in this CompModelPlugin_t.
unsigned int CompModelPlugin_getNumSubmodels ( CompModelPlugin_t cmp)

Get the number of Submodel_t objects in this CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to query.
Returns
the number of Submodel_t objects in this CompModelPlugin_t.
Port_t * CompModelPlugin_getPort ( CompModelPlugin_t cmp,
unsigned int  n 
)

Get a Port_t from the CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to search.
nan unsigned int representing the index of the Port_t to retrieve.
Returns
the nth Port_t in the ListOfPorts_t within this CompModelPlugin_t or NULL if no such object exists.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Port_t * CompModelPlugin_getPortById ( CompModelPlugin_t cmp,
const char *  sid 
)

Get a Port_t from the CompModelPlugin_t based on its identifier.

Parameters
cmpthe CompModelPlugin_t structure to search.
sida string representing the identifier of the Port_t to retrieve.
Returns
the Port_t in the ListOfPorts_t within this CompModelPlugin_t with the given sid or NULL if no such Port_t exists.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Submodel_t * CompModelPlugin_getSubmodel ( CompModelPlugin_t cmp,
unsigned int  n 
)

Get a Submodel_t from the CompModelPlugin_t.

Parameters
cmpthe CompModelPlugin_t structure to search.
nan unsigned int representing the index of the Submodel_t to retrieve.
Returns
the nth Submodel_t in the ListOfSubmodels_t within this CompModelPlugin_t or NULL if no such object exists.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Submodel_t * CompModelPlugin_getSubmodelById ( CompModelPlugin_t cmp,
const char *  sid 
)

Get a Submodel_t from the CompModelPlugin_t based on its identifier.

Parameters
cmpthe CompModelPlugin_t structure to search.
sida string representing the identifier of the Submodel_t to retrieve.
Returns
the Submodel_t in the ListOfSubmodels_t within this CompModelPlugin_t with the given sid or NULL if no such Submodel_t exists.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
Port_t * CompModelPlugin_removePort ( CompModelPlugin_t cmp,
unsigned int  n 
)

Removes the nth Port_t from this CompModelPlugin_t and returns a pointer to it.

Parameters
cmpthe CompModelPlugin_t structure to search.
nan unsigned int representing the index of the Port_t to remove.
Returns
a pointer to the nth Port_t in this CompModelPlugin_t.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.
Submodel_t * CompModelPlugin_removeSubmodel ( CompModelPlugin_t cmp,
unsigned int  n 
)

Removes the nth Submodel_t from this CompModelPlugin_t and returns a pointer to it.

Parameters
cmpthe CompModelPlugin_t structure to search.
nan unsigned int representing the index of the Submodel_t to remove.
Returns
a pointer to the nth Submodel_t in this CompModelPlugin_t.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.