casacore
Loading...
Searching...
No Matches
TiledColumnStMan.h
Go to the documentation of this file.
1//# TiledColumnStMan.h: Tiled Column Storage Manager
2//# Copyright (C) 1995,1996,1997,1999,2001
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_TILEDCOLUMNSTMAN_H
27#define TABLES_TILEDCOLUMNSTMAN_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/TiledStMan.h>
32#include <casacore/casa/Arrays/IPosition.h>
33#include <casacore/casa/BasicSL/String.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38
39
40// <summary>
41// Tiled Column Storage Manager.
42// </summary>
43
44// <use visibility=export>
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> <linkto class=TiledStMan>TiledStMan</linkto>
52// <li> <linkto class=TSMCube>TSMCube</linkto>
53// <li> <linkto class=ROTiledStManAccessor>ROTiledStManAccessor</linkto>
54// for a discussion of the maximum cache size
55// </prerequisite>
56
57// <etymology>
58// TiledColumnStMan is the Tiled Storage Manager storing
59// an entire column as one hypercube.
60// </etymology>
61
62// <synopsis>
63// TiledColumnStMan is a derivation from TiledStMan, the abstract
64// tiled storage manager class. A description of the basics
65// of tiled storage managers is given in the
66// <linkto module=Tables:TiledStMan>Tables module</linkto> description.
67// <p>
68// TiledColumnStMan allows the user to create a tiled hypercube for
69// an entire data column and extend it in an automatic way.
70// It is meant to be used for fixed shaped data which have to
71// be accessed in various directions.
72// <p>
73// The TiledColumnStMan has the following (extra) properties:
74// <ul>
75// <li> Addition of a row results in the extension of the hypercube.
76// The data cells in all rows have to have the same shape. Therefore
77// the columns stored by a TiledColumnStMan storage manager
78// have to be fixed shaped (i.e. FixedShape attribute set in their
79// column descriptions).
80// <li> Coordinates for the hypercubes can be defined and (of course)
81// their shapes have to match the hypercube shape.
82// Their values have to be put explicitly (so it is not possible
83// to define them via an extendHypercube call like in
84// <linkto class=TiledDataStMan>TiledDataStMan</linkto>).
85// <li> The tile shape of the hypercube has to be defined by means
86// of the TiledColumnStMan constructor.
87// </ul>
88// </synopsis>
89
90// <motivation>
91// This tiled storage manager does not require any special action
92// (like calling add/extendHypercube) when used with a column
93// containing equally shaped arrays.
94// </motivation>
95
96// <example>
97// <srcblock>
98// // Define the table description and the columns in it.
99// TableDesc td ("", "1", TableDesc::Scratch);
100// td.addColumn (ArrayColumnDesc<float> ("RA", 1));
101// td.addColumn (ArrayColumnDesc<float> ("Dec", 1));
102// td.addColumn (ScalarColumnDesc<float> ("Velocity"));
103// td.addColumn (ArrayColumnDesc<float> ("Image", 2));
104// // Define the 3-dim hypercolumn with its data and coordinate columns.
105// // Note that its dimensionality must be one higher than the dimensionality
106// // of the data cells.
107// td.defineHypercolumn ("TSMExample",
108// 3,
109// stringToVector ("Image"),
110// stringToVector ("RA,Dec,Velocity"));
111// // Now create a new table from the description.
112// SetupNewTable newtab("tTiledColumnStMan_tmp.data", td, Table::New);
113// // Create a TiledColumnStMan storage manager for the hypercolumn
114// // and bind the columns to it.
115// // The tile shape has to be specified for the storage manager.
116// TiledColumnStMan sm1 ("TSMExample", IPosition(3,16,32,32));
117// newtab.bindAll (sm1);
118// // Create the table.
119// Table table(newtab);
120// // Define the values for the coordinates of the hypercube.
121// Vector<float> raValues(512);
122// Vector<float> DecValues(512);
123// indgen (raValues);
124// indgen (decValues, float(100));
125// ArrayColumn<float> ra (table, "RA");
126// ArrayColumn<float> dec (table, "Dec");
127// ScalarColumn<float> velocity (table, "Velocity");
128// ArrayColumn<float> image (table, "Image");
129// Cube<float> imageValues(IPosition(2,512,512));
130// indgen (imageValues);
131// // Write some data into the data columns.
132// for (uInt i=0; i<64; i++) {
133// table.addRow();
134// image.put (i, imageValues);
135// // The RA and Dec have to be put only once, because they
136// // are the same for each row.
137// if (i == 0) {
138// ra.put (i, raValues);
139// dec.put (i, decValues);
140// }
141// velocity.put (i, float(i));
142// }
143// </srcblock>
144// </example>
145
146//# <todo asof="$DATE:$">
147//# A List of bugs, limitations, extensions or planned refinements.
148//# </todo>
149
150
152{
153public:
154 // Create a TiledDataStMan storage manager for the hypercolumn
155 // with the given name. The columns used should have the FixedShape
156 // attribute set.
157 // The hypercolumn name is also the name of the storage manager.
158 // The given tile shape will be used.
159 // The given maximum cache size in bytes (default is unlimited) is
160 // persistent, thus will be reused when the table is read back.
161 // Note that the class
162 // <linkto class=ROTiledStManAccessor>ROTiledStManAccessor</linkto>
163 // allows one to overwrite the maximum cache size temporarily.
164 // Its description contains a discussion about the effects of
165 // setting a maximum cache.
166 // <br>The constructor taking a Record expects fields in the record with
167 // the name of the arguments in uppercase. If not defined, their
168 // default value is used.
169 // <group>
170 TiledColumnStMan (const String& hypercolumnName,
171 const IPosition& tileShape,
173 TiledColumnStMan (const String& hypercolumnName,
174 const Record& spec);
175 // </group>
176
178
179 // Forbid copy constructor.
181
182 // Forbid assignment.
184
185 // Clone this object.
186 // It does not clone TSMColumn objects possibly used.
187 virtual DataManager* clone() const;
188
189 // TiledColumnStMan can always access a column.
190 virtual Bool canAccessColumn() const;
191
192 // Get the type name of the data manager (i.e. TiledColumnStMan).
193 virtual String dataManagerType() const;
194
195 // Make the object from the type name string.
196 // This function gets registered in the DataManager "constructor" map.
198 const Record& spec);
199
200private:
201 // Create a TiledColumnStMan.
202 // This constructor is private, because it should only be used
203 // by makeObject.
205
206 // Get the (default) tile shape.
208
209 // Add rows to the storage manager.
210 // This will extend the hypercube.
211 void addRow64 (rownr_t nrrow);
212
213 // Get the hypercube in which the given row is stored.
214 virtual TSMCube* getHypercube (rownr_t rownr);
215
216 // Get the hypercube in which the given row is stored.
217 // It also returns the position of the row in that hypercube.
218 virtual TSMCube* getHypercube (rownr_t rownr, IPosition& position);
219
220 // Check if the hypercolumn definition fits this storage manager.
221 virtual void setupCheck (const TableDesc& tableDesc,
222 const Vector<String>& dataNames) const;
223
224 // Flush and optionally fsync the data.
225 // It returns a True status if it had to flush (i.e. if data have changed).
226 virtual Bool flush (AipsIO&, Bool fsync);
227
228 // Let the storage manager create files as needed for a new table.
229 // This allows a column with an indirect array to create its file.
230 virtual void create64 (rownr_t nrrow);
231
232 // Read the header info.
233 virtual void readHeader (rownr_t nrrow, Bool firstTime);
234
235
236 //# Declare data members.
238};
239
240
241
242
243} //# NAMESPACE CASACORE - END
244
245#endif
Abstract base class for a data manager.
String: the storage and methods of handling collections of characters.
Definition String.h:223
virtual void create64(rownr_t nrrow)
Let the storage manager create files as needed for a new table.
virtual TSMCube * getHypercube(rownr_t rownr)
Get the hypercube in which the given row is stored.
TiledColumnStMan(const String &hypercolumnName, const IPosition &tileShape, uInt64 maximumCacheSize=0)
Create a TiledDataStMan storage manager for the hypercolumn with the given name.
TiledColumnStMan(const TiledColumnStMan &)=delete
Forbid copy constructor.
virtual Bool canAccessColumn() const
TiledColumnStMan can always access a column.
TiledColumnStMan(const String &hypercolumnName, const Record &spec)
virtual void readHeader(rownr_t nrrow, Bool firstTime)
Read the header info.
virtual Bool flush(AipsIO &, Bool fsync)
Flush and optionally fsync the data.
virtual void setupCheck(const TableDesc &tableDesc, const Vector< String > &dataNames) const
Check if the hypercolumn definition fits this storage manager.
virtual DataManager * clone() const
Clone this object.
virtual TSMCube * getHypercube(rownr_t rownr, IPosition &position)
Get the hypercube in which the given row is stored.
virtual IPosition defaultTileShape() const
Get the (default) tile shape.
TiledColumnStMan()
Create a TiledColumnStMan.
TiledColumnStMan & operator=(const TiledColumnStMan &)=delete
Forbid assignment.
static DataManager * makeObject(const String &dataManagerType, const Record &spec)
Make the object from the type name string.
virtual String dataManagerType() const
Get the type name of the data manager (i.e.
void addRow64(rownr_t nrrow)
Add rows to the storage manager.
const IPosition & tileShape(rownr_t rownr) const
Get the tile shape of the data in the given row.
uInt maximumCacheSize() const
Get the current maximum cache size (in MiB (MibiByte)).
Definition TiledStMan.h:529
this file contains all the compiler specific defines
Definition mainpage.dox:28
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
unsigned long long uInt64
Definition aipsxtype.h:37