casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HDF5LattIter.h
Go to the documentation of this file.
1 //# HDF5LattIter.h: a concrete iterator for use with HDF5Lattices.
2 //# Copyright (C) 2009
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef LATTICES_HDF5LATTITER_H
29 #define LATTICES_HDF5LATTITER_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // A read/write Lattice iterator for PagedArrays.
41 // </summary>
42 
43 // <use visibility=local>
44 
45 // <reviewed reviewer="Peter Barnes" date="1999/10/30" tests="tLatticeIterator.cc" demos="dPagedArray.cc">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> <linkto class="PagedArray">PagedArray</linkto>
50 // <li> <linkto class="LatticeIterator">LatticeIterator</linkto>
51 // <li> <linkto class="LatticeIterInterface">LatticeIterInterface
52 // </linkto>
53 // <li> letter/envelope schemes, eg. Coplien, "Advanced C++", ch 5.5
54 // </prerequisite>
55 
56 // <etymology>
57 // The HDF5LattIter class name is a contraction of Paged Array Iterator
58 // and reflects its role as the methods for iterating through Lattices which
59 // are resident on disk.
60 // </etymology>
61 
62 // <synopsis>
63 // This class is not meant for general use. Instead class
64 // <linkto class="LatticeIterator">LatticeIterator</linkto> should be used
65 // to iterate through a <src>PagedArray</src> or any other
66 // <linkto class="Lattice">Lattice</linkto> object
67 // (like a <linkto class="ArrayLattice">ArrayLattice</linkto>).
68 // <p>
69 // HDF5LattIter is derived from LatticeIterInterface and implements
70 // the iterator for a <linkto class=PagedArray>PagedArray</linkto>
71 // object. This iterator is somewhat special because it sets the
72 // PagedArray cache size at the start of an iteration.
73 // </synopsis>
74 
75 // <motivation>
76 // For for each derivation of Lattice to make as efficient an iterator as
77 // possible.
78 // The letter/envelope scheme allowed us to hide the special bits in
79 // classes like the one you see here.
80 // </motivation>
81 
82 // <templating arg=T>
83 // <li> Restricted to the type of the PagedArray argument in the
84 // constructors
85 // </templating>
86 
87 //# <todo asof="1997/01/31">
88 //# <li>
89 //# </todo>
90 
91 
92 template <class T> class HDF5LattIter : public LatticeIterInterface<T>
93 {
94 friend class HDF5Lattice<T>;
95 
96  //# Make members of parent class known.
97 protected:
100 
101 protected:
102  // Construct the Iterator with the supplied data, and iteration strategy
103  HDF5LattIter (const HDF5Lattice<T>& data, const LatticeNavigator& method,
104  Bool useRef);
105 
106  // The copy constructor uses reference sematics for the PagedArray and
107  // copy semantics for the cursor and Navigator. This way the newly
108  // constructed HDF5LattIter can independently iterate through the same
109  // data set. (with the same cursor shape etc.)
110  HDF5LattIter (const HDF5LattIter<T>& other);
111 
112  // Destructor (cleans up dangling references and releases cursor memory)
113  virtual ~HDF5LattIter();
114 
115  // The assignment operator uses reference sematics for the PagedArray and
116  // copy semantics for the cursor and Navigator. This way the
117  // HDF5LattIter objects share the same data set but independently iterate
118  // with cursors of the same size.
120 
121  // Clone the object.
122  virtual LatticeIterInterface<T>* clone() const;
123 
124 private:
125  // Setup the cache in the tiled storage manager.
126  void setupTileCache();
127 
128 
129  // reference to the PagedArray
131 };
132 
133 
134 
135 } //# NAMESPACE CASACORE - END
136 
137 #ifndef CASACORE_NO_AUTO_TEMPLATES
138 #include <casacore/lattices/Lattices/HDF5LattIter.tcc>
139 #endif //# CASACORE_NO_AUTO_TEMPLATES
140 #endif
A read/write Lattice iterator for PagedArrays.
Definition: HDF5LattIter.h:92
virtual ~HDF5LattIter()
Destructor (cleans up dangling references and releases cursor memory)
virtual LatticeIterInterface< T > * clone() const
Clone the object.
A base class for Lattice iterators.
Definition: ImageExpr.h:47
HDF5LattIter< T > & operator=(const HDF5LattIter< T > &other)
The assignment operator uses reference sematics for the PagedArray and copy semantics for the cursor ...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
HDF5LattIter(const HDF5Lattice< T > &data, const LatticeNavigator &method, Bool useRef)
Construct the Iterator with the supplied data, and iteration strategy.
void setupTileCache()
Setup the cache in the tiled storage manager.
HDF5Lattice< T > itsData
reference to the PagedArray
Definition: HDF5LattIter.h:130
A Lattice that is read from or written to an HDF5 dataset.
Definition: HDF5Lattice.h:109
Abstract base class to steer lattice iterators.