casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StArrAipsIO.h
Go to the documentation of this file.
1 //# StArrAipsIO.h: AipsIO storage manager for direct table arrays
2 //# Copyright (C) 1994,1995,1996,1999
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 TABLES_STARRAIPSIO_H
29 #define TABLES_STARRAIPSIO_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 class AipsIO;
40 
41 
42 // <summary>
43 // AipsIO storage manager for direct table arrays
44 // </summary>
45 
46 // <use visibility=local>
47 
48 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
49 // </reviewed>
50 
51 // <prerequisite>
52 //# Classes you should understand before using this one.
53 // <li> StManAipsIO
54 // <li> StManColumnAipsIO
55 // </prerequisite>
56 
57 // <etymology>
58 // StManColumnArrayAipsIO handles the access to a direct array in a table
59 // column using the AipsIO storage manager.
60 // </etymology>
61 
62 // <synopsis>
63 // StManColumnArrayAipsIO holds the direct arrays in memory and writes
64 // them into the AipsIO file when the table gets closed.
65 // It fully supports addition and removal of rows.
66 // When a row is added to the table, the direct array gets allocated.
67 // This is possible, because the shape of direct arrays is known.
68 //
69 // The class is derived from StManColumnAipsIO which is used to hold
70 // a pointer to the array.
71 // </synopsis>
72 
73 // <motivation>
74 // StManColumnArrayAipsIO handles the standard data types. The class
75 // is not templated, but a switch statement is used instead.
76 // Templates would cause too many instantiations.
77 // </motivation>
78 
79 // <todo asof="$DATE:$">
80 //# A List of bugs, limitations, extensions or planned refinements.
81 // <li> Maybe TpArrayInt, etc. should be used instead of TpInt.
82 // <li> get/putSlice use too many array operations.
83 // To solve this requires an array constructor taking a
84 // pointer to the data (which is foreseen in the new Array classes).
85 // </todo>
86 
87 
89 {
90 public:
91 
92  // Create a column of the given data type.
94 
95  // Frees up the storage.
97 
98  // It can handle access to a slice in a cell.
99  Bool canAccessSlice (Bool& reask) const;
100 
101  // It can handle access to an entire column.
102  Bool canAccessArrayColumn (Bool& reask) const;
103 
104  // Set the shape of the arrays in the entire column.
105  void setShapeColumn (const IPosition& shape);
106 
107  // Add (newNrrow-oldNrrow) rows to the column.
108  // Allocate the data arrays in these rows.
109  void addRow (uInt newNrrow, uInt oldNrrow);
110 
111  // Get the dimensionality of the item in the given row.
112  // This is the same for all rows.
113  uInt ndim (uInt rownr);
114 
115  // Get the shape of the array in the given row.
116  // This is the same for all rows.
117  IPosition shape (uInt rownr);
118 
119  // Get an array value in the given row.
120  // The buffer pointed to by dataPtr has to have the correct length
121  // (which is guaranteed by the ArrayColumn get function).
122  // <group>
123  void getArrayBoolV (uInt rownr, Array<Bool>* dataPtr);
124  void getArrayuCharV (uInt rownr, Array<uChar>* dataPtr);
125  void getArrayShortV (uInt rownr, Array<Short>* dataPtr);
126  void getArrayuShortV (uInt rownr, Array<uShort>* dataPtr);
127  void getArrayIntV (uInt rownr, Array<Int>* dataPtr);
128  void getArrayuIntV (uInt rownr, Array<uInt>* dataPtr);
129  void getArrayInt64V (uInt rownr, Array<Int64>* dataPtr);
130  void getArrayfloatV (uInt rownr, Array<float>* dataPtr);
131  void getArraydoubleV (uInt rownr, Array<double>* dataPtr);
132  void getArrayComplexV (uInt rownr, Array<Complex>* dataPtr);
133  void getArrayDComplexV (uInt rownr, Array<DComplex>* dataPtr);
134  void getArrayStringV (uInt rownr, Array<String>* dataPtr);
135  // </group>
136 
137  // Put an array value into the given row.
138  // The buffer pointed to by dataPtr has to have the correct length
139  // (which is guaranteed by the ArrayColumn put function).
140  // <group>
141  void putArrayBoolV (uInt rownr, const Array<Bool>* dataPtr);
142  void putArrayuCharV (uInt rownr, const Array<uChar>* dataPtr);
143  void putArrayShortV (uInt rownr, const Array<Short>* dataPtr);
144  void putArrayuShortV (uInt rownr, const Array<uShort>* dataPtr);
145  void putArrayIntV (uInt rownr, const Array<Int>* dataPtr);
146  void putArrayuIntV (uInt rownr, const Array<uInt>* dataPtr);
147  void putArrayInt64V (uInt rownr, const Array<Int64>* dataPtr);
148  void putArrayfloatV (uInt rownr, const Array<float>* dataPtr);
149  void putArraydoubleV (uInt rownr, const Array<double>* dataPtr);
150  void putArrayComplexV (uInt rownr, const Array<Complex>* dataPtr);
151  void putArrayDComplexV (uInt rownr, const Array<DComplex>* dataPtr);
152  void putArrayStringV (uInt rownr, const Array<String>* dataPtr);
153  // </group>
154 
155  // Get a section of the array in the given row.
156  // The buffer pointed to by dataPtr has to have the correct length
157  // (which is guaranteed by the ArrayColumn getSlice function).
158  // <group>
159  void getSliceBoolV (uInt rownr, const Slicer&, Array<Bool>* dataPtr);
160  void getSliceuCharV (uInt rownr, const Slicer&, Array<uChar>* dataPtr);
161  void getSliceShortV (uInt rownr, const Slicer&, Array<Short>* dataPtr);
162  void getSliceuShortV (uInt rownr, const Slicer&, Array<uShort>* dataPtr);
163  void getSliceIntV (uInt rownr, const Slicer&, Array<Int>* dataPtr);
164  void getSliceuIntV (uInt rownr, const Slicer&, Array<uInt>* dataPtr);
165  void getSliceInt64V (uInt rownr, const Slicer&, Array<Int64>* dataPtr);
166  void getSlicefloatV (uInt rownr, const Slicer&, Array<float>* dataPtr);
167  void getSlicedoubleV (uInt rownr, const Slicer&, Array<double>* dataPtr);
168  void getSliceComplexV (uInt rownr, const Slicer&, Array<Complex>* dataPtr);
169  void getSliceDComplexV (uInt rownr, const Slicer&, Array<DComplex>* dataPtr);
170  void getSliceStringV (uInt rownr, const Slicer&, Array<String>* dataPtr);
171  // </group>
172 
173  // Put into a section of the array in the given row.
174  // The buffer pointed to by dataPtr has to have the correct length
175  // (which is guaranteed by the ArrayColumn putSlice function).
176  // <group>
177  void putSliceBoolV (uInt rownr, const Slicer&,
178  const Array<Bool>* dataPtr);
179  void putSliceuCharV (uInt rownr, const Slicer&,
180  const Array<uChar>* dataPtr);
181  void putSliceShortV (uInt rownr, const Slicer&,
182  const Array<Short>* dataPtr);
183  void putSliceuShortV (uInt rownr, const Slicer&,
184  const Array<uShort>* dataPtr);
185  void putSliceIntV (uInt rownr, const Slicer&,
186  const Array<Int>* dataPtr);
187  void putSliceuIntV (uInt rownr, const Slicer&,
188  const Array<uInt>* dataPtr);
189  void putSliceInt64V (uInt rownr, const Slicer&,
190  const Array<Int64>* dataPtr);
191  void putSlicefloatV (uInt rownr, const Slicer&,
192  const Array<float>* dataPtr);
193  void putSlicedoubleV (uInt rownr, const Slicer&,
194  const Array<double>* dataPtr);
195  void putSliceComplexV (uInt rownr, const Slicer&,
196  const Array<Complex>* dataPtr);
197  void putSliceDComplexV (uInt rownr, const Slicer&,
198  const Array<DComplex>* dataPtr);
199  void putSliceStringV (uInt rownr, const Slicer&,
200  const Array<String>* dataPtr);
201  // </group>
202 
203  // Get all array values in the column.
204  // The buffer pointed to by dataPtr has to have the correct length
205  // (which is guaranteed by the ArrayColumn getColumn function).
206  // <group>
207  void getArrayColumnBoolV (Array<Bool>* dataPtr);
208  void getArrayColumnuCharV (Array<uChar>* dataPtr);
209  void getArrayColumnShortV (Array<Short>* dataPtr);
210  void getArrayColumnuShortV (Array<uShort>* dataPtr);
211  void getArrayColumnIntV (Array<Int>* dataPtr);
212  void getArrayColumnuIntV (Array<uInt>* dataPtr);
213  void getArrayColumnInt64V (Array<Int64>* dataPtr);
214  void getArrayColumnfloatV (Array<float>* dataPtr);
215  void getArrayColumndoubleV (Array<double>* dataPtr);
216  void getArrayColumnComplexV (Array<Complex>* dataPtr);
218  void getArrayColumnStringV (Array<String>* dataPtr);
219  // </group>
220 
221  // Put all arrays in the column.
222  // The buffer pointed to by dataPtr has to have the correct length
223  // (which is guaranteed by the ArrayColumn putColumn function).
224  // <group>
225  void putArrayColumnBoolV (const Array<Bool>* dataPtr);
226  void putArrayColumnuCharV (const Array<uChar>* dataPtr);
227  void putArrayColumnShortV (const Array<Short>* dataPtr);
228  void putArrayColumnuShortV (const Array<uShort>* dataPtr);
229  void putArrayColumnIntV (const Array<Int>* dataPtr);
230  void putArrayColumnuIntV (const Array<uInt>* dataPtr);
231  void putArrayColumnInt64V (const Array<Int64>* dataPtr);
232  void putArrayColumnfloatV (const Array<float>* dataPtr);
233  void putArrayColumndoubleV (const Array<double>* dataPtr);
234  void putArrayColumnComplexV (const Array<Complex>* dataPtr);
235  void putArrayColumnDComplexV (const Array<DComplex>* dataPtr);
236  void putArrayColumnStringV (const Array<String>* dataPtr);
237  // </group>
238 
239  // Remove the value at the given index.
240  void remove (uInt index);
241 
242  // Write the data into AipsIO.
243  // This will call StManColumnAipsIO::putFile which will in its turn
244  // call putData in this class for each of its chunks of data.
245  void putFile (uInt nrval, AipsIO&);
246 
247  // Read the data from AipsIO.
248  // This will call StManColumnAipsIO::getFile which will in its turn
249  // call getData in this class for each of its chunks of data.
250  void getFile (uInt nrval, AipsIO&);
251 
252  // Check if the class invariants still hold.
253  Bool ok() const;
254 
255 private:
256  // The data type of the array (as defined in DataType.h).
258  // The shape of the array.
260  // The nr of elements in the array.
262 
263  // Delete the array at the given index.
264  void deleteArray (uInt index);
265 
266  // Put the data of a data block.
267  // datap is an array of nrval pointers to arrays.
268  void putData (void* datap, uInt nrval, AipsIO&);
269 
270  // Get data arrays into a data block at the given index.
271  // datap is an array of pointers to arrays. nrval arrays will
272  // be allocated and read starting at datap[index].
273  void getData (void* datap, uInt index, uInt nrval, AipsIO&, uInt version);
274 
275  // Forbid copy constructor.
277 
278  // Forbid assignment.
280 };
281 
282 
283 
284 
285 } //# NAMESPACE CASACORE - END
286 
287 #endif
void putSliceShortV(uInt rownr, const Slicer &, const Array< Short > *dataPtr)
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
void getArrayStringV(uInt rownr, Array< String > *dataPtr)
void putArrayColumnDComplexV(const Array< DComplex > *dataPtr)
void getArrayColumnBoolV(Array< Bool > *dataPtr)
Get all array values in the column.
void putArrayuIntV(uInt rownr, const Array< uInt > *dataPtr)
void getSliceIntV(uInt rownr, const Slicer &, Array< Int > *dataPtr)
void putArrayColumnuIntV(const Array< uInt > *dataPtr)
StManColumnArrayAipsIO(StManAipsIO *, int dataType)
Create a column of the given data type.
void putSliceuIntV(uInt rownr, const Slicer &, const Array< uInt > *dataPtr)
uInt ndim(uInt rownr)
Get the dimensionality of the item in the given row.
void getArrayuIntV(uInt rownr, Array< uInt > *dataPtr)
uInt nrelem_p
The nr of elements in the array.
Definition: StArrAipsIO.h:261
void getFile(uInt nrval, AipsIO &)
Read the data from AipsIO.
Bool canAccessArrayColumn(Bool &reask) const
It can handle access to an entire column.
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
void putFile(uInt nrval, AipsIO &)
Write the data into AipsIO.
void getArrayColumndoubleV(Array< double > *dataPtr)
IPosition shape_p
The shape of the array.
Definition: StArrAipsIO.h:259
void putArrayColumndoubleV(const Array< double > *dataPtr)
void getSliceBoolV(uInt rownr, const Slicer &, Array< Bool > *dataPtr)
Get a section of the array in the given row.
void getArrayShortV(uInt rownr, Array< Short > *dataPtr)
void setShapeColumn(const IPosition &shape)
Set the shape of the arrays in the entire column.
void putArrayColumnStringV(const Array< String > *dataPtr)
Bool canAccessSlice(Bool &reask) const
It can handle access to a slice in a cell.
void getArrayfloatV(uInt rownr, Array< float > *dataPtr)
void putArrayColumnIntV(const Array< Int > *dataPtr)
void putArrayuCharV(uInt rownr, const Array< uChar > *dataPtr)
AipsIO storage manager for direct table arrays.
Definition: StArrAipsIO.h:88
void getArrayColumnInt64V(Array< Int64 > *dataPtr)
void getSliceInt64V(uInt rownr, const Slicer &, Array< Int64 > *dataPtr)
void getArrayIntV(uInt rownr, Array< Int > *dataPtr)
void putArrayStringV(uInt rownr, const Array< String > *dataPtr)
int dataType() const
Return the data type of the column.
void getArrayColumnStringV(Array< String > *dataPtr)
void getArrayComplexV(uInt rownr, Array< Complex > *dataPtr)
void putArrayColumnfloatV(const Array< float > *dataPtr)
void getSlicefloatV(uInt rownr, const Slicer &, Array< float > *dataPtr)
int dtypeArr_p
The data type of the array (as defined in DataType.h).
Definition: StArrAipsIO.h:257
AipsIO table column storage manager class.
Definition: StManAipsIO.h:106
void getArrayColumnComplexV(Array< Complex > *dataPtr)
void putSlicefloatV(uInt rownr, const Slicer &, const Array< float > *dataPtr)
void deleteArray(uInt index)
Delete the array at the given index.
void putArrayInt64V(uInt rownr, const Array< Int64 > *dataPtr)
void getSliceComplexV(uInt rownr, const Slicer &, Array< Complex > *dataPtr)
void putArrayColumnuCharV(const Array< uChar > *dataPtr)
void putArrayColumnuShortV(const Array< uShort > *dataPtr)
void getSliceDComplexV(uInt rownr, const Slicer &, Array< DComplex > *dataPtr)
void putArrayComplexV(uInt rownr, const Array< Complex > *dataPtr)
void getArrayColumnfloatV(Array< float > *dataPtr)
void getArraydoubleV(uInt rownr, Array< double > *dataPtr)
void addRow(uInt newNrrow, uInt oldNrrow)
Add (newNrrow-oldNrrow) rows to the column.
void getArrayColumnDComplexV(Array< DComplex > *dataPtr)
void putSliceInt64V(uInt rownr, const Slicer &, const Array< Int64 > *dataPtr)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void putSliceComplexV(uInt rownr, const Slicer &, const Array< Complex > *dataPtr)
void getArrayDComplexV(uInt rownr, Array< DComplex > *dataPtr)
void putArrayfloatV(uInt rownr, const Array< float > *dataPtr)
Bool ok() const
Check if the class invariants still hold.
void getSlicedoubleV(uInt rownr, const Slicer &, Array< double > *dataPtr)
void getSliceShortV(uInt rownr, const Slicer &, Array< Short > *dataPtr)
void putArrayColumnBoolV(const Array< Bool > *dataPtr)
Put all arrays in the column.
void getArrayColumnShortV(Array< Short > *dataPtr)
~StManColumnArrayAipsIO()
Frees up the storage.
void putArrayColumnShortV(const Array< Short > *dataPtr)
void getArrayColumnuCharV(Array< uChar > *dataPtr)
void getSliceuShortV(uInt rownr, const Slicer &, Array< uShort > *dataPtr)
IPosition shape(uInt rownr)
Get the shape of the array in the given row.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
void putSliceDComplexV(uInt rownr, const Slicer &, const Array< DComplex > *dataPtr)
AipsIO table storage manager class.
Definition: StManAipsIO.h:367
void putSliceuShortV(uInt rownr, const Slicer &, const Array< uShort > *dataPtr)
void getData(void *datap, uInt index, uInt nrval, AipsIO &, uInt version)
Get data arrays into a data block at the given index.
void putArrayColumnInt64V(const Array< Int64 > *dataPtr)
void putSliceuCharV(uInt rownr, const Slicer &, const Array< uChar > *dataPtr)
void putArrayIntV(uInt rownr, const Array< Int > *dataPtr)
void getArrayuCharV(uInt rownr, Array< uChar > *dataPtr)
void getArrayColumnIntV(Array< Int > *dataPtr)
void getArrayColumnuShortV(Array< uShort > *dataPtr)
void getSliceuCharV(uInt rownr, const Slicer &, Array< uChar > *dataPtr)
void getArrayBoolV(uInt rownr, Array< Bool > *dataPtr)
Get an array value in the given row.
void putSliceBoolV(uInt rownr, const Slicer &, const Array< Bool > *dataPtr)
Put into a section of the array in the given row.
void getSliceStringV(uInt rownr, const Slicer &, Array< String > *dataPtr)
void getSliceuIntV(uInt rownr, const Slicer &, Array< uInt > *dataPtr)
void getArrayColumnuIntV(Array< uInt > *dataPtr)
void putArraydoubleV(uInt rownr, const Array< double > *dataPtr)
void putArrayuShortV(uInt rownr, const Array< uShort > *dataPtr)
void putSlicedoubleV(uInt rownr, const Slicer &, const Array< double > *dataPtr)
void putArrayBoolV(uInt rownr, const Array< Bool > *dataPtr)
Put an array value into the given row.
void putArrayShortV(uInt rownr, const Array< Short > *dataPtr)
void putSliceIntV(uInt rownr, const Slicer &, const Array< Int > *dataPtr)
void getArrayuShortV(uInt rownr, Array< uShort > *dataPtr)
void putArrayDComplexV(uInt rownr, const Array< DComplex > *dataPtr)
void getArrayInt64V(uInt rownr, Array< Int64 > *dataPtr)
unsigned int uInt
Definition: aipstype.h:51
void putArrayColumnComplexV(const Array< Complex > *dataPtr)
StManColumnArrayAipsIO & operator=(const StManColumnArrayAipsIO &)
Forbid assignment.
void putSliceStringV(uInt rownr, const Slicer &, const Array< String > *dataPtr)
void putData(void *datap, uInt nrval, AipsIO &)
Put the data of a data block.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42