casacore
Loading...
Searching...
No Matches
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: 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_SSMINDCOLUMN_H
27#define TABLES_SSMINDCOLUMN_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/SSMColumn.h>
32#include <casacore/tables/DataMan/StIndArray.h>
33#include <casacore/casa/Arrays/IPosition.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class StManArrayFile;
39class AipsIO;
40
41// <summary>
42// A column of Standard storage manager for indirect arrays.
43// </summary>
44
45// <use visibility=local>
46
47// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tStandardStMan.cc">
48// </reviewed>
49
50// <prerequisite>
51// # Classes you should understand before using this one.
52// <li> <linkto class=SSMColumn>SSMColumn</linkto>
53// <li> <linkto class=StIndArray>StIndArray</linkto>
54// </prerequisite>
55
56// <etymology>
57// SSMIndColumn represents a Column in the Standard Storage Manager
58// containing Indirect arrays.
59// </etymology>
60
61// <synopsis>
62// SSMIndColumn is the implementation of an
63// <linkto class=SSMColumn>SSMColumn</linkto> class
64// to handle indirect arrays. The arrays (shape and data) are stored in
65// a separate file using class <linkto class=StIndArray>StIndArray</linkto>.
66// The file offset of the beginning of the array in stored in the
67// appropriate data bucket using the standard SSMColumn functions.
68// <p>
69// Note that an indirect array can have a fixed shape. In that case
70// adding a row results in reserving space for the array in the StIndArray
71// file, so for each row an array is present.
72// On the other hand adding a row does nothing for variable shaped arrays.
73// So when no data is put or shape is set, a row may contain no array at all.
74// In that case the function <src>isShapeDefined</src> returns False for
75// that row.
76// <p>
77// Indirect arrays containing strings are not handled by this class, but
78// by <linkto class=SSMIndStringColumn>SSMIndStringColumn</linkto>.
79// That class stores those string arrays in the special string buckets
80// instead of using StIndArray. The reason is that the string buckets
81// are more disk space efficient when string arrays are frequently updated.
82// </synopsis>
83
84// # <todo asof="$DATE:$">
85// # A List of bugs, limitations, extensions or planned refinements.
86// # </todo>
87
88class SSMIndColumn : public SSMColumn {
89 public:
90 // Create a column of the given data type.
91 // It keeps the pointer to its parent (but does not own it).
92 SSMIndColumn(SSMBase* aParent, int aDataType, uInt aColNr);
93
94 // Frees up the storage.
96
97 // Forbid copy constructor.
98 SSMIndColumn(const SSMIndColumn&) = delete;
99
100 // Forbid assignment.
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 // Add (newNrrow-oldNrrow) rows to the column.
109 virtual void addRow(rownr_t aNewNrRows, rownr_t anOldNrRows, Bool doInit);
110
111 // Set the (fixed) shape of the arrays in the entire column.
112 virtual void setShapeColumn(const IPosition& aShape);
113
114 // Get the dimensionality of the item in the given row.
115 virtual uInt ndim(rownr_t aRowNr);
116
117 // Set the shape of the array in the given row and allocate the array
118 // in the file.
119 void setShape(rownr_t aRowNr, const IPosition& aShape);
120
121 // Is the shape defined (i.e. is there an array) in this row?
122 virtual Bool isShapeDefined(rownr_t aRowNr);
123
124 // Get the shape of the array in the given row.
125 virtual IPosition shape(rownr_t aRowNr);
126
127 // This storage manager can handle changing array shapes.
129
130 // Get an array value in the given row.
131 // The buffer pointed to by dataPtr has to have the correct length
132 // (which is guaranteed by the ArrayColumn get function).
133 virtual void getArrayV(rownr_t aRowNr, ArrayBase& aDataPtr);
134
135 // Put an array value into the given row.
136 // The buffer pointed to by dataPtr has to have the correct length
137 // (which is guaranteed by the ArrayColumn put function).
138 virtual void putArrayV(rownr_t aRowNr, const ArrayBase& aDataPtr);
139
140 // Get a section of the array in the given row.
141 // The buffer pointed to by dataPtr has to have the correct length
142 // (which is guaranteed by the ArrayColumn getSlice function).
143 virtual void getSliceV(rownr_t aRowNr, const Slicer&, ArrayBase& aDataPtr);
144
145 // Put into a section of the array in the given row.
146 // The buffer pointed to by aDataPtr has to have the correct length
147 // (which is guaranteed by the ArrayColumn putSlice function).
148 virtual void putSliceV(rownr_t aRowNr, const Slicer&, const ArrayBase& aDataPtr);
149
150 // Let the column object create its array file.
151 virtual void doCreate(rownr_t aNrRows);
152
153 // Open an existing file.
154 virtual void getFile(rownr_t aNrRows);
155
156 // Remove the given row from the data bucket and possibly string bucket.
157 virtual void deleteRow(rownr_t aRowNr);
158
159 private:
160 // Initialize part of the object and open/create the file.
161 // It is used by doCreate and getFile.
162 void init();
163
164 // Read the shape at the given row.
165 // This will cache the information in the StIndArray
166 // object for that row.
168
169 // Return a pointer to the array in the given row (for a get).
171
172 // # The shape off all arrays in case it is fixed
174 // # Switch indicating if the shape is fixed.
176 // # The file containing the arrays.
178 // # The indirect array object.
180};
181
182} // namespace casacore
183
184#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:69
SSMColumn(SSMBase *aParent, int aDataType, uInt aColNr)
Create a SSMColumn object with the given parent.
virtual void putSliceV(rownr_t aRowNr, const Slicer &, const ArrayBase &aDataPtr)
Put into a section of the array in the given row.
void init()
Initialize part of the object and open/create the file.
virtual void deleteRow(rownr_t aRowNr)
Remove the given row from the data bucket and possibly string bucket.
virtual uInt ndim(rownr_t aRowNr)
Get the dimensionality of the item in the given row.
virtual void putArrayV(rownr_t aRowNr, const ArrayBase &aDataPtr)
Put an array value into the given row.
virtual void getArrayV(rownr_t aRowNr, ArrayBase &aDataPtr)
Get an array value in the given row.
virtual void doCreate(rownr_t aNrRows)
Let the column object create its array file.
~SSMIndColumn()
Frees up the storage.
virtual void getFile(rownr_t aNrRows)
Open an existing file.
virtual void addRow(rownr_t aNewNrRows, rownr_t anOldNrRows, Bool doInit)
Add (newNrrow-oldNrrow) rows to the column.
StIndArray * getShape(rownr_t aRowNr)
Read the shape at the given row.
virtual void getSliceV(rownr_t aRowNr, const Slicer &, ArrayBase &aDataPtr)
Get a section of the array in the given row.
virtual IPosition shape(rownr_t aRowNr)
Get the shape of the array in the given row.
SSMIndColumn(SSMBase *aParent, int aDataType, uInt aColNr)
Create a column of the given data type.
SSMIndColumn(const SSMIndColumn &)=delete
Forbid copy constructor.
SSMIndColumn & operator=(const SSMIndColumn &)=delete
Forbid assignment.
virtual Bool isShapeDefined(rownr_t aRowNr)
Is the shape defined (i.e.
void setShape(rownr_t aRowNr, const IPosition &aShape)
Set the shape of the array in the given row and allocate the array in the file.
Bool canChangeShape() const
This storage manager can handle changing array shapes.
virtual void setShapeColumn(const IPosition &aShape)
Set the (fixed) shape of the arrays in the entire column.
StManArrayFile * itsIosFile
StIndArray * getArrayPtr(rownr_t aRowNr)
Return a pointer to the array in the given row (for a get).
virtual void setMaxLength(uInt maxLength)
An array of 'fixed length' strings is not handled specially, thus this function is ignored.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44