libSBML C API  5.18.0
ListOfObjectives_t Class Reference

Detailed Description

fbc A list of Objective_t objects.

The ListOfObjectives_t is a container for the SBML extended Model_t that lists all the possible Objective_t elements in the model.

Unlike most other ListOf_t subclasses in SBML, SBML Level 3 Flux Balance Constraints Version 2 defines an additional required attribute on ListOfObjectives_t: the "activeObjective" attribute. This attribute is of type SIdRef and can only refer to the id of an existing Objective_t. This required attribute exists so that when multiple Objective_t's are included in a single model, the model will always be well described; i.e., there will be a single, primary objective function which defines a single optimum and its associated solution space.

The various ListOf___ structures in SBML are merely containers used for organizing the main components of an SBML model. In libSBML's implementation, ListOf___ data structures are derived from the intermediate utility structure ListOf_t, which is not defined by the SBML specifications but serves as a useful programmatic construct. ListOf_t is itself is in turn derived from SBase_t, which provides all of the various ListOf___ data structures with common features defined by the SBML specification, such as "metaid" attributes and annotations.

The relationship between the lists and the rest of an SBML model is illustrated by the following (for SBML Level 2 Version 4):

SBML Level 3 Version 1 has essentially the same structure as Level 2 Version 4, depicted above, but SBML Level 3 Version 2 allows containers to contain zero or more of the relevant object, instead of requiring at least one. As such, libsbml will write out an otherwise-empty ListOf___ element that has any optional attribute set (such as 'id' or 'metaid'), that has an optional child (such as a 'notes' or 'annotation'), or that has attributes or children set from any SBML Level 3 package, whether or not the ListOf___ has any other children.

Readers may wonder about the motivations for using the ListOf___ containers in SBML. A simpler approach in XML might be to place the components all directly at the top level of the model definition. The choice made in SBML is to group them within XML elements named after ListOfClassname, in part because it helps organize the components. More importantly, the fact that the container classes are derived from SBase_t means that software tools can add information about the lists themselves into each list container's "annotation".

See also
ListOfFunctionDefinitions_t
ListOfUnitDefinitions_t
ListOfCompartmentTypes_t
ListOfSpeciesTypes_t
ListOfCompartments_t
ListOfSpecies_t
ListOfParameters_t
ListOfInitialAssignments_t
ListOfRules_t
ListOfConstraints_t
ListOfReactions_t
ListOfEvents_t
Note
In the C API for libSBML, functions that in other language APIs would be inherited by the various ListOf___ structures not shown in the pages for the individual ListOf___'s. Instead, the functions are defined on ListOf_t. Please consult the documentation for ListOf_t for the many common functions available for manipulating ListOf___ structures. The documentation for the individual ListOf___ structures (ListOfCompartments_t, ListOfReactions_t, etc.) does not reveal all of the functionality available.
See also
GeneProduct_t
FbcModelPlugin_t
Warning
The required attribute "activeObjective" on ListOfObjectives_t is an additional attribute that is not present on typical ListOf_t classes. The introduction of an attribute on ListOf_t is perfectly legal in SBML, but uncommon, and software developers may have grown accustomed to ListOf_t classes all having the same attributes and no others. We are belaboring this point so that developers are more likely to notice the presence of an additional attribute on ListOfObjectives_t.

Public Member Functions

Objective_tListOfObjectives_getById (ListOf_t *lo, const char *sid)
 Return the structure indicated by the given sid. More...
 
Objective_tListOfObjectives_removeById (ListOf_t *lo, const char *sid)
 Removes the structure with the given sid from the given ListOf_t structure and returns a pointer to it. More...
 

Member Function Documentation

Objective_t * ListOfObjectives_getById ( ListOf_t lo,
const char *  sid 
)

Return the structure indicated by the given sid.

Parameters
lothe ListOf_t structure to use.
sida string matching the "id" attribute of the element sought.
Returns
the structure for the given variable, or NULL if no such object exists in the list.
Objective_t * ListOfObjectives_removeById ( ListOf_t lo,
const char *  sid 
)

Removes the structure with the given sid from the given ListOf_t structure and returns a pointer to it.

* The caller owns the returned structure and is responsible for deleting it.

Parameters
lothe ListOf_t structure.
sidthe string of the "id" attribute of the sought structure.
Returns
the structure removed. As mentioned above, the caller owns the returned structure. NULL is returned if no structure with the "id" attribute exists in the given ListOf_t structure.