Prints the rule, reaction, and event formulas in a given SBML document.
#include <iostream>
using namespace std;
LIBSBML_CPP_NAMESPACE_USE
void
{
char* formula;
{
cout <<
"FunctionDefinition " << n <<
", " << fd->
getId();
{
{
cout <<
", " << ( math->
getChild(n) )->getName();
}
}
cout <<") := ";
{
cout << "(no body defined)";
}
else
{
cout << formula << endl;
free(formula);
}
}
}
void
printRuleMath (
unsigned int n,
const Rule* r)
{
char* formula;
{
{
cout << "Rule " << n << ", formula: "
}
else
{
cout << "Rule " << n << ", formula: "
<< formula << " = 0" << endl;
}
free(formula);
}
}
void
printReactionMath (
unsigned int n,
const Reaction* r)
{
char* formula;
{
{
cout << "Reaction " << n << ", formula: " << formula << endl;
free(formula);
}
}
}
void
{
std::string variable;
char* formula;
{
cout <<" EventAssignment " << n
<< ", trigger: " << variable << " = " << formula << endl;
free(formula);
}
}
void
printEventMath (
unsigned int n,
const Event* e)
{
char* formula;
unsigned int i;
{
cout << "Event " << n << " delay: " << formula << endl;
free(formula);
}
{
cout << "Event " << n << " trigger: " << formula << endl;
free(formula);
}
{
}
cout << endl;
}
void
printMath (
const Model* m)
{
unsigned int n;
{
}
{
printRuleMath(n + 1, m->
getRule(n));
}
cout << endl;
{
}
cout << endl;
{
}
}
int
main (int argc, char* argv[])
{
if (argc != 2)
{
cout << endl << "Usage: printMath filename" << endl << endl;
return 1;
}
const char* filename = argv[1];
{
cerr << "Encountered the following SBML errors:" << endl;
return 1;
}
if (model == 0)
{
cout << "No model present." << endl;
return 1;
}
printMath(model);
cout << endl;
delete document;
return 0;
}
SBMLDocument_t * readSBML(const char *filename)
Reads an SBML document from the given file.
Include all SBML types in a single header file.
Definition: ASTNode.h:221
ASTNode * getLeftChild() const
Returns the left child of this node.
Definition: ASTNode.cpp:1031
unsigned int getNumChildren() const
Returns the number of children of this node.
Definition: ASTNode.cpp:1060
ASTNode * getChild(unsigned int n) const
Returns the child at index n of this node.
Definition: ASTNode.cpp:1019
virtual const ASTNode * getMath() const
Get the mathematical formula for the delay and return it as an AST.
Definition: Delay.cpp:168
Definition: EventAssignment.h:296
const std::string & getVariable() const
Get the value of this EventAssignment's "variable" attribute.
Definition: EventAssignment.cpp:166
virtual const ASTNode * getMath() const
Get the mathematical expression in this EventAssignment's "math" subelement.
Definition: EventAssignment.cpp:176
bool isSetMath() const
Predicate for testing whether the "math" subelement of this EventAssignment is set.
Definition: EventAssignment.cpp:198
const EventAssignment * getEventAssignment(unsigned int n) const
Return a specific EventAssignment object of this Event.
Definition: Event.cpp:1055
bool isSetDelay() const
Predicate for testing whether the delay for this Event is set.
Definition: Event.cpp:465
bool isSetTrigger() const
Predicate for testing whether the trigger for this Event is set.
Definition: Event.cpp:455
unsigned int getNumEventAssignments() const
Returns the number of EventAssignment objects attached to this Event.
Definition: Event.cpp:1097
const Trigger * getTrigger() const
Get the event trigger portion of this Event.
Definition: Event.cpp:346
const Delay * getDelay() const
Get the assignment delay portion of this Event, if there is one.
Definition: Event.cpp:366
Definition: FunctionDefinition.h:150
virtual const std::string & getId() const
Returns the value of the "id" attribute of this FunctionDefinition.
Definition: FunctionDefinition.cpp:162
virtual const ASTNode * getMath() const
Get the mathematical formula of this FunctionDefinition.
Definition: FunctionDefinition.cpp:182
bool isSetMath() const
Predicate returning true if this FunctionDefinition's "math" subelement contains a value.
Definition: FunctionDefinition.cpp:216
Definition: KineticLaw.h:203
virtual const ASTNode * getMath() const
Returns the mathematical formula for this KineticLaw object and return it as as an AST.
Definition: KineticLaw.cpp:263
bool isSetMath() const
Predicate returning true if this Kinetic's "math" subelement is set.
Definition: KineticLaw.cpp:310
unsigned int getNumFunctionDefinitions() const
Get the number of FunctionDefinition objects in this Model.
Definition: Model.cpp:3073
const Rule * getRule(unsigned int n) const
Get the nth Rule object in this Model.
Definition: Model.cpp:2714
unsigned int getNumRules() const
Get the number of Rule objects in this Model.
Definition: Model.cpp:3172
const Reaction * getReaction(unsigned int n) const
Get the nth Reaction object in this Model.
Definition: Model.cpp:2925
unsigned int getNumReactions() const
Get the number of Reaction objects in this Model.
Definition: Model.cpp:3192
const Event * getEvent(unsigned int n) const
Get the nth Event object in this Model.
Definition: Model.cpp:3031
const FunctionDefinition * getFunctionDefinition(unsigned int n) const
Get the nth FunctionDefinitions object in this Model.
Definition: Model.cpp:2354
unsigned int getNumEvents() const
Get the number of Event objects in this Model.
Definition: Model.cpp:3202
Definition: Reaction.h:224
const KineticLaw * getKineticLaw() const
Returns the KineticLaw object contained in this Reaction.
Definition: Reaction.cpp:396
bool isSetKineticLaw() const
Predicate returning true if this Reaction contains a kinetic law object.
Definition: Reaction.cpp:470
virtual const ASTNode * getMath() const
Get the mathematical formula of this Rule as an ASTNode tree.
Definition: Rule.cpp:204
const std::string & getVariable() const
Get the value of the "variable" attribute of this Rule object.
Definition: Rule.cpp:219
bool isSetMath() const
Predicate returning true if this Rule's mathematical expression is set.
Definition: Rule.cpp:258
Definition: SBMLDocument.h:351
unsigned int getNumErrors() const
Returns the number of errors or warnings encountered during parsing, consistency checking,...
Definition: SBMLDocument.cpp:1169
void printErrors(std::ostream &stream=std::cerr) const
Prints all the errors or warnings encountered trying to parse, check, or translate this SBML document...
Definition: SBMLDocument.cpp:1192
const Model * getModel() const
Returns the Model object stored in this SBMLDocument.
Definition: SBMLDocument.cpp:350
virtual const ASTNode * getMath() const
Get the mathematical formula for the trigger and return it as an AST.
Definition: Trigger.cpp:182