Couenne  0.5.7
CouenneExprClone.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprClone.hpp 645 2011-06-14 10:04:49Z pbelotti $
2  *
3  * Name: exprClone.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of the clone class (different from exprCopy in
6  * that evaluation is propagated)
7  *
8  * (C) Carnegie-Mellon University, 2006.
9  * This file is licensed under the Eclipse Public License (EPL)
10  */
11 
12 #ifndef COUENNE_EXPRCLONE_HPP
13 #define COUENNE_EXPRCLONE_HPP
14 
15 #include <iostream>
16 
17 #include "CouenneTypes.hpp"
18 #include "CouenneExprCopy.hpp"
19 
20 namespace Couenne {
21 
23 
24 class exprClone: public exprCopy {
25 
26  public:
27 
30  exprCopy (getOriginal (copy)) {}
31 
33  exprClone (const exprClone &e, Domain *d = NULL):
34  //{copy_ = e.copy_;}// d = e.domain_;}
35  exprCopy (e, d) {}
36 
38  expression *clone (Domain *d = NULL) const
39  {return new exprClone (*this, d);}
40  /*{
41  if (copy_ != Original ()) return copy_ -> clone (d);
42  else return new exprClone (*this, d);
43  }*/
44  //{return copy_ -> Original () -> clone (d);}
45 
47  virtual ~exprClone () {
48  //if (copy_ != Original ())
49  //delete copy_;
50  copy_ = NULL; // unlink pointer so that ~exprCopy does nothing
51  }
52 
54  virtual void print (std::ostream &out = std::cout,
55  bool descend = false) const;
56 
58  inline CouNumber Value () const
59  {return copy_ -> Value ();}
60 
63  {return ((*copy_) ());}
64 };
65 
66 }
67 
68 #endif
expression * getOriginal(expression *e)
get original expression (can't make it an expression method as I need a non-const,...
exprClone(const exprClone &e, Domain *d=NULL)
copy constructor
CouNumber Value() const
value
exprClone(expression *copy)
Constructor.
double CouNumber
main number type in Couenne
expression * copy_
the expression this object is a (reference) copy of
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
expression * clone(Domain *d=NULL) const
cloning method
expression clone (points to another expression)
virtual ~exprClone()
Destructor.
Expression base class.
CouNumber operator()()
null function for evaluating the expression
virtual void print(std::ostream &out=std::cout, bool descend=false) const
Printing.
general include file for different compilers