COPASI API  4.16.103
Public Member Functions | Private Types | Private Attributes | List of all members
CCopasiXMLParser::ReactionElement Class Reference
Inheritance diagram for CCopasiXMLParser::ReactionElement:
Inheritance graph
[legend]
Collaboration diagram for CCopasiXMLParser::ReactionElement:
Collaboration graph
[legend]

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 ReactionElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~ReactionElement ()
 
- Public Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
 CXMLElementHandler (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *C_UNUSED(pszName))
 
virtual void reset ()
 
virtual void start (const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
 
virtual ~CXMLElementHandler ()
 

Private Types

enum  Element {
  Reaction = 0, MiriamAnnotation, Comment, ListOfUnsupportedAnnotations,
  ListOfSubstrates, ListOfProducts, ListOfModifiers, ListOfConstants,
  KineticLaw
}
 

Private Attributes

std::string mKey
 
KineticLawElementmpKineticLawElement
 
ListOfConstantsElementmpListOfConstantsElement
 
ListOfModifiersElementmpListOfModifiersElement
 
ListOfProductsElementmpListOfProductsElement
 
ListOfSubstratesElementmpListOfSubstratesElement
 

Additional Inherited Members

- Protected Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
void addFix (const std::string &key, CCopasiObject *pObject)
 
void deleteCurrentHandler ()
 
- Protected Attributes inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
SCopasiXMLParserCommonmCommon
 
C_INT32 mCurrentElement
 
C_INT32 mLastKnownElement
 
CCopasiXMLParsermParser
 
CXMLElementHandlermpCurrentHandler
 

Detailed Description

Definition at line 1123 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CCopasiXMLParser::ReactionElement::ReactionElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)

Constructor

Definition at line 3725 of file CCopasiXMLParser.cpp.

CCopasiXMLParser::ReactionElement::~ReactionElement ( )
virtual

Destructor

Definition at line 3735 of file CCopasiXMLParser.cpp.

References pdelete.

3736 {
3742 }
ListOfSubstratesElement * mpListOfSubstratesElement
#define pdelete(p)
Definition: copasi.h:215
ListOfConstantsElement * mpListOfConstantsElement
ListOfProductsElement * mpListOfProductsElement
ListOfModifiersElement * mpListOfModifiersElement

Member Function Documentation

void CCopasiXMLParser::ReactionElement::end ( const XML_Char *  pszName)
virtual

End element handler

Parameters
constXML_Char *pszName

Definition at line 3918 of file CCopasiXMLParser.cpp.

References SCopasiXMLParserCommon::CharacterData, CCopasiMessage::EXCEPTION, CReaction::getKey(), CAnnotation::getUnsupportedAnnotations(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pReaction, CAnnotation::setMiriamAnnotation(), CAnnotation::setNotes(), START_ELEMENT, and UNKNOWN_ELEMENT.

3919 {
3920  switch (mCurrentElement)
3921  {
3922  case Reaction:
3923 
3924  if (strcmp(pszName, "Reaction"))
3926  pszName, "Reaction", mParser.getCurrentLineNumber());
3927 
3930 
3931  /* Tell the parent element we are done. */
3932  mParser.onEndElement(pszName);
3933  break;
3934 
3935  case MiriamAnnotation:
3936 
3937  if (strcmp(pszName, "MiriamAnnotation"))
3939  pszName, "MiriamAnnotation", mParser.getCurrentLineNumber());
3940 
3942  mCommon.CharacterData = "";
3943  break;
3944 
3945  case Comment:
3946 
3947  if (strcmp(pszName, "Comment"))
3949  pszName, "Comment", mParser.getCurrentLineNumber());
3950 
3952  mCommon.CharacterData = "";
3953  break;
3954 
3956 
3957  if (strcmp(pszName, "ListOfUnsupportedAnnotations"))
3959  pszName, "ListOfUnsupportedAnnotations", mParser.getCurrentLineNumber());
3960 
3962 
3963  break;
3964 
3965  case ListOfSubstrates:
3966 
3967  if (strcmp(pszName, "ListOfSubstrates"))
3969  pszName, "ListOfSubstrates", mParser.getCurrentLineNumber());
3970 
3971  break;
3972 
3973  case ListOfProducts:
3974 
3975  if (strcmp(pszName, "ListOfProducts"))
3977  pszName, "ListOfProducts", mParser.getCurrentLineNumber());
3978 
3979  break;
3980 
3981  case ListOfModifiers:
3982 
3983  if (strcmp(pszName, "ListOfModifiers"))
3985  pszName, "ListOfModifiers", mParser.getCurrentLineNumber());
3986 
3987  break;
3988 
3989  case ListOfConstants:
3990 
3991  if (strcmp(pszName, "ListOfConstants"))
3993  pszName, "ListOfConstants", mParser.getCurrentLineNumber());
3994 
3995  break;
3996 
3997  case KineticLaw:
3998 
3999  if (strcmp(pszName, "KineticLaw"))
4001  pszName, "KineticLaw", mParser.getCurrentLineNumber());
4002 
4003  break;
4004 
4005  case UNKNOWN_ELEMENT:
4006  break;
4007 
4008  default:
4010  pszName, "???", mParser.getCurrentLineNumber());
4011  break;
4012  }
4013 
4015 
4016  return;
4017 }
#define START_ELEMENT
virtual const std::string & getKey() const
Definition: CReaction.cpp:190
void setNotes(const std::string &notes)
#define MCXML
const CAnnotation::UnsupportedAnnotation & getUnsupportedAnnotations() const
void setMiriamAnnotation(const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
ListOfUnsupportedAnnotationsElement mListOfUnsupportedAnnotationsElement
UnsupportedAnnotation & getUnsupportedAnnotations()
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ReactionElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 3744 of file CCopasiXMLParser.cpp.

References CCopasiVectorN< CType >::add(), CCopasiMessage::EXCEPTION, fatalError, CKeyFactory::get(), CModel::getReactions(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pModel, SCopasiXMLParserCommon::pReaction, CReaction::setFast(), CCopasiObject::setObjectName(), CReaction::setReversible(), CReaction::setSBMLId(), and UNKNOWN_ELEMENT.

3746 {
3747  CCompartment * pCompartment;
3748  const char * Name;
3749  const char * Compartment; // Default Compartment_00
3750  const char * reversible;
3751  bool Reversible;
3752  const char * fast;
3753  bool Fast;
3754  const char * SBMLId;
3755 
3757  mpCurrentHandler = NULL;
3758 
3759  while (mpCurrentHandler == NULL)
3760  {
3761  mCurrentElement++; /* We should always be on the next element */
3762 
3763  switch (mCurrentElement)
3764  {
3765  case Reaction:
3766 
3767  if (strcmp(pszName, "Reaction"))
3769  pszName, "Reaction", mParser.getCurrentLineNumber());
3770 
3771  mKey = mParser.getAttributeValue("key", papszAttrs);
3772  Name = mParser.getAttributeValue("name", papszAttrs);
3773  Compartment = mParser.getAttributeValue("compartment", papszAttrs,
3774  "Compartment_00");
3775 
3776  reversible = mParser.getAttributeValue("reversible", papszAttrs);
3777  Reversible = mParser.toBool(reversible);
3778 
3779  fast = mParser.getAttributeValue("fast", papszAttrs, "false");
3780  Fast = mParser.toBool(fast);
3781 
3782  mCommon.pReaction = new CReaction();
3783  addFix(mKey, mCommon.pReaction);
3785  mCommon.pReaction->setReversible(Reversible);
3786  mCommon.pReaction->setFast(Fast);
3787  SBMLId = mParser.getAttributeValue("sbmlid", papszAttrs, "");
3788 
3789  if (std::string(SBMLId) != std::string(""))
3790  {
3791  mCommon.pReaction->setSBMLId(SBMLId);
3792  }
3793 
3794  if (strcmp(Compartment, "Compartment_00")) //TODO necessary?
3795  {
3796  pCompartment =
3797  dynamic_cast< CCompartment* >(mCommon.KeyMap.get(Compartment));
3798 
3799  if (!pCompartment) fatalError();
3800 
3801  //mCommon.pReaction->setCompartment(pCompartment);
3802  }
3803 
3805 
3807  return;
3808  break;
3809 
3810  case MiriamAnnotation:
3811 
3812  if (!strcmp(pszName, "MiriamAnnotation"))
3814 
3815  break;
3816 
3817  case Comment:
3818 
3819  if (!strcmp(pszName, "Comment"))
3820  {
3823  }
3824 
3825  break;
3826 
3828 
3829  if (!strcmp(pszName, "ListOfUnsupportedAnnotations"))
3831 
3832  break;
3833 
3834  case ListOfSubstrates:
3835 
3836  if (!strcmp(pszName, "ListOfSubstrates"))
3837  {
3838  /* If we do not have a function element handler we create one. */
3841  new ListOfSubstratesElement(mParser, mCommon);
3842 
3844  }
3845 
3846  break;
3847 
3848  case ListOfProducts:
3849 
3850  if (!strcmp(pszName, "ListOfProducts"))
3851  {
3854  new ListOfProductsElement(mParser, mCommon);
3855 
3857  }
3858 
3859  break;
3860 
3861  case ListOfModifiers:
3862 
3863  if (!strcmp(pszName, "ListOfModifiers"))
3864  {
3867  new ListOfModifiersElement(mParser, mCommon);
3868 
3870  }
3871 
3872  break;
3873 
3874  case ListOfConstants:
3875 
3876  if (!strcmp(pszName, "ListOfConstants"))
3877  {
3880  new ListOfConstantsElement(mParser, mCommon);
3881 
3883  }
3884 
3885  break;
3886 
3887  case KineticLaw:
3888 
3889  if (!strcmp(pszName, "KineticLaw"))
3890  {
3891  if (!mpKineticLawElement)
3892  mpKineticLawElement = new KineticLawElement(mParser, mCommon);
3893 
3895  }
3896 
3897  break;
3898 
3899  default:
3902  break;
3903  }
3904  }
3905 
3907 
3909  {
3911  }
3912 
3913  mParser.onStartElement(pszName, papszAttrs);
3914 
3915  return;
3916 }
void setReversible(bool reversible)
Definition: CReaction.cpp:247
ListOfSubstratesElement * mpListOfSubstratesElement
UnknownElement mUnknownElement
static bool toBool(const char *attribute)
Definition: CExpat.h:728
ListOfConstantsElement * mpListOfConstantsElement
CCopasiObject * get(const std::string &key)
#define fatalError()
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
void addFix(const std::string &key, CCopasiObject *pObject)
Definition: CXMLHandler.h:119
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
ListOfProductsElement * mpListOfProductsElement
virtual bool add(const CType &src)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
void setSBMLId(const std::string &id)
Definition: CReaction.cpp:1649
MiriamAnnotationElement mMiriamAnnotationElement
ListOfUnsupportedAnnotationsElement mListOfUnsupportedAnnotationsElement
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
ListOfModifiersElement * mpListOfModifiersElement
int getCurrentLineNumber() const
Definition: CExpat.h:470
CommentElement mCommentElement
void setFast(const bool &fast)
Definition: CReaction.cpp:1703
bool setObjectName(const std::string &name)

Member Data Documentation

std::string CCopasiXMLParser::ReactionElement::mKey
private

The key in the CopasiML gile

Definition at line 1172 of file CCopasiXMLParser.h.

KineticLawElement* CCopasiXMLParser::ReactionElement::mpKineticLawElement
private

Pointer to ListOfConstantsElement element handler.

Definition at line 1167 of file CCopasiXMLParser.h.

ListOfConstantsElement* CCopasiXMLParser::ReactionElement::mpListOfConstantsElement
private

Pointer to ListOfConstantsElement element handler.

Definition at line 1162 of file CCopasiXMLParser.h.

ListOfModifiersElement* CCopasiXMLParser::ReactionElement::mpListOfModifiersElement
private

Pointer to ListOfModifiersElement element handler.

Definition at line 1157 of file CCopasiXMLParser.h.

ListOfProductsElement* CCopasiXMLParser::ReactionElement::mpListOfProductsElement
private

Pointer to ListOfProductsElement element handler.

Definition at line 1152 of file CCopasiXMLParser.h.

ListOfSubstratesElement* CCopasiXMLParser::ReactionElement::mpListOfSubstratesElement
private

Pointer to ListOfSubstratesElement element handler.

Definition at line 1147 of file CCopasiXMLParser.h.


The documentation for this class was generated from the following files: