Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members

fixiterator.h

00001 /* -*- c++ -*- */
00002 /*
00003  * Expresso, a C++ Array template class library
00004  * Copyright (C) 1998,2004 Oskar Enoksson (enok@lysator.liu.se)
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA  02111-1307, USA.
00020  */
00021 #ifndef EXPRESSO_FIXITERATOR_HDR
00022 #define EXPRESSO_FIXITERATOR_HDR
00023 
00024 namespace esso {
00025 
00026   template<int N, class T0>
00027   class Array<N,Iterator<Fix<T0> > > {
00028     typedef Fix<T0> Type;
00029   public:
00030     typedef typename Array<N,Type>::T T;
00031     typedef Array<N,Iterator<Type> > IteratorType;
00032     enum { hasdata=0 };
00033 
00034     inline IXTYPE L(int i) const { return src.L(i); }
00035     inline IXTYPE U(int i) const { return src.U(i); }
00036     inline IXTYPE Len(int i) const { return U(i)-L(i); }
00037     inline void Step(int n) { origo+=src.Stride(n); }
00038     inline void Step(int n, IXTYPE i) { origo+=src.Stride(n)*i; }
00039     inline T CGet() const { return *origo; }
00040     inline T CGet(IXTYPE i) const { return origo[i]; std::cout<<"Y";}
00041     inline T & Get() const { return *origo; }
00042     inline T & Get(IXTYPE i) const { return origo[i]; std::cout<<"X";}
00043 
00044   inline Array(const Array<N,Type> &src0): src(src0), origo(src0.Origo()) {}
00045   private:
00046     const Array<N,Type> & src;
00047     T * origo;
00048   };
00049 }
00050 #endif

Generated on Wed May 12 12:32:20 2004 for Expresso by doxygen 1.3.3