Generated on Mon Aug 25 11:35:36 2008 for Gecode by doxygen 1.5.6

int.icc

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2002
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-01-31 18:29:16 +0100 (Thu, 31 Jan 2008) $ by $Author: tack $
00011  *     $Revision: 6017 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 namespace Gecode { namespace Int {
00039 
00040   /*
00041    * Constructors and initialization
00042    *
00043    */
00044   forceinline
00045   IntView::IntView(void) {}
00046   forceinline
00047   IntView::IntView(const IntVar& x)
00048     : VarViewBase<IntVarImp>(x.var()) {}
00049   forceinline
00050   IntView::IntView(IntVarImp* x)
00051     : VarViewBase<IntVarImp>(x) {}
00052   forceinline
00053   IntView::IntView(Space* /*home*/, const Reflection::VarMap& vars,
00054                    Reflection::Arg* arg) 
00055     : VarViewBase<IntVarImp>(IntVar(vars.var(arg->toVar())).var()) {}
00056 
00057   /*
00058    * Value access
00059    *
00060    */
00061   forceinline int
00062   IntView::min(void) const {
00063     return varimp->min();
00064   }
00065   forceinline int
00066   IntView::max(void) const {
00067     return varimp->max();
00068   }
00069   forceinline int
00070   IntView::med(void) const {
00071     return varimp->med();
00072   }
00073   forceinline int
00074   IntView::val(void) const {
00075     return varimp->val();
00076   }
00077 
00078   forceinline unsigned int
00079   IntView::size(void) const {
00080     return varimp->size();
00081   }
00082   forceinline unsigned int
00083   IntView::width(void) const {
00084     return varimp->width();
00085   }
00086   forceinline unsigned int
00087   IntView::regret_min(void) const {
00088     return varimp->regret_min();
00089   }
00090   forceinline unsigned int
00091   IntView::regret_max(void) const {
00092     return varimp->regret_max();
00093   }
00094 
00095 
00096   /*
00097    * Domain tests
00098    *
00099    */
00100   forceinline bool
00101   IntView::range(void) const {
00102     return varimp->range();
00103   }
00104   forceinline bool
00105   IntView::assigned(void) const {
00106     return varimp->assigned();
00107   }
00108 
00109   forceinline bool
00110   IntView::in(int n) const {
00111     return varimp->in(n);
00112   }
00113   forceinline bool
00114   IntView::in(double n) const {
00115     return varimp->in(n);
00116   }
00117 
00118 
00119   /*
00120    * Domain update by value
00121    *
00122    */
00123   forceinline ModEvent
00124   IntView::lq(Space* home, int n) {
00125     return varimp->lq(home,n);
00126   }
00127   forceinline ModEvent
00128   IntView::lq(Space* home, double n) {
00129     return varimp->lq(home,n);
00130   }
00131 
00132   forceinline ModEvent
00133   IntView::le(Space* home, int n) {
00134     return varimp->lq(home,n-1);
00135   }
00136   forceinline ModEvent
00137   IntView::le(Space* home, double n) {
00138     return lq(home,n-1.0);
00139   }
00140 
00141   forceinline ModEvent
00142   IntView::gq(Space* home, int n) {
00143     return varimp->gq(home,n);
00144   }
00145   forceinline ModEvent
00146   IntView::gq(Space* home, double n) {
00147     return varimp->gq(home,n);
00148   }
00149 
00150   forceinline ModEvent
00151   IntView::gr(Space* home, int n) {
00152     return varimp->gq(home,n+1);
00153   }
00154   forceinline ModEvent
00155   IntView::gr(Space* home, double n) {
00156     return gq(home,n+1.0);
00157   }
00158 
00159   forceinline ModEvent
00160   IntView::nq(Space* home, int n) {
00161     return varimp->nq(home,n);
00162   }
00163   forceinline ModEvent
00164   IntView::nq(Space* home, double n) {
00165     return varimp->nq(home,n);
00166   }
00167 
00168   forceinline ModEvent
00169   IntView::eq(Space* home, int n) {
00170     return varimp->eq(home,n);
00171   }
00172   forceinline ModEvent
00173   IntView::eq(Space* home, double n) {
00174     return varimp->eq(home,n);
00175   }
00176 
00177 
00178   /*
00179    * Iterator-based domain update
00180    *
00181    */
00182   template <class I>
00183   forceinline ModEvent
00184   IntView::narrow_r(Space* home, I& i, bool depend) {
00185     return varimp->narrow_r(home,i,depend);
00186   }
00187   template <class I>
00188   forceinline ModEvent
00189   IntView::inter_r(Space* home, I& i, bool depend) {
00190     return varimp->inter_r(home,i,depend);
00191   }
00192   template <class I>
00193   forceinline ModEvent
00194   IntView::minus_r(Space* home, I& i, bool depend) {
00195     return varimp->minus_r(home,i,depend);
00196   }
00197   template <class I>
00198   forceinline ModEvent
00199   IntView::narrow_v(Space* home, I& i, bool depend) {
00200     return varimp->narrow_v(home,i,depend);
00201   }
00202   template <class I>
00203   forceinline ModEvent
00204   IntView::inter_v(Space* home, I& i, bool depend) {
00205     return varimp->inter_v(home,i,depend);
00206   }
00207   template <class I>
00208   forceinline ModEvent
00209   IntView::minus_v(Space* home, I& i, bool depend) {
00210     return varimp->minus_v(home,i,depend);
00211   }
00212 
00213 
00214 
00215 
00216   /*
00217    * Delta information for advisors
00218    *
00219    */
00220   forceinline ModEvent
00221   IntView::modevent(const Delta* d) {
00222     return IntVarImp::modevent(d);
00223   }
00224   forceinline int
00225   IntView::min(const Delta* d) const {
00226     return varimp->min(d);
00227   }
00228   forceinline int
00229   IntView::max(const Delta* d) const {
00230     return varimp->max(d);
00231   }
00232   forceinline bool
00233   IntView::any(const Delta* d) const {
00234     return varimp->any(d);
00235   }
00236 
00237 
00238   forceinline ModEventDelta
00239   IntView::med(ModEvent me) {
00240     return VarViewBase<IntVarImp>::med(me);
00241   }
00242 
00243 
00244 
00245   /*
00246    * Cloning
00247    *
00248    */
00249   forceinline void
00250   IntView::update(Space* home, bool share, IntView& x) {
00251     varimp = x.varimp->copy(home,share);
00252   }
00253 
00254   /*
00255    * Serialization
00256    *
00257    */
00258   forceinline Reflection::Arg*
00259   IntView::spec(const Space* home, Reflection::VarMap& m) const {
00260     return varimp->spec(home, m);
00261   }
00262   inline Support::Symbol
00263   IntView::type(void) {
00264     return Support::Symbol("Gecode::Int::IntView");
00265   }
00266 
00267 
00272   template <>
00273   class ViewRanges<IntView> : public IntVarImpFwd {
00274   public:
00276 
00277 
00278     ViewRanges(void);
00280     ViewRanges(const IntView& x);
00282     void init(const IntView& x);
00284   };
00285 
00286   forceinline
00287   ViewRanges<IntView>::ViewRanges(void) {}
00288 
00289   forceinline
00290   ViewRanges<IntView>::ViewRanges(const IntView& x)
00291     : IntVarImpFwd(x.var()) {}
00292 
00293   forceinline void
00294   ViewRanges<IntView>::init(const IntView& x) {
00295     IntVarImpFwd::init(x.var());
00296   }
00297 
00298 }}
00299 
00300 // STATISTICS: int-var
00301