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