Loading [MathJax]/extensions/tex2jax.js
libSBML C++ API  5.20.4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ModelDefinition Class Reference
Inheritance diagram for ModelDefinition:
[legend]

Detailed Description

comp A model used in model composition.

The Hierarchical Model Composition (“comp”) package allows multiple Model objects to be defined in a single SBMLDocument. While these new Model objects are not new SBML classes, they are given a new name, <modelDefinition>, and reside in ListOfModelDefinition objects. In libSBML, this class inherits from the Model class, changing only the expected parent of the object, and the XML name.

An additional restriction is placed on the "id" attribute of ModelDefinition objects: not only must it be unique across all such attributes of type SId within the ModelDefintion, it must also be unique across all Model, ModelDefinition, and ExternalModelDefinition objects in the same SBMLDocument.

Examples
spec_example1.cpp, spec_example3.cpp, and spec_example4.cpp.

Public Member Functions

virtual ModelDefinitionclone () const
 Creates and returns a deep copy of this ModelDefinition object.
 
virtual const std::string & getElementName () const
 Returns the XML element name of this object.
 
virtual int getTypeCode () const
 Returns the libSBML type code of this object instance.
 
 ModelDefinition (CompPkgNamespaces *compns)
 Creates a new ModelDefinition with the given CompPkgNamespaces object.
 
 ModelDefinition (const Model &source)
 Copy constructor from base Model object.
 
 ModelDefinition (unsigned int level=CompExtension::getDefaultLevel(), unsigned int version=CompExtension::getDefaultVersion(), unsigned int pkgVersion=CompExtension::getDefaultPackageVersion())
 Creates a new ModelDefinition with the given level, version, and package version.
 
ModelDefinitionoperator= (const Model &source)
 Assignment operator.
 
virtual int removeFromParentAndDelete ()
 Finds this Model's parent ListOfModelDefinitions and removes itself from it and deletes itself.
 
virtual ~ModelDefinition ()
 Destructor.
 

Constructor & Destructor Documentation

◆ ModelDefinition() [1/3]

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

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

Parameters
levelthe SBML Level.
versionthe Version within the SBML Level.
pkgVersionthe version of the package.
Note
Attempting to add an object to an SBMLDocument having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute. For packages, this means that the parent object to which this package element is being added must have been created with the package namespace, or that the package namespace was added to it, even if that parent is not a package object itself.

◆ ModelDefinition() [2/3]

ModelDefinition::ModelDefinition ( CompPkgNamespaces compns)

Creates a new ModelDefinition with the given CompPkgNamespaces object.

The package namespaces object used in this constructor is derived from a SBMLNamespaces object, which encapsulates SBML Level/Version/namespaces information. It is used to communicate the SBML Level, Version, and package version and name information used in addition to SBML Level 3 Core. A common approach to using libSBML's SBMLNamespaces facilities is to create an package namespace object somewhere in a program once, then hand that object as needed to object constructors of that package that accept it as and argument, such as this one.
Parameters
compnsthe CompPkgNamespaces object.
Note
Attempting to add an object to an SBMLDocument having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute. For packages, this means that the parent object to which this package element is being added must have been created with the package namespace, or that the package namespace was added to it, even if that parent is not a package object itself.

◆ ModelDefinition() [3/3]

ModelDefinition::ModelDefinition ( const Model source)

Copy constructor from base Model object.

Parameters
sourcethe instance to copy.

◆ ~ModelDefinition()

ModelDefinition::~ModelDefinition ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

ModelDefinition * ModelDefinition::clone ( ) const
virtual

Creates and returns a deep copy of this ModelDefinition object.

Returns
a (deep) copy of this ModelDefinition object.

◆ getElementName()

const std::string & ModelDefinition::getElementName ( ) const
virtual

Returns the XML element name of this object.

The only difference between a Model and a ModelDefinition is the element name ('modelDefinition').

Returns
the name of this element, as a text string.
See also
getTypeCode()

◆ getTypeCode()

int ModelDefinition::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 SBase::getPackageName() method on the object.

The exception to this is lists: all SBML-style list elements have the type SBML_LIST_OF , regardless of what package they are from.

Returns
the SBML type code for this object: SBML_COMP_MODELDEFINITION
Warning
The specific integer values of the possible type codes may be reused by different libSBML plug-ins for SBML Level 3. packages, To fully identify the correct code, it is necessary to invoke both getPackageName() and getTypeCode() (or ListOf::getItemTypeCode()).
See also
getElementName()
getPackageName()

◆ operator=()

ModelDefinition & ModelDefinition::operator= ( const Model source)

Assignment operator.

Parameters
sourcethe object whose values are used as the basis of the assignment.

◆ removeFromParentAndDelete()

int ModelDefinition::removeFromParentAndDelete ( )
virtual

Finds this Model's parent ListOfModelDefinitions and removes itself from it and deletes itself.

This method actually just calls the SBase function, since the Model class overrides it, but that's actually what we want to happen here.

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: