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

rel.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2003
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-25 17:05:19 +0200 (Fri, 25 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3572 $
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 #include "gecode/int/rel.hh"
00023 
00024 namespace Gecode { namespace Int { namespace Count {
00025 
00026   /*
00027    * Counting domain-consistent equality
00028    *
00029    */
00030 
00031   template <class VX>
00032   forceinline RelTest
00033   holds(VX x, ConstIntView y) {
00034     return rtest_eq_dom(x,y.val());
00035   }
00036   template <class VX>
00037   forceinline RelTest
00038   holds(VX x, VX y) {
00039     return rtest_eq_dom(x,y);
00040   }
00041   template <class VX>
00042   forceinline ExecStatus
00043   post_true(Space* home, VX x, ConstIntView y) {
00044     GECODE_ME_CHECK(x.eq(home,y.val()));
00045     return ES_SUBSUMED;
00046   }
00047   template <class VX>
00048   forceinline ExecStatus
00049   post_true(Space* home, ViewArray<VX>& x, ConstIntView y) {
00050     for (int i = x.size(); i--; )
00051       GECODE_ME_CHECK(x[i].eq(home,y.val()));
00052     return ES_SUBSUMED;
00053   }
00054   template <class VX>
00055   forceinline ExecStatus
00056   post_false(Space* home, VX x, ConstIntView y) {
00057     GECODE_ME_CHECK(x.nq(home,y.val()));
00058     return ES_SUBSUMED;
00059   }
00060   template <class VX>
00061   forceinline ExecStatus
00062   post_false(Space* home, ViewArray<VX>& x, ConstIntView y) {
00063     for (int i = x.size(); i--; )
00064       GECODE_ME_CHECK(x[i].nq(home,y.val()));
00065     return ES_SUBSUMED;
00066   }
00067   template <class VX>
00068   forceinline ExecStatus
00069   post_true(Space* home, ViewArray<VX>& x, VX y) {
00070     ViewArray<VX> z(home,x.size()+1);
00071     z[x.size()] = y;
00072     for (int i = x.size(); i--; )
00073       z[i] = x[i];
00074     GECODE_ES_CHECK(Rel::NaryEqDom<VX>::post(home,z));
00075     return ES_SUBSUMED;
00076   }
00077   template <class VX>
00078   forceinline ExecStatus
00079   post_true(Space* home, VX x, VX y) {
00080     GECODE_ES_CHECK((Rel::EqDom<VX,VX>::post(home,x,y)));
00081     return ES_SUBSUMED;
00082   }
00083   template <class VX>
00084   forceinline ExecStatus
00085   post_false(Space* home, ViewArray<VX>& x, VX y) {
00086     for (int i = x.size(); i--; )
00087       GECODE_ES_CHECK(Rel::Nq<VX>::post(home,x[i],y));
00088     return ES_SUBSUMED;
00089   }
00090   template <class VX>
00091   forceinline ExecStatus
00092   post_false(Space* home, VX x, VX y) {
00093     GECODE_ES_CHECK(Rel::Nq<VX>::post(home,x,y));
00094     return ES_SUBSUMED;
00095   }
00096 
00097 }}}
00098 
00099 // STATISTICS: int-prop
00100