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