casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
HDF5LattIter.h
Go to the documentation of this file.
00001 //# HDF5LattIter.h: a concrete iterator for use with HDF5Lattices.
00002 //# Copyright (C) 2009
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: HDF5LattIter.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $
00027 
00028 #ifndef LATTICES_HDF5LATTITER_H
00029 #define LATTICES_HDF5LATTITER_H
00030 
00031 //# Includes
00032 #include <lattices/Lattices/LatticeIterInterface.h>
00033 #include <lattices/Lattices/HDF5Lattice.h>
00034 
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 // <summary>
00039 // A read/write Lattice iterator for PagedArrays.
00040 // </summary>
00041 
00042 // <use visibility=local>
00043 
00044 // <reviewed reviewer="Peter Barnes" date="1999/10/30" tests="tLatticeIterator.cc" demos="dPagedArray.cc">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //   <li> <linkto class="PagedArray">PagedArray</linkto>
00049 //   <li> <linkto class="LatticeIterator">LatticeIterator</linkto>
00050 //   <li> <linkto class="LatticeIterInterface">LatticeIterInterface
00051 //        </linkto>
00052 //   <li> letter/envelope schemes, eg. Coplien, "Advanced C++", ch 5.5
00053 // </prerequisite>
00054 
00055 // <etymology>
00056 // The HDF5LattIter class name is a contraction of Paged Array Iterator 
00057 // and reflects its role as the methods for iterating through Lattices which 
00058 // are resident on disk.
00059 // </etymology>
00060 
00061 // <synopsis>
00062 // This class is not meant for general use. Instead class
00063 // <linkto class="LatticeIterator">LatticeIterator</linkto> should be used
00064 // to iterate through a <src>PagedArray</src> or any other
00065 // <linkto class="Lattice">Lattice</linkto> object
00066 // (like a <linkto class="ArrayLattice">ArrayLattice</linkto>).
00067 // <p>
00068 // HDF5LattIter is derived from LatticeIterInterface and implements
00069 // the iterator for a <linkto class=PagedArray>PagedArray</linkto>
00070 // object. This iterator is somewhat special because it sets the
00071 // PagedArray cache size at the start of an iteration.
00072 // </synopsis>
00073 
00074 // <motivation>
00075 // For for each derivation of Lattice to make as efficient an iterator as
00076 // possible.
00077 // The letter/envelope scheme allowed us to hide the special bits in
00078 // classes like the one you see here.
00079 // </motivation>
00080 
00081 // <templating arg=T>
00082 //  <li> Restricted to the type of the PagedArray argument in the 
00083 //   constructors
00084 // </templating>
00085 
00086 //# <todo asof="1997/01/31">
00087 //#   <li>
00088 //# </todo>
00089 
00090 
00091 template <class T> class HDF5LattIter : public LatticeIterInterface<T>
00092 {
00093 friend class HDF5Lattice<T>;
00094 
00095   //# Make members of parent class known.
00096 protected:
00097   using LatticeIterInterface<T>::rewriteData;
00098   using LatticeIterInterface<T>::itsNavPtr;
00099 
00100 protected:
00101   // Construct the Iterator with the supplied data, and iteration strategy
00102   HDF5LattIter (const HDF5Lattice<T>& data, const LatticeNavigator& method,
00103                 Bool useRef);
00104 
00105   // The copy constructor uses reference sematics for the PagedArray and
00106   // copy semantics for the cursor and Navigator. This way the newly
00107   // constructed HDF5LattIter can independently iterate through the same
00108   // data set. (with the same cursor shape etc.)
00109   HDF5LattIter (const HDF5LattIter<T>& other);
00110 
00111   // Destructor (cleans up dangling references and releases cursor memory)
00112   virtual ~HDF5LattIter();
00113   
00114   // The assignment operator uses reference sematics for the PagedArray and
00115   // copy semantics for the cursor and Navigator. This way the
00116   // HDF5LattIter objects share the same data set but independently iterate
00117   // with cursors of the same size.
00118   HDF5LattIter<T>& operator= (const HDF5LattIter<T>& other);
00119 
00120   // Clone the object.
00121   virtual LatticeIterInterface<T>* clone() const;
00122 
00123 private:
00124   // Setup the cache in the tiled storage manager.
00125   void setupTileCache();
00126 
00127 
00128   // reference to the PagedArray
00129   HDF5Lattice<T> itsData;
00130 };
00131 
00132 
00133 
00134 } //# NAMESPACE CASA - END
00135 
00136 #ifndef CASACORE_NO_AUTO_TEMPLATES
00137 #include <lattices/Lattices/HDF5LattIter.tcc>
00138 #endif //# CASACORE_NO_AUTO_TEMPLATES
00139 #endif