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

ranges-offset.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-04 16:05:50 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3515 $
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 Iter { namespace Ranges {
00023 
00030   template <class I>
00031   class Offset {
00032   protected:
00034     I i;
00036     int c;
00037   public:
00039 
00040 
00041     Offset(void);
00043     Offset(I& i, int c);
00045     void init(I& i, int c);
00047 
00049 
00050 
00051     bool operator()(void) const;
00053     void operator++(void);
00055 
00057 
00058 
00059     int min(void) const;
00061     int max(void) const;
00063     unsigned int width(void) const;
00065   };
00066 
00067 
00068   template <class I>
00069   forceinline
00070   Offset<I>::Offset(void) {}
00071 
00072   template <class I>
00073   inline void
00074   Offset<I>::init(I& i0, int c0) {
00075     i = i0; c = c0;
00076   }
00077 
00078   template <class I>
00079   inline
00080   Offset<I>::Offset(I& i0, int c0) : i(i0), c(c0) {}
00081 
00082   template <class I>
00083   forceinline void
00084   Offset<I>::operator++(void) {
00085     ++i;
00086   }
00087   template <class I>
00088   forceinline bool
00089   Offset<I>::operator()(void) const {
00090     return i();
00091   }
00092 
00093   template <class I>
00094   forceinline int
00095   Offset<I>::min(void) const {
00096     return i.min()+c;
00097   }
00098   template <class I>
00099   forceinline int
00100   Offset<I>::max(void) const {
00101     return i.max()+c;
00102   }
00103   template <class I>
00104   forceinline unsigned int
00105   Offset<I>::width(void) const {
00106     return i.width();
00107   }
00108 
00109 }}}
00110 
00111 // STATISTICS: iter-any
00112