COPASI API  4.16.103
CNormalBase.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/compareExpressions/CNormalBase.cpp,v $
3 // $Revision: 1.4 $
4 // $Name: $
5 // $Author: gauges $
6 // $Date: 2009/03/03 15:57:53 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 #ifdef WIN32
19 # pragma warning (disable: 4786)
20 # pragma warning (disable: 4243)
21 // warning C4355: 'this' : used in base member initializer list
22 # pragma warning (disable: 4355)
23 #endif // WIN32
24 
25 #include "CNormalBase.h"
26 
27 #include "CNormalFraction.h"
28 #include "CNormalSum.h"
29 #include "CNormalProduct.h"
30 #include "CNormalItem.h"
31 #include "CNormalItemPower.h"
32 #include "CNormalGeneralPower.h"
33 #include "CNormalFunction.h"
34 //#include "CNormalChoice.h"
35 //#include "CNormalLogical.h"
36 
37 bool CNormalBase::areEqual(const CNormalBase& rhs) const
38  {
39  bool result = false;
40  if (dynamic_cast<const CNormalItem*>(this) != NULL && dynamic_cast<const CNormalItem*>(&rhs) != NULL)
41  {
42  result = (static_cast<const CNormalItem&>(*this) == static_cast<const CNormalItem&>(rhs));
43  }
44  else if (dynamic_cast<const CNormalFraction*>(this) != NULL && dynamic_cast<const CNormalFraction*>(&rhs) != NULL)
45  {
46  result = (static_cast<const CNormalFraction&>(*this) == static_cast<const CNormalFraction&>(rhs));
47  }
48  else if (dynamic_cast<const CNormalSum*>(this) != NULL && dynamic_cast<const CNormalSum*>(&rhs) != NULL)
49  {
50  result = (static_cast<const CNormalSum&>(*this) == static_cast<const CNormalSum&>(rhs));
51  }
52  else if (dynamic_cast<const CNormalProduct*>(this) != NULL && dynamic_cast<const CNormalProduct*>(&rhs) != NULL)
53  {
54  result = (static_cast<const CNormalProduct&>(*this) == static_cast<const CNormalProduct&>(rhs));
55  }
56  else if (dynamic_cast<const CNormalItemPower*>(this) != NULL && dynamic_cast<const CNormalItemPower*>(&rhs) != NULL)
57  {
58  result = (static_cast<const CNormalItemPower&>(*this) == static_cast<const CNormalItemPower&>(rhs));
59  }
60  else if (dynamic_cast<const CNormalGeneralPower*>(this) != NULL && dynamic_cast<const CNormalGeneralPower*>(&rhs) != NULL)
61  {
62  result = (static_cast<const CNormalGeneralPower&>(*this) == static_cast<const CNormalGeneralPower&>(rhs));
63  }
64  else if (dynamic_cast<const CNormalFunction*>(this) != NULL && dynamic_cast<const CNormalFunction*>(&rhs) != NULL)
65  {
66  result = (static_cast<const CNormalFunction&>(*this) == static_cast<const CNormalFunction&>(rhs));
67  }
68  /*
69  else if(dynamic_cast<const CNormalLogical*>(this)!=NULL && dynamic_cast<const CNormalLogical*>(&rhs)!=NULL)
70  {
71  result=(static_cast<const CNormalLogical&>(*this)==static_cast<const CNormalLogical&>(rhs));
72  }
73  else if(dynamic_cast<const CNormalChoice*>(this)!=NULL && dynamic_cast<const CNormalChoice*>(&rhs)!=NULL)
74  {
75  result=(static_cast<const CNormalChoice&>(*this)==static_cast<const CNormalChoice&>(rhs));
76  }
77  */
78  return result;
79  }
80 
81 #ifdef COPASI_DEBUG
82 void CNormalBase::refresh() const
83  {
84  this->mInfix = this->toString();
85  }
86 #endif /* COPASI_DEBUG */
87 
virtual std::string toString() const =0
virtual bool areEqual(const CNormalBase &rhs) const
Definition: CNormalBase.cpp:37