casacore
Loading...
Searching...
No Matches
TiledStMan.h
Go to the documentation of this file.
1// # TiledStMan.h: Base class for Tiled Storage Managers
2// # Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,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: 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_TILEDSTMAN_H
27#define TABLES_TILEDSTMAN_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/DataManager.h>
32#include <casacore/casa/Containers/Block.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
34#include <casacore/casa/Arrays/IPosition.h>
35#include <casacore/casa/OS/Conversion.h>
36#include <casacore/casa/BasicSL/String.h>
37
38namespace casacore { // # NAMESPACE CASACORE - BEGIN
39
40// # Forward Declarations
41class TSMColumn;
42class TSMDataColumn;
43class TSMCube;
44class TSMFile;
45class TableDesc;
46class Record;
47
48// <summary>
49// Base class for Tiled Storage Manager classes
50// </summary>
51
52// <use visibility=export>
53
54// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
55// </reviewed>
56
57// <prerequisite>
58// # Classes you should understand before using this one.
59// <li> Description of Tiled Storage Manager in module file
60// <linkto module=Tables:TiledStMan>Tables.h</linkto>
61// <li> <linkto class=DataManager>DataManager</linkto>
62// <li> <linkto class=TSMColumn>TSMColumn</linkto>
63// <li> <linkto class=ROTiledStManAccessor>ROTiledStManAccessor</linkto>
64// for a discussion of the maximum cache size
65// </prerequisite>
66
67// <synopsis>
68// TiledStMan is the base class for Tiled Storage Managers.
69// A tiled storage manager is capable of storing a hypercolumn
70// (as defined by <linkto file="TableDesc.h#defineHypercolumn">
71// TableDesc::defineHypercolumn</linkto>)
72// in one or more hypercubes.
73// <br>It is not necessary to define a hypercolumn. If not defined,
74// it is assumed that all columns bound to this storage manager are
75// data columns. At least one of the columns must have a fixed
76// dimensionality and is used to determine the hypercube dimnensionality.
77// <br>The general concept of these storage managers is explained in the
78// <linkto module="Tables:TiledStMan">Tables module description</linkto>.
79// <p>
80// TiledStMan contains all common functions for the different tiled
81// storage managers. In particular, it contains functions
82// to check if the definitions of the shapes of hypercubes, coordinates, and
83// data cells are consistent.
84// It also contains various data members and functions to make them
85// persistent by writing them into an AipsIO stream.
86// </synopsis>
87
88// <motivation>
89// This base class contains the common functionality of all
90// tiled storage managers. The base class is still abstract.
91// Only concrete tiled storage managers derived from it can
92// be instantiated.
93// <p>
94// Tiled storage managers make access to array data possible with
95// more or less the same efficiency for access along different axes.
96// </motivation>
97
98// # <todo asof="$DATE:$">
99// # A List of bugs, limitations, extensions or planned refinements.
100// # </todo>
101
102class TiledStMan : public DataManager {
103 public:
104 // Create a TiledStMan.
106
107 // Create a TiledStMan storage manager.
108 // The given maximum cache size (in MibiByte) is persistent,
109 // thus will be reused when the table is read back. Note that the class
110 // <linkto class=ROTiledStManAccessor>ROTiledStManAccessor</linkto>
111 // allows one to overwrite the maximum cache size temporarily.
112 // Its description contains a discussion about the effects of
113 // setting a maximum cache.
114 TiledStMan(const String& hypercolumnName, uInt maximumCacheSizeMiB);
115
116 virtual ~TiledStMan();
117
118 // Forbid copy constructor.
119 TiledStMan(const TiledStMan&) = delete;
120
121 // Forbid assignment.
122 TiledStMan& operator=(const TiledStMan&) = delete;
123
124 // Get the name given to the storage manager.
125 // This is the name of the hypercolumn.
126 virtual String dataManagerName() const;
127
128 void setDataManagerName(const String& newHypercolumnName);
129
130 // Return a record containing data manager specifications.
131 virtual Record dataManagerSpec() const;
132
133 // Get data manager properties that can be modified.
134 // It is only MaxCacheSize (the maximum cache size in MibiByte).
135 // It is a subset of the data manager specification.
136 virtual Record getProperties() const;
137
138 // Modify data manager properties.
139 // Only MaxCacheSize can be used. It is similar to function setCacheSize
140 // with <src>canExceedNrBuckets=False</src>.
141 virtual void setProperties(const Record& spec);
142
143 // Set the flag to "data has changed since last flush".
144 void setDataChanged();
145
146 // Derive the tile shape from the hypercube shape for the given
147 // number of pixels per tile. It is tried to get the same number
148 // of tiles for each dimension.
149 // When a weight vector is given, the number of tiles for a dimension
150 // is proportional to the weight.
151 // <br>After the initial guess it tries to optimize it by trying
152 // to waste as little space as possible, while trying to keep as close
153 // to the initial guess. The given tolerance (possibly per axis)
154 // gives the minimum and maximum possible length of a tile axis
155 // (minimum = initial_guess*tolerance; maximum = initial_guess/tolerance).
156 // The heuristic is such that a tile axis length dividing the cube length
157 // exactly is always favoured.
158 // The test program <src>tTiledStMan</src> can be used to see how
159 // the algorithm works out for a given tile size and cube shape.
160 // <group>
161 static IPosition makeTileShape(const IPosition& hypercubeShape, Double tolerance = 0.5,
162 uInt64 maxNrPixelsPerTile = 4 * 1024 * 1024);
164 const Vector<double>& tolerance,
165 uInt64 maxNrPixelsPerTile = 4 * 1024 * 1024);
166 // </group>
167
168 // Set the maximum cache size (in MiB) in a non-persistent way.
169 virtual void setMaximumCacheSize(uInt nMiB);
170
171 // Get the current maximum cache size (in MiB (MibiByte)).
172 uInt maximumCacheSize() const;
173
174 // Get the current cache size (in buckets) for the hypercube in
175 // the given row.
176 uInt cacheSize(rownr_t rownr) const;
177
178 // Get the hypercube shape of the data in the given row.
179 const IPosition& hypercubeShape(rownr_t rownr) const;
180
181 // Get the tile shape of the data in the given row.
182 const IPosition& tileShape(rownr_t rownr) const;
183
184 // Get the bucket size (in bytes) of the hypercube in the given row.
186
187 // Can the tiled storage manager handle changing array shapes?
188 // The default is no (but TiledCellStMan can).
189 virtual Bool canChangeShape() const;
190
191 // Can the tiled storage manager access an entire column.
192 // TiledColumnStMan can always do that.
193 // The others might be able to do it (for this time).
194 // The default implementation returns True if there is only 1 hypercube.
195 virtual Bool canAccessColumn() const;
196
197 // The data manager supports use of MultiFile.
198 virtual Bool hasMultiFileSupport() const;
199
200 // Calculate the cache size (in buckets) for accessing the hypercube
201 // containing the given row. It takes the maximum cache size into
202 // account (allowing an overdraft of 10%).
203 // It uses the given axisPath (i.e. traversal order) to determine
204 // the optimum size. A window can be specified to indicate that only
205 // the given subset of the hypercube will be accessed.
206 // <br>
207 // The length of the slice and window arguments and <src>axisPath</src>
208 // must be less or equal to the dimensionality of the hypercube.
209 // The non-specified <src>windowStart</src> parts default to 0.
210 // The non-specified <src>windowLength</src> parts default to
211 // the hypercube shape.
212 // The non-specified <src>sliceShape</src> parts default to 1.
213 // <br>
214 // Axispath = [2,0,1] indicates that the z-axis changes most rapidly,
215 // thereafter x and y. An axis can occur only once in the axisPath.
216 // The non-specified <src>axisPath</src> parts get the natural order.
217 // E.g. in the previous example axisPath=[2] defines the same path.
218 // <br>When forceSmaller is False, the cache is not resized when the
219 // new size is smaller.
220 // <br>A flag is set indicating that the TSMDataColumn
221 // access functions do not need to size the cache.
222 uInt calcCacheSize(rownr_t rownr, const IPosition& sliceShape, const IPosition& windowStart,
223 const IPosition& windowLength, const IPosition& axisPath) const;
224
225 // Set the cache size using the <src>calcCacheSize</src>
226 // function mentioned above.
227 void setCacheSize(rownr_t rownr, const IPosition& sliceShape, const IPosition& windowStart,
228 const IPosition& windowLength, const IPosition& axisPath, Bool forceSmaller);
229
230 // Set the cache size for accessing the hypercube containing the given row.
231 // When the give cache size exceeds the maximum cache size with more
232 // than 10%, the maximum cache size is used instead.
233 // <br>When forceSmaller is False, the cache is not resized when the
234 // new size is smaller.
235 // <br>A flag is set indicating that the TSMDataColumn
236 // access functions do not need to size the cache.
237 void setCacheSize(rownr_t rownr, uInt nbuckets, Bool forceSmaller);
238
239 // Sets the cache size using the hypercube instead of the row number.
240 // Useful for iterating over all hypercubes.
241 void setHypercubeCacheSize(uInt hypercube, uInt nbuckets, Bool forceSmaller);
242
243 // Determine if the user set the cache size (using setCacheSize).
245
246 // Empty the caches used by the hypercubes in this storage manager.
247 // It will flush the caches as needed and remove all buckets from them
248 // resulting in a possibly large drop in memory used.
249 // It also clears the userSetCache flag.
251
252 // Show the statistics of all caches used.
253 void showCacheStatistics(ostream& os) const;
254
255 // Get the length of the data for the given number of pixels.
256 // This can be used to calculate the length of a tile.
257 uInt64 getLengthOffset(uInt64 nrPixels, Block<uInt>& dataOffset, Block<uInt>& localOffset,
258 uInt& localTileLength) const;
259
260 // Get the number of coordinate vectors.
261 uInt nrCoordVector() const;
262
263 // Get the nr of rows in this storage manager.
264 rownr_t nrow() const;
265
266 // Does the storage manager allow to add rows? (yes)
268
269 // Get the default tile shape.
270 // By default it returns a zero-length IPosition.
272
273 // Return the number of hypercubes.
274 uInt nhypercubes() const;
275
276 // Test if only one hypercube is used by this storage manager.
277 // If not, throw an exception. Otherwise return the hypercube.
279
280 // Get the given hypercube.
281 // <group>
282 const TSMCube* getTSMCube(uInt hypercube) const;
284 // </group>
285
286 // Get the hypercube in which the given row is stored.
287 // <group>
288 const TSMCube* getHypercube(rownr_t rownr) const;
289 virtual TSMCube* getHypercube(rownr_t rownr) = 0;
290 // </group>
291
292 // Get the hypercube in which the given row is stored.
293 // It also returns the position of the row in that hypercube.
294 virtual TSMCube* getHypercube(rownr_t rownr, IPosition& position) = 0;
295
296 // Make the correct TSMCube type (depending on tsmOption()).
297 TSMCube* makeTSMCube(TSMFile* file, const IPosition& cubeShape, const IPosition& tileShape,
298 const Record& values, Int64 fileOffset = -1);
299
300 // Read a tile and convert the data to local format.
301 void readTile(char* local, const Block<uInt>& localOffset, const char* external,
302 const Block<uInt>& externalOffset, uInt nrpixels);
303
304 // Write a tile after converting the data to external format.
305 void writeTile(char* external, const Block<uInt>& externalOffset, const char* local,
306 const Block<uInt>& localOffset, uInt nrpixels);
307
308 // Get the TSMFile object with the given sequence number.
309 TSMFile* getFile(uInt sequenceNumber);
310
311 // Open the storage manager for an existing table.
312 virtual rownr_t open64(rownr_t nrrow, AipsIO&);
313
314 // Resync the storage manager with the new file contents.
315 virtual rownr_t resync64(rownr_t nrrow);
316
317 // Reopen all files used in this storage manager for read/write access.
318 virtual void reopenRW();
319
320 // The data manager will be deleted (because all its columns are
321 // requested to be deleted).
322 // So clean up the things needed (e.g. delete files).
323 virtual void deleteManager();
324
325 // Create a column in the storage manager on behalf of a table column.
326 // <group>
327 // Create a scalar column.
329 // Create a direct array column.
331 // Create an indirect array column.
333 // </group>
334
335 // The TiledStMan wants to do reallocateColumn.
337
338 // Reallocate the column object if it is part of this data manager.
339 // It returns a pointer to the new column object.
340 // It is used to remove the indirection of the TSMColumn objects
341 // resulting in only one iso. two virtual column calls to get the data.
343
344 // Set the shape and tile shape of a hypercube.
345 // By default it throws an "impossible" exception.
346 virtual void setShape(rownr_t rownr, TSMCube* hypercube, const IPosition& shape,
347 const IPosition& tileShape);
348
349 // Check the shape to be set for a hypercube.
350 // It checks if it matches predefined (fixed shape) columns
351 // and the shape of already defined coordinate columns.
352 void checkCubeShape(const TSMCube* hypercube, const IPosition& cubeShape) const;
353
354 // Get the data type of the coordinate column with the given name.
355 // An exception is thrown when the column is unknown.
356 int coordinateDataType(const String& columnName) const;
357
358 // Initialize the new coordinates for the given cube.
359 void initCoordinates(TSMCube* hypercube);
360
361 // Get pointer to data column object.
362 const TSMDataColumn* getDataColumn(uInt colnr) const { return dataCols_p[colnr]; }
363
364 protected:
365 // Set the persistent maximum cache size (in MiB).
366 void setPersMaxCacheSize(uInt nMiB);
367
368 // Get the bindings of the columns with the given names.
369 // If bound, the pointer to the TSMColumn object is stored in the block.
370 // If mustExist is True, an exception is thrown if the column
371 // is not bound.
372 // It returns the number of bound columns.
374 Bool mustExist) const;
375
376 // Function setup calls this function to allow the derived class
377 // to check specific information. In case of errors, an exception
378 // should be thrown.
379 // By default it does nothing.
380 virtual void setupCheck(const TableDesc& tableDesc, const Vector<String>& dataNames) const;
381
382 // Get the table description needed for the hypercolumn description.
383 virtual const TableDesc& getDesc() const;
384
385 // Check if values are given in the record for all columns in
386 // the block. Also check if the data types are correct.
387 // An exception is thrown if something is incorrect.
388 void checkValues(const Block<TSMColumn*>& colSet, const Record& values) const;
389
390 // Check if the coordinate values are correct.
391 // This calls checkValues and checks if their shapes match the
392 // hypercube shape.
393 // An exception is thrown if invalid.
394 void checkCoordinates(const Block<TSMColumn*>& coordColSet, const IPosition& cubeShape,
395 const Record& values) const;
396
397 // Check if the shapes of FixedShape data and coordinate columns match.
398 // An exception is thrown if not.
399 void checkShapeColumn(const IPosition& shape) const;
400
401 // Check if the cube shape matches that of defined coordinates.
402 void checkCoordinatesShapes(const TSMCube* hypercube, const IPosition& cubeShape) const;
403
404 // Check if the hypercube to be added is correctly defined.
405 void checkAddHypercube(const IPosition& cubeShape, const Record& values) const;
406
407 // Make a new TSMCube object.
409 const Record& values);
410
411 // Get the index of the hypercube with the given id-values.
412 // If not found, -1 is returned.
413 Int getCubeIndex(const Record& idValues) const;
414
415 // Determine how many rows need to be added for an extension
416 // (in the last dimension) of a hypercube with the given shape.
417 rownr_t addedNrrow(const IPosition& shape, uInt incrInLastDim) const;
418
419 // Flush the caches of all hypercubes.
420 // If data have put and fsync is set, fsync all files.
422
423 // Let a derived class read the header info.
424 // This is used by the open and resync function.
425 virtual void readHeader(rownr_t nrrow, Bool firstTime) = 0;
426
427 // Create the TSM header file.
428 // It creates an AipsIO object for it.
430
431 // Open the TSM header file.
432 // It creates an AipsIO object for it.
434
435 // Write the data into the header file.
436 // The given number of TSMCube objects have to be written.
437 void headerFilePut(AipsIO& headerFile, uInt64 nrCube);
438
439 // Read the data from the header file.
440 // When done for the first time, setup() is called to initialize
441 // the various variables (using the extraNdim variable).
442 // It returns the version of the AipsIO object in the header.
443 uInt headerFileGet(AipsIO& headerFile, rownr_t tabNrrow, Bool firstTime, Int extraNdim);
444
445 // Close the header file.
446 // It deletes the AipsIO object.
447 void headerFileClose(AipsIO* headerFile);
448
449 // Set up the TiledStMan variables from the table description.
450 // The argument specifies the number of extra dimensions for the
451 // hypercube compared to the data array (usually 0 or 1).
452 // It is only used if no hypercolumn definition exists.
453 // -1 means that the hypercolumn definition has to be present.
454 void setup(Int extraNdim = -1);
455
456 // Create a TSMFile object and store its pointer at the given index
457 // in the block.
458 void createFile(uInt index);
459
460 // Convert the scalar data type to an array data type.
461 // This function is temporary and can disappear when the ColumnDesc
462 // classes use type TpArray*.
463 int arrayDataType(int dataType) const;
464
465 // # Declare all data members.
466 // The name of the hypercolumn.
468 // The number of rows in the columns.
470 // The assembly of all columns.
472 // The assembly of all data columns.
475 // The assembly of all id columns.
477 // The assembly of all coordinate columns.
479 // The assembly of all TSMFile objects.
480 // The first file is for all non-extensible cubes, while the others
481 // are for one file per extensible cube.
483 // The assembly of all TSMCube objects.
485 // The persistent maximum cache size (in MiB) for a hypercube.
487 // The actual maximum cache size for a hypercube (in MiB).
489 // The dimensionality of the hypercolumn.
491 // The number of vector coordinates.
493 // The fixed cell shape.
495 // Has any data changed since the last flush?
497};
498
500
502
503inline rownr_t TiledStMan::nrow() const { return nrrow_p; }
504
505inline uInt TiledStMan::nhypercubes() const { return cubeSet_p.nelements(); }
506
508
509inline const TSMCube* TiledStMan::getTSMCube(uInt hypercube) const {
510 return const_cast<TiledStMan*>(this)->getTSMCube(hypercube);
511}
512
513inline const TSMCube* TiledStMan::getHypercube(rownr_t rownr) const {
514 return const_cast<TiledStMan*>(this)->getHypercube(rownr);
515}
516
518 persMaxCacheSize_p = nMiB;
519 maxCacheSize_p = nMiB;
520}
521
522} // namespace casacore
523
524#endif
DataManager()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:355
virtual void setMaximumCacheSize(uInt nMiB)
Set the maximum cache size (in MiB) in a non-persistent way.
int coordinateDataType(const String &columnName) const
Get the data type of the coordinate column with the given name.
uInt nhypercubes() const
Return the number of hypercubes.
Definition TiledStMan.h:505
Block< TSMColumn * > dataColSet_p
Definition TiledStMan.h:474
uInt headerFileGet(AipsIO &headerFile, rownr_t tabNrrow, Bool firstTime, Int extraNdim)
Read the data from the header file.
IPosition fixedCellShape_p
The fixed cell shape.
Definition TiledStMan.h:494
Block< TSMDataColumn * > dataCols_p
The assembly of all data columns.
Definition TiledStMan.h:473
void setPersMaxCacheSize(uInt nMiB)
Set the persistent maximum cache size (in MiB).
Definition TiledStMan.h:517
virtual void deleteManager()
The data manager will be deleted (because all its columns are requested to be deleted).
virtual rownr_t open64(rownr_t nrrow, AipsIO &)
Open the storage manager for an existing table.
void setCacheSize(rownr_t rownr, uInt nbuckets, Bool forceSmaller)
Set the cache size for accessing the hypercube containing the given row.
virtual String dataManagerName() const
Get the name given to the storage manager.
Block< TSMColumn * > idColSet_p
The assembly of all id columns.
Definition TiledStMan.h:476
void headerFileClose(AipsIO *headerFile)
Close the header file.
Block< TSMColumn * > coordColSet_p
The assembly of all coordinate columns.
Definition TiledStMan.h:478
uInt calcCacheSize(rownr_t rownr, const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath) const
Calculate the cache size (in buckets) for accessing the hypercube containing the given row.
TSMCube * makeTSMCube(TSMFile *file, const IPosition &cubeShape, const IPosition &tileShape, const Record &values, Int64 fileOffset=-1)
Make the correct TSMCube type (depending on tsmOption()).
uInt64 bucketSize(rownr_t rownr) const
Get the bucket size (in bytes) of the hypercube in the given row.
virtual Bool canAccessColumn() const
Can the tiled storage manager access an entire column.
uInt nrCoordVector() const
Get the number of coordinate vectors.
Definition TiledStMan.h:501
void readTile(char *local, const Block< uInt > &localOffset, const char *external, const Block< uInt > &externalOffset, uInt nrpixels)
Read a tile and convert the data to local format.
TiledStMan()
Create a TiledStMan.
AipsIO * headerFileOpen()
Open the TSM header file.
Int getCubeIndex(const Record &idValues) const
Get the index of the hypercube with the given id-values.
void setHypercubeCacheSize(uInt hypercube, uInt nbuckets, Bool forceSmaller)
Sets the cache size using the hypercube instead of the row number.
Bool userSetCache(rownr_t rownr) const
Determine if the user set the cache size (using setCacheSize).
virtual Bool canChangeShape() const
Can the tiled storage manager handle changing array shapes?
virtual void reopenRW()
Reopen all files used in this storage manager for read/write access.
String hypercolumnName_p
The name of the hypercolumn.
Definition TiledStMan.h:467
const IPosition & tileShape(rownr_t rownr) const
Get the tile shape of the data in the given row.
uInt64 getLengthOffset(uInt64 nrPixels, Block< uInt > &dataOffset, Block< uInt > &localOffset, uInt &localTileLength) const
Get the length of the data for the given number of pixels.
Block< TSMCube * > cubeSet_p
The assembly of all TSMCube objects.
Definition TiledStMan.h:484
virtual IPosition defaultTileShape() const
Get the default tile shape.
static IPosition makeTileShape(const IPosition &hypercubeShape, Double tolerance=0.5, uInt64 maxNrPixelsPerTile=4 *1024 *1024)
Derive the tile shape from the hypercube shape for the given number of pixels per tile.
Block< TSMColumn * > colSet_p
The assembly of all columns.
Definition TiledStMan.h:471
TiledStMan & operator=(const TiledStMan &)=delete
Forbid assignment.
rownr_t nrrow_p
The number of rows in the columns.
Definition TiledStMan.h:469
void setup(Int extraNdim=-1)
Set up the TiledStMan variables from the table description.
uInt nrdim_p
The dimensionality of the hypercolumn.
Definition TiledStMan.h:490
uInt persMaxCacheSize_p
The persistent maximum cache size (in MiB) for a hypercube.
Definition TiledStMan.h:486
DataManagerColumn * makeIndArrColumn(const String &name, int dataType, const String &dataTypeID)
Create an indirect array column.
void emptyCaches()
Empty the caches used by the hypercubes in this storage manager.
virtual void setProperties(const Record &spec)
Modify data manager properties.
Bool flushCaches(Bool fsync)
Flush the caches of all hypercubes.
uInt maxCacheSize_p
The actual maximum cache size for a hypercube (in MiB).
Definition TiledStMan.h:488
TSMCube * getTSMCube(uInt hypercube)
void checkCoordinatesShapes(const TSMCube *hypercube, const IPosition &cubeShape) const
Check if the cube shape matches that of defined coordinates.
void checkShapeColumn(const IPosition &shape) const
Check if the shapes of FixedShape data and coordinate columns match.
void setCacheSize(rownr_t rownr, const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, Bool forceSmaller)
Set the cache size using the calcCacheSize function mentioned above.
virtual Record dataManagerSpec() const
Return a record containing data manager specifications.
Bool dataChanged_p
Has any data changed since the last flush?
Definition TiledStMan.h:496
uInt getBindings(const Vector< String > &columnNames, Block< TSMColumn * > &colSet, Bool mustExist) const
Get the bindings of the columns with the given names.
void setDataManagerName(const String &newHypercolumnName)
void showCacheStatistics(ostream &os) const
Show the statistics of all caches used.
void writeTile(char *external, const Block< uInt > &externalOffset, const char *local, const Block< uInt > &localOffset, uInt nrpixels)
Write a tile after converting the data to external format.
TiledStMan(const String &hypercolumnName, uInt maximumCacheSizeMiB)
Create a TiledStMan storage manager.
void createFile(uInt index)
Create a TSMFile object and store its pointer at the given index in the block.
TSMFile * getFile(uInt sequenceNumber)
Get the TSMFile object with the given sequence number.
virtual void readHeader(rownr_t nrrow, Bool firstTime)=0
Let a derived class read the header info.
Block< TSMFile * > fileSet_p
The assembly of all TSMFile objects.
Definition TiledStMan.h:482
virtual TSMCube * getHypercube(rownr_t rownr, IPosition &position)=0
Get the hypercube in which the given row is stored.
uInt cacheSize(rownr_t rownr) const
Get the current cache size (in buckets) for the hypercube in the given row.
Bool canReallocateColumns() const
The TiledStMan wants to do reallocateColumn.
const TSMCube * getTSMCube(uInt hypercube) const
Get the given hypercube.
Definition TiledStMan.h:509
rownr_t nrow() const
Get the nr of rows in this storage manager.
Definition TiledStMan.h:503
virtual TSMCube * getHypercube(rownr_t rownr)=0
void checkValues(const Block< TSMColumn * > &colSet, const Record &values) const
Check if values are given in the record for all columns in the block.
DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
TiledStMan(const TiledStMan &)=delete
Forbid copy constructor.
const TSMDataColumn * getDataColumn(uInt colnr) const
Get pointer to data column object.
Definition TiledStMan.h:362
TSMCube * makeHypercube(const IPosition &cubeShape, const IPosition &tileShape, const Record &values)
Make a new TSMCube object.
DataManagerColumn * makeScalarColumn(const String &name, int dataType, const String &dataTypeID)
Create a column in the storage manager on behalf of a table column.
void checkCoordinates(const Block< TSMColumn * > &coordColSet, const IPosition &cubeShape, const Record &values) const
Check if the coordinate values are correct.
void setDataChanged()
Set the flag to "data has changed since last flush".
Definition TiledStMan.h:507
const TSMCube * getHypercube(rownr_t rownr) const
Get the hypercube in which the given row is stored.
Definition TiledStMan.h:513
uInt nrCoordVector_p
The number of vector coordinates.
Definition TiledStMan.h:492
int arrayDataType(int dataType) const
Convert the scalar data type to an array data type.
virtual const TableDesc & getDesc() const
Get the table description needed for the hypercolumn description.
Bool canAddRow() const
Does the storage manager allow to add rows?
static IPosition makeTileShape(const IPosition &hypercubeShape, const Vector< double > &weight, const Vector< double > &tolerance, uInt64 maxNrPixelsPerTile=4 *1024 *1024)
void headerFilePut(AipsIO &headerFile, uInt64 nrCube)
Write the data into the header file.
virtual TSMCube * singleHypercube()
Test if only one hypercube is used by this storage manager.
uInt maximumCacheSize() const
Get the current maximum cache size (in MiB (MibiByte)).
Definition TiledStMan.h:499
virtual Record getProperties() const
Get data manager properties that can be modified.
virtual void setShape(rownr_t rownr, TSMCube *hypercube, const IPosition &shape, const IPosition &tileShape)
Set the shape and tile shape of a hypercube.
AipsIO * headerFileCreate()
Create the TSM header file.
void checkAddHypercube(const IPosition &cubeShape, const Record &values) const
Check if the hypercube to be added is correctly defined.
DataManagerColumn * makeDirArrColumn(const String &name, int dataType, const String &dataTypeID)
Create a direct array column.
virtual Bool hasMultiFileSupport() const
The data manager supports use of MultiFile.
rownr_t addedNrrow(const IPosition &shape, uInt incrInLastDim) const
Determine how many rows need to be added for an extension (in the last dimension) of a hypercube with...
const IPosition & hypercubeShape(rownr_t rownr) const
Get the hypercube shape of the data in the given row.
void checkCubeShape(const TSMCube *hypercube, const IPosition &cubeShape) const
Check the shape to be set for a hypercube.
virtual void setupCheck(const TableDesc &tableDesc, const Vector< String > &dataNames) const
Function setup calls this function to allow the derived class to check specific information.
void initCoordinates(TSMCube *hypercube)
Initialize the new coordinates for the given cube.
virtual rownr_t resync64(rownr_t nrrow)
Resync the storage manager with the new file contents.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
String name() const
Return the name of the field.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44
DataType dataType(const RecordFieldId &) const
unsigned long long uInt64
Definition aipsxtype.h:37