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

element.cc

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-04 15:23:45 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3509 $
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/element.hh"
00023 
00024 namespace Gecode {
00025 
00026   using namespace Int;
00027 
00028   void
00029   element(Space* home, const IntArgs& c, IntVar x0, IntVar x1,
00030           IntConLevel) {
00031     if (home->failed()) return;
00032     Element::IntSharedArray cs(c.size());
00033     for (int i = c.size(); i--; )
00034       if ((c[i] < Limits::Int::int_min) || (c[i] > Limits::Int::int_max))
00035         throw NumericalOverflow("Int::element");
00036       else
00037         cs[i] = c[i];
00038     GECODE_ES_FAIL(home,(Element::Int<IntView,IntView>::post(home,cs,x0,x1)));
00039   }
00040 
00041   void
00042   element(Space* home, const IntVarArgs& c, IntVar x0, IntVar x1,
00043           IntConLevel icl) {
00044     if (home->failed()) return;
00045     Element::IdxView<IntView>* iv = Element::IdxView<IntView>::init(home,c);
00046     if (icl == ICL_BND) {
00047       GECODE_ES_FAIL(home,(Element::ViewBnd<IntView,IntView>
00048                            ::post(home,iv,c.size(),x0,x1)));
00049     } else {
00050       GECODE_ES_FAIL(home,(Element::ViewDom<IntView,IntView>
00051                            ::post(home,iv,c.size(),x0,x1)));
00052     }
00053   }
00054 
00055 }
00056 
00057 // STATISTICS: int-post
00058