casacore
Loading...
Searching...
No Matches
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: 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_STARRAIPSIO_H
27#define TABLES_STARRAIPSIO_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/StManAipsIO.h>
32#include <casacore/tables/DataMan/MSMDirColumn.h>
33#include <casacore/casa/Arrays/IPosition.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class AipsIO;
39
40// <summary>
41// AipsIO storage manager for direct table arrays
42// </summary>
43
44// <use visibility=local>
45
46// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
47// </reviewed>
48
49// <prerequisite>
50// # Classes you should understand before using this one.
51// <li> StManAipsIO
52// <li> StManColumnAipsIO
53// </prerequisite>
54
55// <etymology>
56// StManColumnArrayAipsIO handles the access to a direct array in a table
57// column using the AipsIO storage manager.
58// </etymology>
59
60// <synopsis>
61// StManColumnArrayAipsIO holds the direct arrays in memory and writes
62// them into the AipsIO file when the table gets closed.
63// It fully supports addition and removal of rows.
64// When a row is added to the table, the direct array gets allocated.
65// This is possible, because the shape of direct arrays is known.
66//
67// The class is derived from StManColumnAipsIO which is used to hold
68// a pointer to the array.
69// </synopsis>
70
71// <motivation>
72// StManColumnArrayAipsIO handles the standard data types. The class
73// is not templated, but a switch statement is used instead.
74// Templates would cause too many instantiations.
75// </motivation>
76
77// <todo asof="$DATE:$">
78// # A List of bugs, limitations, extensions or planned refinements.
79// <li> Maybe TpArrayInt, etc. should be used instead of TpInt.
80// <li> get/putSlice use too many array operations.
81// To solve this requires an array constructor taking a
82// pointer to the data (which is foreseen in the new Array classes).
83// </todo>
84
86 public:
87 // Create a column of the given data type.
89
90 // Frees up the storage.
92
93 // Forbid copy constructor.
95
96 // Forbid assignment.
98
99 // Set the (fixed) shape of the arrays in the entire column.
100 virtual void setShapeColumn(const IPosition& shape);
101
102 // Add (newNrrow-oldNrrow) rows to the column.
103 // Allocate the data arrays in these rows if the shape is fixed.
104 virtual void addRow(rownr_t newNrrow, rownr_t oldNrrow);
105
106 // Get the dimensionality of the item in the given row.
107 // 0 is returned if there is no array.
108 virtual uInt ndim(rownr_t rownr);
109
110 // Get the shape of the array in the given row.
111 // An zero-length IPosition is returned if there is no array.
112 virtual IPosition shape(rownr_t rownr);
113
114 // Get an array value in the given row.
115 // The buffer pointed to by dataPtr has to have the correct length
116 // (which is guaranteed by the ArrayColumn get function).
117 virtual void getArrayV(rownr_t rownr, ArrayBase& dataPtr);
118
119 // Put an array value into the given row.
120 // The buffer pointed to by dataPtr has to have the correct length
121 // (which is guaranteed by the ArrayColumn put function).
122 virtual void putArrayV(rownr_t rownr, const ArrayBase& dataPtr);
123
124 // Remove the value in the given row.
125 virtual void remove(rownr_t rownr);
126
127 // Let the column create its arrays.
128 virtual void doCreate(rownr_t nrrow);
129
130 // Write the data into AipsIO.
131 // This will call StManColumnAipsIO::putFile which will in its turn
132 // call putData in this class for each of its chunks of data.
133 virtual void putFile(rownr_t nrval, AipsIO&);
134
135 // Read the data from AipsIO.
136 // This will call StManColumnAipsIO::getFile which will in its turn
137 // call getData in this class for each of its chunks of data.
138 virtual void getFile(rownr_t nrval, AipsIO&);
139
140 private:
141 // The shape of the array.
143 // The nr of elements in the array.
145
146 // Delete the array at the given index.
147 void deleteArray(rownr_t index);
148
149 // Put the data of a data block.
150 // datap is an array of nrval pointers to arrays.
151 virtual void putData(void* datap, uInt nrval, AipsIO&);
152
153 // Get data arrays into a data block at the given index.
154 // datap is an array of pointers to arrays. nrval arrays will
155 // be allocated and read starting at datap[index].
156 virtual void getData(void* datap, uInt index, uInt nrval, AipsIO&, uInt version);
157};
158
159} // namespace casacore
160
161#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:69
AipsIO table storage manager class.
StManColumnAipsIO(StManAipsIO *stMan, int dataType, Bool byPtr)
Create a column of the given type.
StManColumnArrayAipsIO & operator=(const StManColumnArrayAipsIO &)=delete
Forbid assignment.
virtual void remove(rownr_t rownr)
Remove the value in the given row.
virtual void setShapeColumn(const IPosition &shape)
Set the (fixed) shape of the arrays in the entire column.
virtual void putArrayV(rownr_t rownr, const ArrayBase &dataPtr)
Put an array value into the given row.
virtual IPosition shape(rownr_t rownr)
Get the shape of the array in the given row.
virtual ~StManColumnArrayAipsIO()
Frees up the storage.
virtual void doCreate(rownr_t nrrow)
Let the column create its arrays.
virtual void addRow(rownr_t newNrrow, rownr_t oldNrrow)
Add (newNrrow-oldNrrow) rows to the column.
uInt nrelem_p
The nr of elements in the array.
virtual void getData(void *datap, uInt index, uInt nrval, AipsIO &, uInt version)
Get data arrays into a data block at the given index.
void deleteArray(rownr_t index)
Delete the array at the given index.
virtual void putData(void *datap, uInt nrval, AipsIO &)
Put the data of a data block.
virtual uInt ndim(rownr_t rownr)
Get the dimensionality of the item in the given row.
IPosition shape_p
The shape of the array.
StManColumnArrayAipsIO(const StManColumnArrayAipsIO &)=delete
Forbid copy constructor.
StManColumnArrayAipsIO(StManAipsIO *, int dataType)
Create a column of the given data type.
virtual void getArrayV(rownr_t rownr, ArrayBase &dataPtr)
Get an array value in the given row.
virtual void getFile(rownr_t nrval, AipsIO &)
Read the data from AipsIO.
virtual void putFile(rownr_t nrval, AipsIO &)
Write the data into AipsIO.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44
DataType dataType(const RecordFieldId &) const