Generated on Wed Nov 1 15:04:38 2006 for Gecode by doxygen 1.4.5

propagator.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2004, 2005
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-05-29 09:42:21 +0200 (Mon, 29 May 2006) $ by $Author: schulte $
00010  *     $Revision: 3246 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 namespace Gecode {
00023 
00033 
00034 
00041   template <class View, PropCond pcs, PropCond pci>
00042   class IntSetPropagator : public Propagator {
00043   protected:
00044     View x0;
00045     Gecode::Int::IntView x1;
00047     IntSetPropagator(Space* home,bool,IntSetPropagator&);
00049     IntSetPropagator(Space* home,View,Gecode::Int::IntView,bool=false);
00050   public:
00052     virtual PropCost cost(void) const;
00054     virtual size_t dispose(Space* home);
00055   };
00056 
00058 
00059   template <class View, PropCond pcs, PropCond pci>
00060   IntSetPropagator<View,pcs,pci>::IntSetPropagator
00061   (Space* home, View y0, Gecode::Int::IntView y1, bool fd)
00062     : Propagator(home,fd), x0(y0), x1(y1) {
00063     x0.subscribe(home,this,pcs);
00064     x1.subscribe(home,this,pci);
00065   }
00066 
00067   template <class View, PropCond pcs, PropCond pci>
00068   forceinline
00069   IntSetPropagator<View,pcs,pci>::IntSetPropagator
00070   (Space* home, bool share, IntSetPropagator<View,pcs,pci>& p)
00071     : Propagator(home,share,p) {
00072     x0.update(home,share,p.x0);
00073     x1.update(home,share,p.x1);
00074   }
00075 
00076   template <class View, PropCond pcs, PropCond pci>
00077   PropCost
00078   IntSetPropagator<View,pcs,pci>::cost(void) const {
00079     return PC_BINARY_LO;
00080   }
00081 
00082   template <class View, PropCond pcs, PropCond pci>
00083   size_t
00084   IntSetPropagator<View,pcs,pci>::dispose(Space* home) {
00085     if (!home->failed()) {
00086       x0.cancel(home,this,pcs);
00087       x1.cancel(home,this,pci);
00088     }
00089     (void) Propagator::dispose(home);
00090     return sizeof(*this);
00091   }
00092 
00093 }
00094 
00095 // STATISTICS: set-prop
00096