libSBML C API  libSBML 5.8.0 C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SBMLTypeCodes.h File Reference

Detailed Description

Enumeration to identify SBML objects at runtime.

Author
Ben Bornstein
Include dependency graph for SBMLTypeCodes.h:
This graph shows which files directly or indirectly include this file:

Enumerations

enum  SBMLTypeCode_t {
  SBML_UNKNOWN = 0,
  SBML_COMPARTMENT = 1,
  SBML_COMPARTMENT_TYPE = 2,
  SBML_CONSTRAINT = 3,
  SBML_DOCUMENT = 4,
  SBML_EVENT = 5,
  SBML_EVENT_ASSIGNMENT = 6,
  SBML_FUNCTION_DEFINITION = 7,
  SBML_INITIAL_ASSIGNMENT = 8,
  SBML_KINETIC_LAW = 9,
  SBML_LIST_OF = 10,
  SBML_MODEL = 11,
  SBML_PARAMETER = 12,
  SBML_REACTION = 13,
  SBML_RULE = 14,
  SBML_SPECIES = 15,
  SBML_SPECIES_REFERENCE = 16,
  SBML_SPECIES_TYPE = 17,
  SBML_MODIFIER_SPECIES_REFERENCE = 18,
  SBML_UNIT_DEFINITION = 19,
  SBML_UNIT = 20,
  SBML_ALGEBRAIC_RULE = 21,
  SBML_ASSIGNMENT_RULE = 22,
  SBML_RATE_RULE = 23,
  SBML_SPECIES_CONCENTRATION_RULE = 24,
  SBML_COMPARTMENT_VOLUME_RULE = 25,
  SBML_PARAMETER_RULE = 26,
  SBML_TRIGGER = 27,
  SBML_DELAY = 28,
  SBML_STOICHIOMETRY_MATH = 29,
  SBML_LOCAL_PARAMETER = 30,
  SBML_PRIORITY = 31
}
 An enumeration of SBML types to help identify SBML objects at runtime. More...
 

Functions

const char * SBMLTypeCode_toString (int tc, const char *pkgName)
 This method takes an SBML type code and returns a string representing the code. More...
 

Enumeration Type Documentation

An enumeration of SBML types to help identify SBML objects at runtime.

Abstract types do not have a typecode since they cannot be instantiated.

(NOTES)

  • Each typecode is used as a return value (int) of the following functions

    • virtual int SBase::getTypeCode() const;
    • virtual int ListOf::getItemTypeCode() const;

    (In libSBML 5, the type of return values in these functions have been changed from typecode (int) to int for extensibility.)

  • Each pacakge extension must define similar enum type for each SBase subclass (e.g. SBMLLayoutTypeCode_t for the layout extension, SBMLGroupTypeCode_t for group extension).
  • The value of each typecode can be duplicated between those of different packages.
  • To distinguish the typecodes of different packages, not only the return value of getTypeCode() but also that of getPackageName() must be checked as follows:

    void example (const SBase *sb) { cons std::string pkgName = sb->getPackageName(); if (pkgName == "core") { switch (sb->getTypeCode()) { case SBML_MODEL: .... break; case SBML_REACTION: .... } } else if (pkgName == "layout") { switch (sb->getTypeCode()) { case SBML_LAYOUT_LAYOUT: .... break; case SBML_LAYOUT_REACTIONGLYPH: .... } } ... }

Enumerator
SBML_UNKNOWN 
SBML_COMPARTMENT 
SBML_COMPARTMENT_TYPE 
SBML_CONSTRAINT 
SBML_DOCUMENT 
SBML_EVENT 
SBML_EVENT_ASSIGNMENT 
SBML_FUNCTION_DEFINITION 
SBML_INITIAL_ASSIGNMENT 
SBML_KINETIC_LAW 
SBML_LIST_OF 
SBML_MODEL 
SBML_PARAMETER 
SBML_REACTION 
SBML_RULE 
SBML_SPECIES 
SBML_SPECIES_REFERENCE 
SBML_SPECIES_TYPE 
SBML_MODIFIER_SPECIES_REFERENCE 
SBML_UNIT_DEFINITION 
SBML_UNIT 
SBML_ALGEBRAIC_RULE 
SBML_ASSIGNMENT_RULE 
SBML_RATE_RULE 
SBML_SPECIES_CONCENTRATION_RULE 
SBML_COMPARTMENT_VOLUME_RULE 
SBML_PARAMETER_RULE 
SBML_TRIGGER 
SBML_DELAY 
SBML_STOICHIOMETRY_MATH 
SBML_LOCAL_PARAMETER 
SBML_PRIORITY 

Function Documentation

const char* SBMLTypeCode_toString ( int  tc,
const char *  pkgName 
)

This method takes an SBML type code and returns a string representing the code.

Returns
a human readable name for the given SBML type code.
Note
The caller does not own the returned string and is therefore not allowed to modify it.
Returns
a human readable name for the given typecode and package name. The caller does not own the returned string and is therefore not allowed to modify it.