casacore
Loading...
Searching...
No Matches
ArrColData.h
Go to the documentation of this file.
1//# ArrColData.h: Access to a table column containing arrays
2//# Copyright (C) 1994,1995,1996,1998,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: casa-feedback@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#ifndef TABLES_ARRCOLDATA_H
27#define TABLES_ARRCOLDATA_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/PlainColumn.h>
32#include <casacore/casa/Arrays/IPosition.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37class ColumnSet;
38class ArrayColumnDescBase;
39class AipsIO;
40
41
42// <summary>
43// Access to a table column containing arrays
44// </summary>
45
46// <use visibility=local>
47
48// <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
49// </reviewed>
50
51// <prerequisite>
52//# Classes you should understand before using this one.
53// <li> PlainColumn
54// <li> ArrayColumnDesc
55// <li> Table
56// </prerequisite>
57
58// <etymology>
59// ArrayColumnData represents a table column containing array data.
60// </etymology>
61
62// <synopsis>
63// The class ArrayColumnData is derived from PlainColumn.
64// It implements the virtual functions accessing a table column
65// containing arrays with an arbitrary data type.
66// Both direct and indirect arrays are supported.
67//
68// It is possible to access an array or a subsection of it in an
69// individual cell (i.e. table row) or in the entire column.
70// The functions accessing the entire column are implemented by
71// looping over the individual cells.
72//
73// The main task of this class is to communicate with the data manager
74// column object. This consists of:
75// <ul>
76// <li> Binding itself to a data manager.
77// <li> Letting the data manager create its column object and
78// setting the shape for direct arrays.
79// <li> Closing the data manager column object (in putFileDerived).
80// <li> Reconstructing the data manager object for an existing table
81// (in getFileDerived).
82// <li> Transferring get/put calls to the data manager column object.
83// </ul>
84//
85// The class is hidden from the user by the envelope class ArrayColumn.
86// It used directly, it should be done with care. It assumes that the
87// arrays in the various get and put functions have the correct length.
88// ArrayColumn does that check.
89// </synopsis>
90
91// <todo asof="$DATE:$">
92//# A List of bugs, limitations, extensions or planned refinements.
93// <li> support tiling
94// </todo>
95
96
98{
99public:
100
101 // Construct an array column object from the given description
102 // in the given column set.
103 // This constructor is used by ArrayColumnDescBase::makeColumn.
105
107
108 // Copy constructor cannot be used.
110
111 // Assignment cannot be used.
113
114 // Ask the data manager if the shape of an existing array can be changed.
115 virtual Bool canChangeShape() const;
116
117 // Initialize the rows from startRownr till endRownr (inclusive)
118 // with the default value defined in the column description (if defined).
119 void initialize (rownr_t startRownr, rownr_t endRownr);
120
121 // Get the global #dimensions of an array (ie. for all rows).
123
124 // Get the global shape of an array (ie. for all rows).
126
127 // Set shape of all arrays in the column.
128 // It can only be used for direct arrays.
130
131 // Get the #dimensions of an array in a particular cell.
132 // If the cell does not contain an array, 0 is returned.
133 uInt ndim (rownr_t rownr) const;
134
135 // Get the shape of an array in a particular cell.
136 // If the cell does not contain an array, an empty IPosition is returned.
137 IPosition shape(rownr_t rownr) const;
138
139 // Get the tile shape of an array in a particular cell.
140 // If the cell does not contain an array, an empty IPosition is returned.
142
143 // Set dimensions of array in a particular cell.
144 // <group>
145 void setShape (rownr_t rownr, const IPosition& shape);
146 // The shape of tiles in the array can also be defined.
147 void setShape (rownr_t rownr, const IPosition& shape,
148 const IPosition& tileShape);
149 // </group>
150
151 // Test if the given cell contains an array.
152 Bool isDefined (rownr_t rownr) const;
153
154 // Get the array from a particular cell.
155 // The length of the array given by ArrayBase must match
156 // the actual length. This is checked by ArrayColumn.
157 void getArray (rownr_t rownr, ArrayBase& arrayPtr) const;
158
159 // Get a slice of an N-dimensional array in a particular cell.
160 // The length of the array given by ArrayBase must match
161 // the actual length. This is checked by ArrayColumn.
162 void getSlice (rownr_t rownr, const Slicer&, ArrayBase& arrayPtr) const;
163
164 // Get the array of all values in a column.
165 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
166 // The arrays in the column have to have the same shape in all cells.
167 // The length of the array given by ArrayBase must match
168 // the actual length. This is checked by ArrayColumn.
169 void getArrayColumn (ArrayBase& arrayPtr) const;
170
171 // Get the array of some values in a column.
172 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
173 // The arrays in the column have to have the same shape in all cells.
174 // The length of the array given by ArrayBase must match
175 // the actual length. This is checked by ArrayColumn.
176 void getArrayColumnCells (const RefRows& rownrs, ArrayBase& arrayPtr) const;
177
178 // Get subsections from all arrays in the column.
179 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
180 // The arrays in the column have to have the same shape in all cells.
181 // The length of the array given by ArrayBase must match
182 // the actual length. This is checked by ArrayColumn.
183 void getColumnSlice (const Slicer&, ArrayBase& arrayPtr) const;
184
185 // Get subsections from some arrays in the column.
186 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
187 // The arrays in the column have to have the same shape in all cells.
188 // The length of the array given by ArrayBase must match
189 // the actual length. This is checked by ArrayColumn.
190 void getColumnSliceCells (const RefRows& rownrs, const Slicer&,
191 ArrayBase& arrayPtr) const;
192
193 // Put the value in a particular cell.
194 // The length of the array given by ArrayBase must match
195 // the actual length. This is checked by ArrayColumn.
196 void putArray (rownr_t rownr, const ArrayBase& arrayPtr);
197
198 // Put a slice of an N-dimensional array in a particular cell.
199 // The length of the array given by ArrayBase must match
200 // the actual length. This is checked by ArrayColumn.
201 void putSlice (rownr_t rownr, const Slicer&, const ArrayBase& arrayPtr);
202
203 // Put the array of all values in the column.
204 // If the column contains n-dim arrays, the source array is (n+1)-dim.
205 // The arrays in the column have to have the same shape in all cells.
206 // The length of the array given by ArrayBase must match
207 // the actual length. This is checked by ArrayColumn.
208 void putArrayColumn (const ArrayBase& arrayPtr);
209
210 // Put the array of some values in the column.
211 // If the column contains n-dim arrays, the source array is (n+1)-dim.
212 // The arrays in the column have to have the same shape in all cells.
213 // The length of the array given by ArrayBase must match
214 // the actual length. This is checked by ArrayColumn.
215 void putArrayColumnCells (const RefRows& rownrs, const ArrayBase& arrayPtr);
216
217 // Put into subsections of all table arrays in the column.
218 // If the column contains n-dim arrays, the source array is (n+1)-dim.
219 // The arrays in the column have to have the same shape in all cells.
220 // The length of the array given by ArrayBase must match
221 // the actual length. This is checked by ArrayColumn.
222 void putColumnSlice (const Slicer&, const ArrayBase& arrayPtr);
223
224 // Put into subsections of some table arrays in the column.
225 // If the column contains n-dim arrays, the source array is (n+1)-dim.
226 // The arrays in the column have to have the same shape in all cells.
227 // The length of the array given by ArrayBase must match
228 // the actual length. This is checked by ArrayColumn.
229 void putColumnSliceCells (const RefRows& rownrs, const Slicer&,
230 const ArrayBase& arrayPtr);
231
232 // Create a data manager column object for this column.
234
235
236private:
237 // Is the shape for all arrays in the columns defined.
239 // Shape for all arrays in the column.
241 // Does the length of a string has to be checked?
243
244
245 // Check if the shape of an array can be set and if it is set
246 // correctly (i.e. if matching possible #dim in column description).
247 void checkShape (const IPosition& shape) const;
248
249 // Write the column data.
250 // The control information is written into the given AipsIO object,
251 // while the data is written/flushed by the data manager.
253
254 // Read the column data back.
255 // The control information is read from the given AipsIO object.
256 // This is used to bind the column to the appropriate data manager.
257 // Thereafter the data manager gets opened.
259};
260
261
262
263
264} //# NAMESPACE CASACORE - END
265
266#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:71
void checkShape(const IPosition &shape) const
Check if the shape of an array can be set and if it is set correctly (i.e.
void getSlice(rownr_t rownr, const Slicer &, ArrayBase &arrayPtr) const
Get a slice of an N-dimensional array in a particular cell.
void getColumnSlice(const Slicer &, ArrayBase &arrayPtr) const
Get subsections from all arrays in the column.
void getColumnSliceCells(const RefRows &rownrs, const Slicer &, ArrayBase &arrayPtr) const
Get subsections from some arrays in the column.
void setShape(rownr_t rownr, const IPosition &shape)
Set dimensions of array in a particular cell.
uInt ndim(rownr_t rownr) const
Get the #dimensions of an array in a particular cell.
void putFileDerived(AipsIO &)
Write the column data.
void putArrayColumnCells(const RefRows &rownrs, const ArrayBase &arrayPtr)
Put the array of some values in the column.
ArrayColumnData & operator=(const ArrayColumnData &)=delete
Assignment cannot be used.
void setShapeColumn(const IPosition &shape)
Set shape of all arrays in the column.
void setShape(rownr_t rownr, const IPosition &shape, const IPosition &tileShape)
The shape of tiles in the array can also be defined.
IPosition shapeCol_p
Shape for all arrays in the column.
Definition ArrColData.h:240
Bool isDefined(rownr_t rownr) const
Test if the given cell contains an array.
void putSlice(rownr_t rownr, const Slicer &, const ArrayBase &arrayPtr)
Put a slice of an N-dimensional array in a particular cell.
void getArrayColumnCells(const RefRows &rownrs, ArrayBase &arrayPtr) const
Get the array of some values in a column.
void getArrayColumn(ArrayBase &arrayPtr) const
Get the array of all values in a column.
IPosition shape(rownr_t rownr) const
Get the shape of an array in a particular cell.
void putArray(rownr_t rownr, const ArrayBase &arrayPtr)
Put the value in a particular cell.
void getArray(rownr_t rownr, ArrayBase &arrayPtr) const
Get the array from a particular cell.
void putColumnSlice(const Slicer &, const ArrayBase &arrayPtr)
Put into subsections of all table arrays in the column.
IPosition tileShape(rownr_t rownr) const
Get the tile shape of an array in a particular cell.
void putColumnSliceCells(const RefRows &rownrs, const Slicer &, const ArrayBase &arrayPtr)
Put into subsections of some table arrays in the column.
void createDataManagerColumn()
Create a data manager column object for this column.
void initialize(rownr_t startRownr, rownr_t endRownr)
Initialize the rows from startRownr till endRownr (inclusive) with the default value defined in the c...
Bool checkValueLength_p
Does the length of a string has to be checked?
Definition ArrColData.h:242
IPosition shapeColumn() const
Get the global shape of an array (ie.
ArrayColumnData(const ArrayColumnDescBase *, ColumnSet *)
Construct an array column object from the given description in the given column set.
Bool shapeColDef_p
Is the shape for all arrays in the columns defined.
Definition ArrColData.h:238
virtual Bool canChangeShape() const
Ask the data manager if the shape of an existing array can be changed.
uInt ndimColumn() const
Get the global #dimensions of an array (ie.
void putArrayColumn(const ArrayBase &arrayPtr)
Put the array of all values in the column.
ArrayColumnData(const ArrayColumnData &)=delete
Copy constructor cannot be used.
void getFileDerived(AipsIO &, const ColumnSet &)
Read the column data back.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44