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

base.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2004
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-25 10:15:00 +0200 (Fri, 25 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3566 $
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 { namespace Int { namespace Bool {
00023 
00024   /*
00025    * Binary Boolean propagators
00026    *
00027    */
00028   template<class BVA, class BVB>
00029   forceinline
00030   BoolBinary<BVA,BVB>::BoolBinary(Space* home, BVA b0, BVB b1)
00031     : Propagator(home), x0(b0), x1(b1) {
00032     x0.subscribe(home,this,PC_INT_VAL);
00033     x1.subscribe(home,this,PC_INT_VAL);
00034   }
00035 
00036   template<class BVA, class BVB>
00037   forceinline
00038   BoolBinary<BVA,BVB>::BoolBinary(Space* home, bool share,
00039                                   BoolBinary<BVA,BVB>& p)
00040     : Propagator(home,share,p) {
00041     x0.update(home,share,p.x0);
00042     x1.update(home,share,p.x1);
00043   }
00044 
00045   template<class BVA, class BVB>
00046   forceinline
00047   BoolBinary<BVA,BVB>::BoolBinary(Space* home, bool share, Propagator& p,
00048                                   BVA b0, BVB b1)
00049     : Propagator(home,share,p) {
00050     x0.update(home,share,b0);
00051     x1.update(home,share,b1);
00052   }
00053 
00054   template<class BVA, class BVB>
00055   PropCost
00056   BoolBinary<BVA,BVB>::cost(void) const {
00057     return PC_UNARY_LO;
00058   }
00059 
00060   template<class BVA, class BVB>
00061   size_t
00062   BoolBinary<BVA,BVB>::dispose(Space* home) {
00063     assert(!home->failed());
00064     x0.cancel(home,this,PC_INT_VAL);
00065     x1.cancel(home,this,PC_INT_VAL);
00066     (void) Propagator::dispose(home);
00067     return sizeof(*this);
00068   }
00069 
00070   /*
00071    * Ternary Boolean propagators
00072    *
00073    */
00074   template<class BVA, class BVB, class BVC>
00075   forceinline
00076   BoolTernary<BVA,BVB,BVC>::BoolTernary
00077   (Space* home, BVA b0, BVB b1, BVC b2)
00078     : Propagator(home), x0(b0), x1(b1), x2(b2) {
00079     x0.subscribe(home,this,PC_INT_VAL);
00080     x1.subscribe(home,this,PC_INT_VAL);
00081     x2.subscribe(home,this,PC_INT_VAL);
00082   }
00083 
00084   template<class BVA, class BVB, class BVC>
00085   forceinline
00086   BoolTernary<BVA,BVB,BVC>::BoolTernary(Space* home, bool share,
00087                                         BoolTernary<BVA,BVB,BVC>& p)
00088     : Propagator(home,share,p) {
00089     x0.update(home,share,p.x0);
00090     x1.update(home,share,p.x1);
00091     x2.update(home,share,p.x2);
00092   }
00093 
00094   template<class BVA, class BVB, class BVC>
00095   forceinline
00096   BoolTernary<BVA,BVB,BVC>::BoolTernary(Space* home, bool share, Propagator& p,
00097                                         BVA b0, BVB b1, BVC b2)
00098     : Propagator(home,share,p) {
00099     x0.update(home,share,b0);
00100     x1.update(home,share,b1);
00101     x2.update(home,share,b2);
00102   }
00103 
00104   template<class BVA, class BVB, class BVC>
00105   PropCost
00106   BoolTernary<BVA,BVB,BVC>::cost(void) const {
00107     return PC_BINARY_LO;
00108   }
00109 
00110   template<class BVA, class BVB, class BVC>
00111   size_t
00112   BoolTernary<BVA,BVB,BVC>::dispose(Space* home) {
00113     assert(!home->failed());
00114     x0.cancel(home,this,PC_INT_VAL);
00115     x1.cancel(home,this,PC_INT_VAL);
00116     x2.cancel(home,this,PC_INT_VAL);
00117     (void) Propagator::dispose(home);
00118     return sizeof(*this);
00119   }
00120 
00121 }}}
00122 
00123 // STATISTICS: int-prop