Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
exprClone(expression *copy)
Constructor.
expression * getOriginal(expression *e)
get original expression (can&#39;t make it an expression method as I need a non-const, what &quot;this&quot; would return)
CouNumber operator()()
null function for evaluating the expression
expression clone (points to another expression)
expression * copy_
the expression this object is a (reference) copy of
virtual void print(std::ostream &out=std::cout, bool descend=false) const
Printing.
double CouNumber
main number type in Couenne
expression * clone(Domain *d=NULL) const
cloning method
Expression base class.
virtual ~exprClone()
Destructor.
exprClone(const exprClone &e, Domain *d=NULL)
copy constructor
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
CouNumber Value() const
value