COPASI API  4.16.103
CNormalItem.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/compareExpressions/CNormalItem.cpp,v $
3 // $Revision: 1.3 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2007/12/11 20:55:55 $
7 // End CVS Header
8 
9 // Copyright (C) 2007 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc. and EML Research, gGmbH.
11 // All rights reserved.
12 
13 #ifdef WIN32
14 # pragma warning (disable: 4786)
15 # pragma warning (disable: 4243)
16 // warning C4355: 'this' : used in base member initializer list
17 # pragma warning (disable: 4355)
18 #endif // WIN32
19 
20 #include "copasi.h"
21 
22 #include "CNormalItem.h"
23 #include "CNormalFraction.h"
24 
29 
30 /**
31  * Default constructor
32  */
33 CNormalItem::CNormalItem(): CNormalBase(), mName("no name")
34 {}
35 
36 /**
37  * Data constructor
38  */
39 CNormalItem::CNormalItem(const std::string& name, const Type& type): CNormalBase(), mName(name), mType(type)
40 {}
41 
42 /**
43  * Copy contructor
44  */
45 CNormalItem::CNormalItem(const CNormalItem& src): CNormalBase(src), mName(src.mName), mType(src.mType)
46 {}
47 
48 /**
49  * Assignment operator
50  */
52 {
53  this->mName = src.mName;
54  this->mType = src.mType;
55  return *this;
56 }
57 
58 /**
59  * Set the name of this item
60  * @return true.
61  */
62 bool CNormalItem::setName(const std::string& name)
63 {
64  mName = name;
65  return true;
66 }
67 
68 /**
69  * Set the type of this item.
70  * @return true.
71  */
72 bool CNormalItem::setType(const Type& type)
73 {
74  mType = type;
75  return true;
76 }
77 
78 /**
79  * Retrieve the name of this item.
80  * @return mName
81  */
82 const std::string CNormalItem::getName() const
83  {
84  return mName;
85  }
86 
87 /**
88  * Retrieve the type of this item.
89  * @return mType
90  */
92  {
93  return mType;
94  }
95 
96 /**
97  * Examine equality of two items.
98  * @return bool.
99  */
100 bool CNormalItem::operator==(const CNormalItem & rhs) const
101  {return ((rhs.mName == mName) && (rhs.mType == mType));}
102 
103 /**
104  * Examine inequality of two item.
105  * @return bool.
106  */
107 bool CNormalItem::operator<(const CNormalItem & rhs) const
108  {
109  if (mType < rhs.mType)
110  return true;
111  if (rhs.mType < mType)
112  return false;
113  return (mName < rhs.mName);
114  }
115 
116 std::string CNormalItem::toString() const
117  {
118  return this->mName;
119  }
120 
121 std::ostream & operator<< (std::ostream &os, const CNormalItem & d)
122 {
123  os << d.toString();
124  return os;
125 }
126 
128  {
129  return new CNormalItem(*this);
130  }
bool setType(const Type &type)
Definition: CNormalItem.cpp:72
bool setName(const std::string &name)
Definition: CNormalItem.cpp:62
bool operator<(const CNormalItem &rhs) const
std::string mName
Definition: CNormalItem.h:34
const Type & getType() const
Definition: CNormalItem.cpp:91
CNormalItem & operator=(const CNormalItem &src)
Definition: CNormalItem.cpp:51
virtual std::string toString() const
std::ostream & operator<<(std::ostream &os, const CNormalItem &d)
const std::string getName() const
Definition: CNormalItem.cpp:82
virtual CNormalBase * copy() const
bool operator==(const CNormalItem &rhs) const