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

int.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2002
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-09-26 13:46:01 +0200 (Tue, 26 Sep 2006) $ by $Author: tack $
00010  *     $Revision: 3703 $
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.hh"
00023 
00024 namespace Gecode {
00025 
00026   IntVar::IntVar(Space* home, int min, int max)
00027     : var(new (home) Int::IntVarImp(home,min,max)) {
00028     if ((min < Limits::Int::int_min) || (max > Limits::Int::int_max))
00029       throw Int::VariableOutOfRangeDomain("IntVar::IntVar");
00030     if (min > max)
00031       throw Int::VariableEmptyDomain("IntVar::IntVar");
00032   }
00033 
00034   IntVar::IntVar(Space* home, const IntSet& ds)
00035     : var(new (home) Int::IntVarImp(home,ds)) {
00036     if ((ds.min() < Limits::Int::int_min) || (ds.max() > Limits::Int::int_max))
00037       throw Int::VariableOutOfRangeDomain("IntVar::IntVar");
00038     if (ds.size() == 0)
00039       throw Int::VariableEmptyDomain("IntVar::IntVar");
00040   }
00041 
00042   void
00043   IntVar::init(Space* home, int min, int max) {
00044     if ((min < Limits::Int::int_min) || (max > Limits::Int::int_max))
00045       throw Int::VariableOutOfRangeDomain("IntVar::init");
00046     if (min > max)
00047       throw Int::VariableEmptyDomain("IntVar::init");
00048     var = new (home) Int::IntVarImp(home,min,max);
00049   }
00050 
00051   void
00052   IntVar::init(Space* home, const IntSet& ds) {
00053     if ((ds.min() < Limits::Int::int_min) || (ds.max() > Limits::Int::int_max))
00054       throw Int::VariableOutOfRangeDomain("IntVar::init");
00055     if (ds.size() == 0)
00056       throw Int::VariableEmptyDomain("IntVar::init");
00057     var = new (home) Int::IntVarImp(home,ds);
00058   }
00059 
00060 }
00061 
00062 // STATISTICS: int-var
00063