Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

infeasible_delta.h

Go to the documentation of this file.
00001 // Infeasible Delta implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2001-2003 Hermann Schichl
00004 //
00005 // This file is part of the COCONUT API.  This library
00006 // is free software; you can redistribute it and/or modify it under the
00007 // terms of the Library GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // Library GNU General Public License for more details.
00015 
00016 // As a special exception, you may use this file as part of a free software
00017 // library without restriction.  Specifically, if other files instantiate
00018 // templates or use macros or inline functions from this file, or you compile
00019 // this file and link it with other files to produce an executable, this
00020 // file does not by itself cause the resulting executable to be covered by
00021 // the Library GNU General Public License.  This exception does not however
00022 // invalidate any other reasons why the executable file might be covered by
00023 // the Library GNU General Public License.
00024 
00027 #ifndef _INFEASIBLE_DELTA_H_
00028 #define _INFEASIBLE_DELTA_H_
00029 
00030 #include <api_delta.h>
00031 
00032 class infeasible_undelta : public undelta_base
00033 {
00034 private:
00035   bool old_infeasible;
00036   
00037 public:
00038   infeasible_undelta(bool _oi = false) : undelta_base(), old_infeasible(_oi) {}
00039   infeasible_undelta(const infeasible_undelta& __d) : undelta_base(__d),
00040                                    old_infeasible(__d.old_infeasible)
00041       {
00042 #if DEBUG_DELTA
00043         std::cerr << "Called infeasible_undelta copy constructor" << std::endl;
00044 #endif
00045       }
00046 
00047   ~infeasible_undelta() {}
00048 
00049   infeasible_undelta* new_copy() const { return new infeasible_undelta(*this); }
00050   void destroy_copy(infeasible_undelta* __d) { delete __d; }
00051 
00052   bool unapply(work_node& _x) const
00053   {
00054     _x.infeasible = old_infeasible;
00055     return true;
00056   }
00057 };
00058 
00059 class infeasible_delta : public delta_base
00060 {
00061 public:
00062   infeasible_delta() : delta_base("infeasible") {}
00063   infeasible_delta(const infeasible_delta& __d) : delta_base(__d)
00064     {
00065 #if DEBUG_DELTA
00066         std::cerr << "Called infeasible_delta copy constructor" << std::endl;
00067 #endif
00068     }
00069 
00070   ~infeasible_delta() {}
00071 
00072   infeasible_delta* new_copy() const { return new infeasible_delta(*this); }
00073   void destroy_copy(infeasible_delta* __d) { delete __d; }
00074 
00075   bool apply(work_node& _x, undelta_base*& _u) const
00076   {
00077     _u = (undelta_base *) new infeasible_undelta(_x.infeasible);
00078     _x.infeasible = true;
00079     return true;
00080   }
00081 };
00082 
00083 #endif /* _INFEASIBLE_DELTA_H_ */

Generated on Tue Nov 4 01:57:57 2003 for COCONUT API by doxygen1.2.18