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

virtual-ranges.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-07-14 13:46:14 +0200 (Fri, 14 Jul 2006) $ by $Author: tack $
00010  *     $Revision: 3363 $
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 { namespace Virt {
00023 
00030   class Iterator {
00031   public:
00033 
00034 
00035     virtual void operator++(void) = 0;
00037     virtual bool operator()(void) = 0;
00039 
00040 
00041 
00042     virtual int min(void) const = 0;
00044     virtual int max(void) const = 0;
00046     virtual unsigned int width(void) const = 0;
00048 
00050     virtual ~Iterator(void);
00051   };
00052 
00053   forceinline
00054   Iterator::~Iterator(void) {}
00055 
00065   template <class I>
00066   class RangesTemplate : public Iterator {
00067   private:
00069     I i;
00070   public:
00072 
00073 
00074     RangesTemplate(I& i);
00076     void init(I& i);
00078 
00079 
00080 
00081     virtual void operator++(void);
00083     virtual bool operator()(void);
00085 
00087 
00088 
00089     virtual int min(void) const;
00091     virtual int max(void) const;
00093     virtual unsigned int width(void) const;
00095   };
00096 
00097   template <class I>
00098   RangesTemplate<I>::RangesTemplate(I& i0) : i(i0) {}
00099 
00100   template <class I>
00101   void
00102   RangesTemplate<I>::init(I& i0) { i=i0; }
00103 
00104   template <class I>
00105   bool
00106   RangesTemplate<I>::operator()(void) { return i(); }
00107 
00108   template <class I>
00109   void
00110   RangesTemplate<I>::operator++(void) { ++i; }
00111 
00112   template <class I>
00113   int
00114   RangesTemplate<I>::min(void) const { return i.min(); }
00115 
00116   template <class I>
00117   int
00118   RangesTemplate<I>::max(void) const { return i.max(); }
00119 
00120   template <class I>
00121   unsigned int
00122   RangesTemplate<I>::width(void) const { return i.width(); }
00123 
00124 }}}}
00125 
00126 // STATISTICS: iter-any