FLOPC++
MP_constant.hpp
Go to the documentation of this file.
1 // ******************** FlopCpp **********************************************
2 // File: MP_constant.hpp
3 // $Id$
4 // Author: Tim Helge Hultberg (thh@mat.ua.pt)
5 // Copyright (C) 2003 Tim Helge Hultberg
6 // All Rights Reserved.
7 // ****************************************************************************
8 
9 #ifndef _MP_constant_hpp_
10 #define _MP_constant_hpp_
11 
12 #include "MP_utilities.hpp"
13 
14 namespace flopc {
20  class Constant_base {
21  friend class Constant;
22  friend class Handle<Constant_base*>;
23  public:
24  virtual double evaluate() const = 0;
25  virtual int getStage() const {
26  return 0;
27  }
28  virtual int stage() const {
29  return 0;
30  }
31  protected:
32  Constant_base() : count(0) {}
33  virtual ~Constant_base() {}
34  int count;
35 
36  };
37 
38  class MP_index_exp;
39  class DataRef;
40  class MP_domain;
41 
49  class Constant : public Handle<Constant_base*> {
50  public:
51  Constant(const MP_index_exp& i);
52  Constant(const DataRef& d);
53  Constant(double d);
54  Constant(int d);
55  // operator-();
56  // private:
58  };
59 
60  Constant operator-(const Constant& a);
61 
68  Constant abs(const Constant& c);
78  Constant pos(const Constant& c);
87  Constant ceil(const Constant& c);
96  Constant floor(const Constant& c);
105  Constant minimum(const Constant& a, const Constant& b);
114  Constant maximum(const Constant& a, const Constant& b);
122  Constant operator+(const Constant& a, const Constant& b);
130  Constant operator-(const Constant& a, const Constant& b);
138  Constant operator*(const Constant& a, const Constant& b);
146  Constant operator/(const Constant& a, const Constant& b);
147 
148  class MP_boolean;
149  Constant mpif(const MP_boolean& c, const Constant& a, const Constant& b);
150 
157  Constant maximum(const MP_domain& i, const Constant& e);
164  Constant minimum(const MP_domain& i, const Constant& e);
171  Constant sum(const MP_domain& i, const Constant& e);
178  Constant product(const MP_domain& i, const Constant& e);
179 } // End of namespace flopc
180 #endif