casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SSMIndColumn.h
Go to the documentation of this file.
1 //# SSMIndColumn.h: A column in Standard storage manager for indirect arrays
2 //# Copyright (C) 2000
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_SSMINDCOLUMN_H
29 #define TABLES_SSMINDCOLUMN_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class StManArrayFile;
42 class AipsIO;
43 
44 
45 // <summary>
46 // A column of Standard storage manager for indirect arrays.
47 // </summary>
48 
49 // <use visibility=local>
50 
51 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tStandardStMan.cc">
52 // </reviewed>
53 
54 // <prerequisite>
55 //# Classes you should understand before using this one.
56 // <li> <linkto class=SSMColumn>SSMColumn</linkto>
57 // <li> <linkto class=StIndArray>StIndArray</linkto>
58 // </prerequisite>
59 
60 // <etymology>
61 // SSMIndColumn represents a Column in the Standard Storage Manager
62 // containing Indirect arrays.
63 // </etymology>
64 
65 // <synopsis>
66 // SSMIndColumn is the implementation of an
67 // <linkto class=SSMColumn>SSMColumn</linkto> class
68 // to handle indirect arrays. The arrays (shape and data) are stored in
69 // a separate file using class <linkto class=StIndArray>StIndArray</linkto>.
70 // The file offset of the beginning of the array in stored in the
71 // appropriate data bucket using the standard SSMColumn functions.
72 // <p>
73 // Note that an indirect array can have a fixed shape. In that case
74 // adding a row results in reserving space for the array in the StIndArray
75 // file, so for each row an array is present.
76 // On the other hand adding a row does nothing for variable shaped arrays.
77 // So when no data is put or shape is set, a row may contain no array at all.
78 // In that case the function <src>isShapeDefined</src> returns False for
79 // that row.
80 // <p>
81 // Indirect arrays containing strings are not handled by this class, but
82 // by <linkto class=SSMIndStringColumn>SSMIndStringColumn</linkto>.
83 // That class stores those string arrays in the special string buckets
84 // instead of using StIndArray. The reason is that the string buckets
85 // are more disk space efficient when string arrays are frequently updated.
86 // </synopsis>
87 
88 //# <todo asof="$DATE:$">
89 //# A List of bugs, limitations, extensions or planned refinements.
90 //# </todo>
91 
92 
93 class SSMIndColumn : public SSMColumn
94 {
95 public:
96  // Create a column of the given data type.
97  // It keeps the pointer to its parent (but does not own it).
98  SSMIndColumn (SSMBase* aParent, int aDataType, uInt aColNr);
99 
100  // Frees up the storage.
101  ~SSMIndColumn();
102 
103  // An array of 'fixed length' strings is not handled specially,
104  // thus this function is ignored.
105  // It is needed to override the bahviour of the base class.
106  virtual void setMaxLength (uInt maxLength);
107 
108  // It can handle access to a slice in a cell.
109  virtual Bool canAccessSlice (Bool& reask) const;
110 
111  // Add (newNrrow-oldNrrow) rows to the column.
112  virtual void addRow (uInt aNewNrRows, uInt anOldNrRows, Bool doInit);
113 
114  // Set the (fixed) shape of the arrays in the entire column.
115  virtual void setShapeColumn (const IPosition& aShape);
116 
117  // Get the dimensionality of the item in the given row.
118  virtual uInt ndim (uInt aRowNr);
119 
120  // Set the shape of the array in the given row and allocate the array
121  // in the file.
122  void setShape (uInt aRowNr, const IPosition& aShape);
123 
124  // Is the shape defined (i.e. is there an array) in this row?
125  virtual Bool isShapeDefined (uInt aRowNr);
126 
127  // Get the shape of the array in the given row.
128  virtual IPosition shape (uInt aRowNr);
129 
130  // This storage manager can handle changing array shapes.
131  Bool canChangeShape() const;
132 
133  // Get an array value in the given row.
134  // The buffer pointed to by dataPtr has to have the correct length
135  // (which is guaranteed by the ArrayColumn get function).
136  // <group>
137  virtual void getArrayBoolV (uInt aRowNr, Array<Bool>* aDataPtr);
138  virtual void getArrayuCharV (uInt aRowNr, Array<uChar>* aDataPtr);
139  virtual void getArrayShortV (uInt aRowNr, Array<Short>* aDataPtr);
140  virtual void getArrayuShortV (uInt aRowNr, Array<uShort>* aDataPtr);
141  virtual void getArrayIntV (uInt aRowNr, Array<Int>* aDataPtr);
142  virtual void getArrayuIntV (uInt aRowNr, Array<uInt>* aDataPtr);
143  virtual void getArrayInt64V (uInt aRowNr, Array<Int64>* aDataPtr);
144  virtual void getArrayfloatV (uInt aRowNr, Array<float>* aDataPtr);
145  virtual void getArraydoubleV (uInt aRowNr, Array<double>* aDataPtr);
146  virtual void getArrayComplexV (uInt aRowNr, Array<Complex>* aDataPtr);
147  virtual void getArrayDComplexV (uInt aRowNr, Array<DComplex>* aDataPtr);
148  virtual void getArrayStringV (uInt aRowNr, Array<String>* aDataPtr);
149  // </group>
150 
151  // Put an array value into the given row.
152  // The buffer pointed to by dataPtr has to have the correct length
153  // (which is guaranteed by the ArrayColumn put function).
154  // <group>
155  virtual void putArrayBoolV (uInt aRowNr,
156  const Array<Bool>* aDataPtr);
157  virtual void putArrayuCharV (uInt aRowNr,
158  const Array<uChar>* aDataPtr);
159  virtual void putArrayShortV (uInt aRowNr,
160  const Array<Short>* aDataPtr);
161  virtual void putArrayuShortV (uInt aRowNr,
162  const Array<uShort>* aDataPtr);
163  virtual void putArrayIntV (uInt aRowNr,
164  const Array<Int>* aDataPtr);
165  virtual void putArrayuIntV (uInt aRowNr,
166  const Array<uInt>* aDataPtr);
167  virtual void putArrayInt64V (uInt aRowNr,
168  const Array<Int64>* aDataPtr);
169  virtual void putArrayfloatV (uInt aRowNr,
170  const Array<float>* aDataPtr);
171  virtual void putArraydoubleV (uInt aRowNr,
172  const Array<double>* aDataPtr);
173  virtual void putArrayComplexV (uInt aRowNr,
174  const Array<Complex>* aDataPtr);
175  virtual void putArrayDComplexV (uInt aRowNr,
176  const Array<DComplex>* aDataPtr);
177  virtual void putArrayStringV (uInt aRowNr,
178  const Array<String>* aDataPtr);
179  // </group>
180 
181  // Get a section of the array in the given row.
182  // The buffer pointed to by dataPtr has to have the correct length
183  // (which is guaranteed by the ArrayColumn getSlice function).
184  // <group>
185  virtual void getSliceBoolV (uInt aRowNr, const Slicer&,
186  Array<Bool>* aDataPtr);
187  virtual void getSliceuCharV (uInt aRowNr, const Slicer&,
188  Array<uChar>* aDataPtr);
189  virtual void getSliceShortV (uInt aRowNr, const Slicer&,
190  Array<Short>* aDataPtr);
191  virtual void getSliceuShortV (uInt aRowNr, const Slicer&,
192  Array<uShort>* aDataPtr);
193  virtual void getSliceIntV (uInt aRowNr, const Slicer&,
194  Array<Int>* aDataPtr);
195  virtual void getSliceuIntV (uInt aRowNr, const Slicer&,
196  Array<uInt>* aDataPtr);
197  virtual void getSliceInt64V (uInt aRowNr, const Slicer&,
198  Array<Int64>* aDataPtr);
199  virtual void getSlicefloatV (uInt aRowNr, const Slicer&,
200  Array<float>* aDataPtr);
201  virtual void getSlicedoubleV (uInt aRowNr, const Slicer&,
202  Array<double>* aDataPtr);
203  virtual void getSliceComplexV (uInt aRowNr, const Slicer&,
204  Array<Complex>* aDataPtr);
205  virtual void getSliceDComplexV (uInt aRowNr, const Slicer&,
206  Array<DComplex>* aDataPtr);
207  virtual void getSliceStringV (uInt aRowNr, const Slicer&,
208  Array<String>* aDataPtr);
209  // </group>
210 
211  // Put into a section of the array in the given row.
212  // The buffer pointed to by aDataPtr has to have the correct length
213  // (which is guaranteed by the ArrayColumn putSlice function).
214  // <group>
215  virtual void putSliceBoolV (uInt aRowNr, const Slicer&,
216  const Array<Bool>* aDataPtr);
217  virtual void putSliceuCharV (uInt aRowNr, const Slicer&,
218  const Array<uChar>* aDataPtr);
219  virtual void putSliceShortV (uInt aRowNr, const Slicer&,
220  const Array<Short>* aDataPtr);
221  virtual void putSliceuShortV (uInt aRowNr, const Slicer&,
222  const Array<uShort>* aDataPtr);
223  virtual void putSliceIntV (uInt aRowNr, const Slicer&,
224  const Array<Int>* aDataPtr);
225  virtual void putSliceuIntV (uInt aRowNr, const Slicer&,
226  const Array<uInt>* aDataPtr);
227  virtual void putSliceInt64V (uInt aRowNr, const Slicer&,
228  const Array<Int64>* aDataPtr);
229  virtual void putSlicefloatV (uInt aRowNr, const Slicer&,
230  const Array<float>* aDataPtr);
231  virtual void putSlicedoubleV (uInt aRowNr, const Slicer&,
232  const Array<double>* aDataPtr);
233  virtual void putSliceComplexV (uInt aRowNr, const Slicer&,
234  const Array<Complex>* aDataPtr);
235  virtual void putSliceDComplexV (uInt aRowNr, const Slicer&,
236  const Array<DComplex>* aDataPtr);
237  virtual void putSliceStringV (uInt aRowNr, const Slicer&,
238  const Array<String>* aDataPtr);
239  // </group>
240 
241  // Let the column object create its array file.
242  virtual void doCreate (uInt aNrRows);
243 
244  // Open an existing file.
245  virtual void getFile (uInt aNrRows);
246 
247  // Remove the given row from the data bucket and possibly string bucket.
248  virtual void deleteRow(uInt aRowNr);
249 
250 
251 private:
252  // Forbid copy constructor.
253  SSMIndColumn (const SSMIndColumn&);
254 
255  // Forbid assignment.
257 
258  // Initialize part of the object and open/create the file.
259  // It is used by doCreate and getFile.
260  void init();
261 
262  // Read the shape at the given row.
263  // This will cache the information in the StIndArray
264  // object for that row.
265  StIndArray* getShape (uInt aRowNr);
266 
267  // Return a pointer to the array in the given row (for a get).
268  StIndArray* getArrayPtr (uInt aRowNr);
269 
270 
271  //# The shape off all arrays in case it is fixed
273  //# Switch indicating if the shape is fixed.
275  //# The file containing the arrays.
277  //# The indirect array object.
279 };
280 
281 
282 
283 } //# NAMESPACE CASACORE - END
284 
285 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual void putSlicedoubleV(uInt aRowNr, const Slicer &, const Array< double > *aDataPtr)
virtual void getArrayBoolV(uInt aRowNr, Array< Bool > *aDataPtr)
Get an array value in the given row.
virtual void getSliceuCharV(uInt aRowNr, const Slicer &, Array< uChar > *aDataPtr)
virtual void putSliceIntV(uInt aRowNr, const Slicer &, const Array< Int > *aDataPtr)
virtual void putArrayuShortV(uInt aRowNr, const Array< uShort > *aDataPtr)
virtual void doCreate(uInt aNrRows)
Let the column object create its array file.
virtual void getSliceComplexV(uInt aRowNr, const Slicer &, Array< Complex > *aDataPtr)
virtual void getFile(uInt aNrRows)
Open an existing file.
virtual void putSliceDComplexV(uInt aRowNr, const Slicer &, const Array< DComplex > *aDataPtr)
virtual void putSliceuCharV(uInt aRowNr, const Slicer &, const Array< uChar > *aDataPtr)
virtual void putSliceuShortV(uInt aRowNr, const Slicer &, const Array< uShort > *aDataPtr)
StIndArray * getArrayPtr(uInt aRowNr)
Return a pointer to the array in the given row (for a get).
SSMIndColumn(SSMBase *aParent, int aDataType, uInt aColNr)
Create a column of the given data type.
virtual void getSliceShortV(uInt aRowNr, const Slicer &, Array< Short > *aDataPtr)
StManArrayFile * itsIosFile
Definition: SSMIndColumn.h:276
virtual void getArrayStringV(uInt aRowNr, Array< String > *aDataPtr)
Read/write indirect arrays.
Definition: StIndArray.h:141
virtual void getSliceStringV(uInt aRowNr, const Slicer &, Array< String > *aDataPtr)
virtual void putArrayuIntV(uInt aRowNr, const Array< uInt > *aDataPtr)
virtual void putArrayBoolV(uInt aRowNr, const Array< Bool > *aDataPtr)
Put an array value into the given row.
A column of Standard storage manager for indirect arrays.
Definition: SSMIndColumn.h:93
virtual IPosition shape(uInt aRowNr)
Get the shape of the array in the given row.
Bool canChangeShape() const
This storage manager can handle changing array shapes.
virtual void putSliceComplexV(uInt aRowNr, const Slicer &, const Array< Complex > *aDataPtr)
Base class of the Standard Storage Manager.
Definition: SSMBase.h:158
virtual Bool isShapeDefined(uInt aRowNr)
Is the shape defined (i.e.
virtual void getArraydoubleV(uInt aRowNr, Array< double > *aDataPtr)
virtual void getSliceInt64V(uInt aRowNr, const Slicer &, Array< Int64 > *aDataPtr)
virtual void setShapeColumn(const IPosition &aShape)
Set the (fixed) shape of the arrays in the entire column.
virtual void getArrayInt64V(uInt aRowNr, Array< Int64 > *aDataPtr)
virtual uInt ndim(uInt aRowNr)
Get the dimensionality of the item in the given row.
virtual void getArrayuIntV(uInt aRowNr, Array< uInt > *aDataPtr)
virtual void putArrayShortV(uInt aRowNr, const Array< Short > *aDataPtr)
virtual void putArrayfloatV(uInt aRowNr, const Array< float > *aDataPtr)
void setShape(uInt aRowNr, const IPosition &aShape)
Set the shape of the array in the given row and allocate the array in the file.
virtual void putSliceuIntV(uInt aRowNr, const Slicer &, const Array< uInt > *aDataPtr)
SSMIndColumn & operator=(const SSMIndColumn &)
Forbid assignment.
virtual void getSliceDComplexV(uInt aRowNr, const Slicer &, Array< DComplex > *aDataPtr)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void addRow(uInt aNewNrRows, uInt anOldNrRows, Bool doInit)
Add (newNrrow-oldNrrow) rows to the column.
A Column in the Standard Storage Manager.
Definition: SSMColumn.h:99
virtual void putArrayIntV(uInt aRowNr, const Array< Int > *aDataPtr)
virtual void putArrayComplexV(uInt aRowNr, const Array< Complex > *aDataPtr)
virtual void getSlicedoubleV(uInt aRowNr, const Slicer &, Array< double > *aDataPtr)
virtual void getArrayShortV(uInt aRowNr, Array< Short > *aDataPtr)
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
virtual void putArrayInt64V(uInt aRowNr, const Array< Int64 > *aDataPtr)
virtual void putArrayStringV(uInt aRowNr, const Array< String > *aDataPtr)
virtual void getArrayuCharV(uInt aRowNr, Array< uChar > *aDataPtr)
StIndArray * getShape(uInt aRowNr)
Read the shape at the given row.
virtual void getArrayIntV(uInt aRowNr, Array< Int > *aDataPtr)
virtual void putSliceInt64V(uInt aRowNr, const Slicer &, const Array< Int64 > *aDataPtr)
virtual void getArrayComplexV(uInt aRowNr, Array< Complex > *aDataPtr)
virtual void deleteRow(uInt aRowNr)
Remove the given row from the data bucket and possibly string bucket.
virtual void putSliceShortV(uInt aRowNr, const Slicer &, const Array< Short > *aDataPtr)
virtual Bool canAccessSlice(Bool &reask) const
It can handle access to a slice in a cell.
virtual void getSliceBoolV(uInt aRowNr, const Slicer &, Array< Bool > *aDataPtr)
Get a section of the array in the given row.
virtual void setMaxLength(uInt maxLength)
An array of &#39;fixed length&#39; strings is not handled specially, thus this function is ignored...
virtual void putSliceStringV(uInt aRowNr, const Slicer &, const Array< String > *aDataPtr)
virtual void getSliceuShortV(uInt aRowNr, const Slicer &, Array< uShort > *aDataPtr)
Read/write array in external format for a storage manager.
Definition: StArrayFile.h:129
virtual void putArraydoubleV(uInt aRowNr, const Array< double > *aDataPtr)
virtual void getArrayDComplexV(uInt aRowNr, Array< DComplex > *aDataPtr)
virtual void putSlicefloatV(uInt aRowNr, const Slicer &, const Array< float > *aDataPtr)
virtual void getSliceIntV(uInt aRowNr, const Slicer &, Array< Int > *aDataPtr)
virtual void getArrayuShortV(uInt aRowNr, Array< uShort > *aDataPtr)
virtual void putSliceBoolV(uInt aRowNr, const Slicer &, const Array< Bool > *aDataPtr)
Put into a section of the array in the given row.
unsigned int uInt
Definition: aipstype.h:51
virtual void getSliceuIntV(uInt aRowNr, const Slicer &, Array< uInt > *aDataPtr)
virtual void getArrayfloatV(uInt aRowNr, Array< float > *aDataPtr)
virtual void putArrayuCharV(uInt aRowNr, const Array< uChar > *aDataPtr)
void init()
Initialize part of the object and open/create the file.
~SSMIndColumn()
Frees up the storage.
virtual void putArrayDComplexV(uInt aRowNr, const Array< DComplex > *aDataPtr)
virtual void getSlicefloatV(uInt aRowNr, const Slicer &, Array< float > *aDataPtr)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42