00001 /* $Id: exprClone.hpp 141 2009-06-03 04:19:19Z pbelotti $ */ 00002 /* 00003 * Name: exprClone.hpp 00004 * Author: Pietro Belotti 00005 * Purpose: definition of the clone class (different from exprCopy in 00006 * that evaluation is propagated) 00007 * 00008 * (C) Carnegie-Mellon University, 2006. 00009 * This file is licensed under the Common Public License (CPL) 00010 */ 00011 00012 #ifndef COUENNE_EXPRCLONE_HPP 00013 #define COUENNE_EXPRCLONE_HPP 00014 00015 #include <iostream> 00016 00017 #include "CouenneTypes.hpp" 00018 #include "exprCopy.hpp" 00019 00020 00022 00023 class exprClone: public exprCopy { 00024 00025 public: 00026 00028 exprClone (expression *copy): 00029 exprCopy (getOriginal (copy)) {} 00030 00032 exprClone (const exprClone &e, Domain *d = NULL): 00033 //{copy_ = e.copy_;}// d = e.domain_;} 00034 exprCopy (e, d) {} 00035 00037 expression *clone (Domain *d = NULL) const 00038 {return new exprClone (*this, d);} 00039 /*{ 00040 if (copy_ != Original ()) return copy_ -> clone (d); 00041 else return new exprClone (*this, d); 00042 }*/ 00043 //{return copy_ -> Original () -> clone (d);} 00044 00046 virtual ~exprClone () { 00047 //if (copy_ != Original ()) 00048 //delete copy_; 00049 copy_ = NULL; // unlink pointer so that ~exprCopy does nothing 00050 } 00051 00053 //void print (std::ostream &out = std::cout, 00054 //bool descend = false) const 00055 //{copy_ -> Original () -> print (out, descend);} 00056 //{out << "{"; copy_ -> print (out, descend); out << "}"; } // Must go 00057 00059 inline CouNumber Value () const 00060 {return copy_ -> Value ();} 00061 00063 inline CouNumber operator () () 00064 {return ((*copy_) ());} 00065 00067 //void realign (const CouenneProblem *p); 00068 }; 00069 00070 #endif