casacore
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: StArrAipsIO.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
27
28#ifndef TABLES_STARRAIPSIO_H
29#define TABLES_STARRAIPSIO_H
30
31//# Includes
32#include <casacore/casa/aips.h>
33#include <casacore/tables/DataMan/StManAipsIO.h>
34#include <casacore/tables/DataMan/MSMDirColumn.h>
35#include <casacore/casa/Arrays/IPosition.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39//# Forward Declarations
40class AipsIO;
41
42
43// <summary>
44// AipsIO storage manager for direct table arrays
45// </summary>
46
47// <use visibility=local>
48
49// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
50// </reviewed>
51
52// <prerequisite>
53//# Classes you should understand before using this one.
54// <li> StManAipsIO
55// <li> StManColumnAipsIO
56// </prerequisite>
57
58// <etymology>
59// StManColumnArrayAipsIO handles the access to a direct array in a table
60// column using the AipsIO storage manager.
61// </etymology>
62
63// <synopsis>
64// StManColumnArrayAipsIO holds the direct arrays in memory and writes
65// them into the AipsIO file when the table gets closed.
66// It fully supports addition and removal of rows.
67// When a row is added to the table, the direct array gets allocated.
68// This is possible, because the shape of direct arrays is known.
69//
70// The class is derived from StManColumnAipsIO which is used to hold
71// a pointer to the array.
72// </synopsis>
73
74// <motivation>
75// StManColumnArrayAipsIO handles the standard data types. The class
76// is not templated, but a switch statement is used instead.
77// Templates would cause too many instantiations.
78// </motivation>
79
80// <todo asof="$DATE:$">
81//# A List of bugs, limitations, extensions or planned refinements.
82// <li> Maybe TpArrayInt, etc. should be used instead of TpInt.
83// <li> get/putSlice use too many array operations.
84// To solve this requires an array constructor taking a
85// pointer to the data (which is foreseen in the new Array classes).
86// </todo>
87
88
90{
91public:
92
93 // Create a column of the given data type.
95
96 // Frees up the storage.
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
140private:
141 // The (unique) sequence number of the column.
143 // The shape of the array.
145 // The nr of elements in the array.
147
148 // Delete the array at the given index.
149 void deleteArray (rownr_t index);
150
151 // Put the data of a data block.
152 // datap is an array of nrval pointers to arrays.
153 virtual void putData (void* datap, uInt nrval, AipsIO&);
154
155 // Get data arrays into a data block at the given index.
156 // datap is an array of pointers to arrays. nrval arrays will
157 // be allocated and read starting at datap[index].
158 virtual void getData (void* datap, uInt index, uInt nrval,
159 AipsIO&, uInt version);
160
161 // Forbid copy constructor.
163
164 // Forbid assignment.
166};
167
168
169} //# NAMESPACE CASACORE - END
170
171#endif
Non-templated base class for templated Array class.
Definition: ArrayBase.h:73
AipsIO table storage manager class.
Definition: StManAipsIO.h:195
StManColumnArrayAipsIO & operator=(const StManColumnArrayAipsIO &)
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.
StManColumnArrayAipsIO(const StManColumnArrayAipsIO &)
Forbid copy constructor.
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.
uInt seqnr_p
The (unique) sequence number of the column.
Definition: StArrAipsIO.h:142
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.
Definition: StArrAipsIO.h:146
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.
Definition: StArrAipsIO.h:144
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:51
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46