casacore
PagedArrIter.h
Go to the documentation of this file.
1 //# PagedArrIter.h: A concrete iterator for use with PagedArray's.
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2003
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_PAGEDARRITER_H
29 #define LATTICES_PAGEDARRITER_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/lattices/Lattices/LatticeIterInterface.h>
34 #include <casacore/lattices/Lattices/PagedArray.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 PagedArrIter 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 // PagedArrIter 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 PagedArrIter : public LatticeIterInterface<T>
93 {
94 friend class PagedArray<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  PagedArrIter (const PagedArray<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 PagedArrIter can independently iterate through the same
109  // data set. (with the same cursor shape etc.)
110  PagedArrIter (const PagedArrIter<T>& other);
111 
112  // Destructor (cleans up dangling references and releases cursor memory)
113  virtual ~PagedArrIter();
114 
115  // The assignment operator uses reference sematics for the PagedArray and
116  // copy semantics for the cursor and Navigator. This way the
117  // PagedArrIter 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/PagedArrIter.tcc>
139 #endif //# CASACORE_NO_AUTO_TEMPLATES
140 #endif
virtual ~PagedArrIter()
Destructor (cleans up dangling references and releases cursor memory)
PagedArrIter< T > & operator=(const PagedArrIter< T > &other)
The assignment operator uses reference sematics for the PagedArray and copy semantics for the cursor ...
PagedArray< T > itsData
reference to the PagedArray
Definition: PagedArrIter.h:130
A base class for Lattice iterators.
Definition: ImageExpr.h:46
A read/write Lattice iterator for PagedArrays.
Definition: PagedArrIter.h:92
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual LatticeIterInterface< T > * clone() const
Clone the object.
PagedArrIter(const PagedArray< 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.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
Abstract base class to steer lattice iterators.
A Lattice that is read from or written to disk.
Definition: PagedArray.h:373