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