COPASI API  4.16.103
CLRelAbsVector.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLRelAbsVector.h,v $
3 // $Revision: 1.2 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2010/09/16 18:28:05 $
7 // End CVS Header
8 
9 // Copyright (C) 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 #ifndef CLCLRelAbsVector_H__
15 #define CLCLRelAbsVector_H__
16 
17 #include <string>
18 #include <ostream>
19 
20 class RelAbsVector;
21 
23 {
24 protected:
25  double mAbs; // absolute coordinate value
26  double mRel; // relative coordinate value
27 
28 public:
29  /**
30  * Constructor with two values.
31  * First value sets the absolute value, econd sets the relative value.
32  */
33  CLRelAbsVector(double a = 0.0, double r = 0.0);
34 
35  /**
36  * Constructor with a string.
37  * The string has to be parsed.
38  * If the string does not represent a valid value, the relative and the
39  * absolute component of the CLRelAbsVector are set to NaN.
40  */
41  CLRelAbsVector(const std::string& coordString);
42 
43  /**
44  * Constructor to generate object from the corresponding SBML object.
45  */
46  CLRelAbsVector(const RelAbsVector& source);
47 
48  /**
49  * Sets the coordiantes.
50  */
51  void setCoordinate(double abs, double rel = 0.0);
52 
53  /**
54  * Sets the coordiantes from the given string.
55  */
56  void setCoordinate(const std::string& coordString);
57 
58  /**
59  * Sets the absolute coordinate value.
60  */
61  void setAbsoluteValue(double abs);
62 
63  /**
64  * Sets the relative coordinate value.
65  */
66  void setRelativeValue(double rel);
67 
68  /**
69  * Returns the absolute coordinate value.
70  */
71  double getAbsoluteValue() const;
72 
73  /**
74  * Returns the relative coordinate value.
75  */
76  double getRelativeValue() const;
77 
78  /**
79  * addition operator
80  */
81  CLRelAbsVector operator+(const CLRelAbsVector& other) const;
82 
83  /**
84  * division by a double.
85  */
86  CLRelAbsVector operator/(double x) const;
87 
88  bool operator==(const CLRelAbsVector& other) const;
89 
90  bool operator!=(const CLRelAbsVector& other) const;
91 
93 
94  /**
95  * Converts this object to the corresponding SBML object.
96  */
97  RelAbsVector* toSBML() const;
98 
99  std::string toString() const;
100 };
101 
102 std::ostream& operator<<(std::ostream& os, const CLRelAbsVector& v);
103 
104 #endif // CLRelAbsVector_H__
void setAbsoluteValue(double abs)
CLRelAbsVector(double a=0.0, double r=0.0)
bool operator==(const CLRelAbsVector &other) const
double getRelativeValue() const
void setCoordinate(double abs, double rel=0.0)
CLRelAbsVector operator+(const CLRelAbsVector &other) const
CLRelAbsVector & operator=(const CLRelAbsVector &src)
void setRelativeValue(double rel)
RelAbsVector * toSBML() const
bool operator!=(const CLRelAbsVector &other) const
std::ostream & operator<<(std::ostream &os, const CLRelAbsVector &v)
double getAbsoluteValue() const
std::string toString() const
#define abs(x)
Definition: f2c.h:173
CLRelAbsVector operator/(double x) const