casacore
MSMDirColumn.h
Go to the documentation of this file.
1 //# MSMDirColumn.h: Memory storage manager for fixed shape table arrays
2 //# Copyright (C) 2003
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$
27 
28 #ifndef TABLES_MSMDIRCOLUMN_H
29 #define TABLES_MSMDIRCOLUMN_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/DataMan/MSMColumn.h>
35 #include <casacore/casa/Arrays/IPosition.h>
36 
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 // <summary>
41 // Memory storage manager for 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> MSMBase
52 // <li> MSMColumn
53 // </prerequisite>
54 
55 // <synopsis>
56 // MSMDirColumn handles arrays in a table column.
57 // It only keeps them in memory, so they are not persistent.
58 // </synopsis>
59 
60 //# <todo asof="$DATE:$">
61 //# A List of bugs, limitations, extensions or planned refinements.
62 //# </todo>
63 
64 
65 class MSMDirColumn: public MSMColumn
66 {
67 public:
68  // Create a column of the given type.
69  MSMDirColumn (MSMBase* smptr, int dataType);
70 
71  // Frees up the storage.
72  ~MSMDirColumn();
73 
74  // It can handle access to a slice in a cell.
75  Bool canAccessSlice (Bool& reask) const;
76 
77  // It can handle access to an entire column.
78  Bool canAccessArrayColumn (Bool& reask) const;
79 
80  // Set the (fixed) shape of the arrays in the entire column.
81  void setShapeColumn (const IPosition& shape);
82 
83  // Add (newNrrow-oldNrrow) rows to the column.
84  // Allocate the data arrays in these rows if the shape is fixed.
85  void addRow (uInt newNrrow, uInt oldNrrow);
86 
87  // Get the dimensionality of the item in the given row.
88  // 0 is returned if there is no array.
89  uInt ndim (uInt rownr);
90 
91  // Get the shape of the array in the given row.
92  // An zero-length IPosition is returned if there is no array.
93  IPosition shape (uInt rownr);
94 
95  // Get an array value in the given row.
96  // The buffer pointed to by dataPtr has to have the correct length
97  // (which is guaranteed by the ArrayColumn get function).
98  // <group>
99  void getArrayBoolV (uInt rownr, Array<Bool>* dataPtr);
100  void getArrayuCharV (uInt rownr, Array<uChar>* dataPtr);
101  void getArrayShortV (uInt rownr, Array<Short>* dataPtr);
102  void getArrayuShortV (uInt rownr, Array<uShort>* dataPtr);
103  void getArrayIntV (uInt rownr, Array<Int>* dataPtr);
104  void getArrayuIntV (uInt rownr, Array<uInt>* dataPtr);
105  void getArrayfloatV (uInt rownr, Array<float>* dataPtr);
106  void getArraydoubleV (uInt rownr, Array<double>* dataPtr);
107  void getArrayComplexV (uInt rownr, Array<Complex>* dataPtr);
108  void getArrayDComplexV (uInt rownr, Array<DComplex>* dataPtr);
109  void getArrayStringV (uInt rownr, Array<String>* dataPtr);
110  // </group>
111 
112  // Put an array value into the given row.
113  // The buffer pointed to by dataPtr has to have the correct length
114  // (which is guaranteed by the ArrayColumn put function).
115  // <group>
116  void putArrayBoolV (uInt rownr, const Array<Bool>* dataPtr);
117  void putArrayuCharV (uInt rownr, const Array<uChar>* dataPtr);
118  void putArrayShortV (uInt rownr, const Array<Short>* dataPtr);
119  void putArrayuShortV (uInt rownr, const Array<uShort>* dataPtr);
120  void putArrayIntV (uInt rownr, const Array<Int>* dataPtr);
121  void putArrayuIntV (uInt rownr, const Array<uInt>* dataPtr);
122  void putArrayfloatV (uInt rownr, const Array<float>* dataPtr);
123  void putArraydoubleV (uInt rownr, const Array<double>* dataPtr);
124  void putArrayComplexV (uInt rownr, const Array<Complex>* dataPtr);
125  void putArrayDComplexV (uInt rownr, const Array<DComplex>* dataPtr);
126  void putArrayStringV (uInt rownr, const Array<String>* dataPtr);
127  // </group>
128 
129  // Get a section of the array in the given row.
130  // The buffer pointed to by dataPtr has to have the correct length
131  // (which is guaranteed by the ArrayColumn getSlice function).
132  // <group>
133  void getSliceBoolV (uInt rownr, const Slicer&, Array<Bool>* dataPtr);
134  void getSliceuCharV (uInt rownr, const Slicer&, Array<uChar>* dataPtr);
135  void getSliceShortV (uInt rownr, const Slicer&, Array<Short>* dataPtr);
136  void getSliceuShortV (uInt rownr, const Slicer&, Array<uShort>* dataPtr);
137  void getSliceIntV (uInt rownr, const Slicer&, Array<Int>* dataPtr);
138  void getSliceuIntV (uInt rownr, const Slicer&, Array<uInt>* dataPtr);
139  void getSlicefloatV (uInt rownr, const Slicer&, Array<float>* dataPtr);
140  void getSlicedoubleV (uInt rownr, const Slicer&, Array<double>* dataPtr);
141  void getSliceComplexV (uInt rownr, const Slicer&, Array<Complex>* dataPtr);
142  void getSliceDComplexV (uInt rownr, const Slicer&, Array<DComplex>* dataPtr);
143  void getSliceStringV (uInt rownr, const Slicer&, Array<String>* dataPtr);
144  // </group>
145 
146  // Put into a section of the array in the given row.
147  // The buffer pointed to by dataPtr has to have the correct length
148  // (which is guaranteed by the ArrayColumn putSlice function).
149  // <group>
150  void putSliceBoolV (uInt rownr, const Slicer&,
151  const Array<Bool>* dataPtr);
152  void putSliceuCharV (uInt rownr, const Slicer&,
153  const Array<uChar>* dataPtr);
154  void putSliceShortV (uInt rownr, const Slicer&,
155  const Array<Short>* dataPtr);
156  void putSliceuShortV (uInt rownr, const Slicer&,
157  const Array<uShort>* dataPtr);
158  void putSliceIntV (uInt rownr, const Slicer&,
159  const Array<Int>* dataPtr);
160  void putSliceuIntV (uInt rownr, const Slicer&,
161  const Array<uInt>* dataPtr);
162  void putSlicefloatV (uInt rownr, const Slicer&,
163  const Array<float>* dataPtr);
164  void putSlicedoubleV (uInt rownr, const Slicer&,
165  const Array<double>* dataPtr);
166  void putSliceComplexV (uInt rownr, const Slicer&,
167  const Array<Complex>* dataPtr);
168  void putSliceDComplexV (uInt rownr, const Slicer&,
169  const Array<DComplex>* dataPtr);
170  void putSliceStringV (uInt rownr, const Slicer&,
171  const Array<String>* dataPtr);
172  // </group>
173 
174  // Get all array values in the column.
175  // The buffer pointed to by dataPtr has to have the correct length
176  // (which is guaranteed by the ArrayColumn getColumn function).
177  // <group>
178  void getArrayColumnBoolV (Array<Bool>* dataPtr);
179  void getArrayColumnuCharV (Array<uChar>* dataPtr);
180  void getArrayColumnShortV (Array<Short>* dataPtr);
181  void getArrayColumnuShortV (Array<uShort>* dataPtr);
182  void getArrayColumnIntV (Array<Int>* dataPtr);
183  void getArrayColumnuIntV (Array<uInt>* dataPtr);
184  void getArrayColumnfloatV (Array<float>* dataPtr);
185  void getArrayColumndoubleV (Array<double>* dataPtr);
186  void getArrayColumnComplexV (Array<Complex>* dataPtr);
188  void getArrayColumnStringV (Array<String>* dataPtr);
189  // </group>
190 
191  // Put all arrays in the column.
192  // The buffer pointed to by dataPtr has to have the correct length
193  // (which is guaranteed by the ArrayColumn putColumn function).
194  // <group>
195  void putArrayColumnBoolV (const Array<Bool>* dataPtr);
196  void putArrayColumnuCharV (const Array<uChar>* dataPtr);
197  void putArrayColumnShortV (const Array<Short>* dataPtr);
198  void putArrayColumnuShortV (const Array<uShort>* dataPtr);
199  void putArrayColumnIntV (const Array<Int>* dataPtr);
200  void putArrayColumnuIntV (const Array<uInt>* dataPtr);
201  void putArrayColumnfloatV (const Array<float>* dataPtr);
202  void putArrayColumndoubleV (const Array<double>* dataPtr);
203  void putArrayColumnComplexV (const Array<Complex>* dataPtr);
204  void putArrayColumnDComplexV (const Array<DComplex>* dataPtr);
205  void putArrayColumnStringV (const Array<String>* dataPtr);
206  // </group>
207 
208  // Remove the value in the given row.
209  void remove (uInt rownr);
210 
211  // Let the column create its arrays.
212  void doCreate (uInt nrrow);
213 
214  // Check if the class invariants still hold.
215  Bool ok() const;
216 
217 private:
218  // The (unique) sequence number of the column.
220  // The shape of the array.
222  // The nr of elements in the array.
224 
225 
226  // Delete the array in the given row.
227  void deleteArray (uInt rownr);
228 
229  // Forbid copy constructor.
230  MSMDirColumn (const MSMDirColumn&);
231 
232  // Forbid assignment.
234 };
235 
236 
237 
238 
239 } //# NAMESPACE CASACORE - END
240 
241 #endif
void putSliceShortV(uInt rownr, const Slicer &, const Array< Short > *dataPtr)
void putSlicefloatV(uInt rownr, const Slicer &, const Array< float > *dataPtr)
A Vector of integers, for indexing into Array<T> objects.
Definition: IPosition.h:119
uInt seqnr_p
The (unique) sequence number of the column.
Definition: MSMDirColumn.h:219
void putArrayColumnShortV(const Array< Short > *dataPtr)
void putSliceuCharV(uInt rownr, const Slicer &, const Array< uChar > *dataPtr)
void putArrayfloatV(uInt rownr, const Array< float > *dataPtr)
void putArrayColumnfloatV(const Array< float > *dataPtr)
void putArrayColumndoubleV(const Array< double > *dataPtr)
void putArrayColumnComplexV(const Array< Complex > *dataPtr)
Bool canAccessArrayColumn(Bool &reask) const
It can handle access to an entire column.
void putArraydoubleV(uInt rownr, const Array< double > *dataPtr)
Memory storage manager for table arrays.
Definition: MSMDirColumn.h:65
Bool canAccessSlice(Bool &reask) const
It can handle access to a slice in a cell.
void getArrayStringV(uInt rownr, Array< String > *dataPtr)
void getArrayColumnfloatV(Array< float > *dataPtr)
void putSliceDComplexV(uInt rownr, const Slicer &, const Array< DComplex > *dataPtr)
void getArrayShortV(uInt rownr, Array< Short > *dataPtr)
void getSliceShortV(uInt rownr, const Slicer &, Array< Short > *dataPtr)
void getSliceuShortV(uInt rownr, const Slicer &, Array< uShort > *dataPtr)
void getArrayComplexV(uInt rownr, Array< Complex > *dataPtr)
void getArrayColumnuIntV(Array< uInt > *dataPtr)
Base class for memory-based table storage manager class.
Definition: MSMBase.h:66
MSMDirColumn & operator=(const MSMDirColumn &)
Forbid assignment.
void putSliceStringV(uInt rownr, const Slicer &, const Array< String > *dataPtr)
void putArrayColumnuCharV(const Array< uChar > *dataPtr)
Bool ok() const
Check if the class invariants still hold.
MSMDirColumn(MSMBase *smptr, int dataType)
Create a column of the given type.
void putArrayColumnBoolV(const Array< Bool > *dataPtr)
Put all arrays in the column.
void putSliceIntV(uInt rownr, const Slicer &, const Array< Int > *dataPtr)
void putArrayColumnIntV(const Array< Int > *dataPtr)
int dataType() const
Return the data type of the column.
void putArrayDComplexV(uInt rownr, const Array< DComplex > *dataPtr)
void putArrayStringV(uInt rownr, const Array< String > *dataPtr)
void getArrayColumnBoolV(Array< Bool > *dataPtr)
Get all array values in the column.
void getArrayfloatV(uInt rownr, Array< float > *dataPtr)
void getSliceIntV(uInt rownr, const Slicer &, Array< Int > *dataPtr)
void getSlicefloatV(uInt rownr, const Slicer &, Array< float > *dataPtr)
IPosition shape(uInt rownr)
Get the shape of the array in the given row.
void putArrayColumnuShortV(const Array< uShort > *dataPtr)
void putArrayuCharV(uInt rownr, const Array< uChar > *dataPtr)
void deleteArray(uInt rownr)
Delete the array in the given row.
void putSliceuShortV(uInt rownr, const Slicer &, const Array< uShort > *dataPtr)
void getArrayColumnuCharV(Array< uChar > *dataPtr)
void putArrayuShortV(uInt rownr, const Array< uShort > *dataPtr)
void putSliceuIntV(uInt rownr, const Slicer &, const Array< uInt > *dataPtr)
void getArrayBoolV(uInt rownr, Array< Bool > *dataPtr)
Get an array value in the given row.
void addRow(uInt newNrrow, uInt oldNrrow)
Add (newNrrow-oldNrrow) rows to the column.
~MSMDirColumn()
Frees up the storage.
void getArrayDComplexV(uInt rownr, Array< DComplex > *dataPtr)
void getArrayColumnStringV(Array< String > *dataPtr)
void getArrayIntV(uInt rownr, Array< Int > *dataPtr)
void getArrayColumnuShortV(Array< uShort > *dataPtr)
void getSliceuCharV(uInt rownr, const Slicer &, Array< uChar > *dataPtr)
void putArrayColumnStringV(const Array< String > *dataPtr)
void putSliceBoolV(uInt rownr, const Slicer &, const Array< Bool > *dataPtr)
Put into a section of the array in the given row.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
void getSliceComplexV(uInt rownr, const Slicer &, Array< Complex > *dataPtr)
void putSlicedoubleV(uInt rownr, const Slicer &, const Array< double > *dataPtr)
void putArrayColumnDComplexV(const Array< DComplex > *dataPtr)
void getArrayColumndoubleV(Array< double > *dataPtr)
void doCreate(uInt nrrow)
Let the column create its arrays.
void putSliceComplexV(uInt rownr, const Slicer &, const Array< Complex > *dataPtr)
void putArrayuIntV(uInt rownr, const Array< uInt > *dataPtr)
void getArrayColumnIntV(Array< Int > *dataPtr)
Column in the Memory table storage manager class.
Definition: MSMColumn.h:104
void getArrayuShortV(uInt rownr, Array< uShort > *dataPtr)
void setShapeColumn(const IPosition &shape)
Set the (fixed) shape of the arrays in the entire column.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:275
void getArraydoubleV(uInt rownr, Array< double > *dataPtr)
void getSliceStringV(uInt rownr, const Slicer &, Array< String > *dataPtr)
uInt nrelem_p
The nr of elements in the array.
Definition: MSMDirColumn.h:223
void getArrayColumnShortV(Array< Short > *dataPtr)
void getSliceDComplexV(uInt rownr, const Slicer &, Array< DComplex > *dataPtr)
void putArrayIntV(uInt rownr, const Array< Int > *dataPtr)
IPosition shape_p
The shape of the array.
Definition: MSMDirColumn.h:221
void putArrayComplexV(uInt rownr, const Array< Complex > *dataPtr)
void getArrayColumnComplexV(Array< Complex > *dataPtr)
void putArrayColumnuIntV(const Array< uInt > *dataPtr)
void getSlicedoubleV(uInt rownr, const Slicer &, Array< double > *dataPtr)
void putArrayShortV(uInt rownr, const Array< Short > *dataPtr)
uInt ndim(uInt rownr)
Get the dimensionality of the item in the given row.
void getSliceBoolV(uInt rownr, const Slicer &, Array< Bool > *dataPtr)
Get a section of the array in the given row.
void putArrayBoolV(uInt rownr, const Array< Bool > *dataPtr)
Put an array value into the given row.
void getArrayuIntV(uInt rownr, Array< uInt > *dataPtr)
void getArrayColumnDComplexV(Array< DComplex > *dataPtr)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:48
void getArrayuCharV(uInt rownr, Array< uChar > *dataPtr)
void getSliceuIntV(uInt rownr, const Slicer &, Array< uInt > *dataPtr)