28 #ifndef TABLES_TSMCUBE_H
29 #define TABLES_TSMCUBE_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/DataMan/TSMShape.h>
35 #include <casacore/casa/Containers/Record.h>
36 #include <casacore/casa/Arrays/IPosition.h>
37 #include <casacore/casa/OS/Conversion.h>
38 #include <casacore/casa/iosfwd.h>
47 template<
class T>
class Block;
219 char* section,
uInt colnr,
220 uInt localPixelSize,
uInt externalPixelSize,
227 char* section,
uInt colnr,
228 uInt localPixelSize,
uInt externalPixelSize,
333 uInt endPixelInLastTile,
Cache for buckets in a part of a file.
void resize(size_t newSize, bool copy=true)
Old values are copied on resize if copy==true.
size_t nelements() const
The number of elements in this IPosition.
A drop-in replacement for Block<T*>.
String: the storage and methods of handling collections of characters.
void extendCoordinates(const Record &coordValues, const String &coordName, uInt length)
Extend the coordinates vector for the given coordinate to the given length with the given coordValues...
uInt cacheSize() const
Get the current cache size (in buckets).
TSMFile * filePtr_p
Pointer to the TSMFile object holding the data.
void emptyCache()
Empty the cache.
const Record & valueRecord() const
Get the record containing the id and coordinate values.
void putObject(AipsIO &ios)
Put the data of the object into the AipsIO stream.
virtual void showCacheStatistics(ostream &os) const
Show the cache statistics.
IPosition lastColSlice_p
The slice shape of the last column access to a slice.
uInt validateCacheSize(uInt cacheSize) const
Validate the cache size (in buckets).
virtual void setCacheSize(const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, Bool forceSmaller, Bool userSet)
Set the cache size for the given slice and access path.
virtual void resyncCache()
Resync the cache object.
IPosition tilesPerDim_p
The number of tiles in each hypercube dimension.
void resizeTileSections()
Resize the IPosition member variables used in accessSection() if nrdim_p changes value.
virtual void makeCache()
Construct the cache object (if not constructed yet).
static void deleteCallBack(void *owner, char *buffer)
IPosition tileShape_p
The shape of the tiles in the hypercube.
IPosition endPixelInFirstTile_p
Last pixel in first tile.
Bool userSetCache() const
Determine if the user set the cache size (using setCacheSize).
Block< uInt > localOffset_p
Offset for each data column in a tile (in local format).
TSMCube(TiledStMan *stman, AipsIO &ios, Bool useDerived=False)
Reconstruct the hypercube by reading its data from the AipsIO stream.
uInt localTileLength() const
Get the length of a tile (in bytes) in local format.
void setLastColAccess(AccessType type)
virtual void resync(AipsIO &ios)
Resync the object with the data file.
const IPosition & tileShape() const
Get the shape of the tiles.
uInt tileSize_p
The tilesize in bytes.
IPosition adjustTileShape(const IPosition &cubeShape, const IPosition &tileShape) const
Adjust the tile shape to the hypercube shape.
TSMCube(const TSMCube &)
Forbid copy constructor.
TSMCube & operator=(const TSMCube &)
Forbid assignment.
uInt coordinateSize(const String &coordinateName) const
Get the size of a coordinate (i.e.
virtual void setShape(const IPosition &cubeShape, const IPosition &tileShape)
Set the hypercube shape.
Block< uInt > externalOffset_p
Offset for each data column in a tile (in external format).
virtual void extend(uInt64 nr, const Record &coordValues, const TSMColumn *lastCoordColumn)
Extend the last dimension of the cube with the given number.
static char * readCallBack(void *owner, const char *external)
Define the callback functions for the BucketCache.
void accessLine(char *section, uInt pixelOffset, uInt localPixelSize, Bool writeFlag, BucketCache *cachePtr, const IPosition &startTile, uInt endTile, const IPosition &startPixelInFirstTile, uInt endPixelInLastTile, uInt lineIndex)
Access a line in a more optimized way.
IPosition cubeShape_p
The shape of the hypercube.
uInt nrTiles_p
Number of tiles in the hypercube.
void clearCache(Bool doFlush=True)
Clear the cache, so data will be reread.
uInt nrTilesSubCube_p
Number of tiles in all but last dimension (used when extending).
static uInt calcCacheSize(const IPosition &cubeShape, const IPosition &tileShape, Bool extensible, const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, uInt maxCacheSizeMiB, uInt bucketSize)
char * readTile(const char *external)
Define the functions doing the actual read and write of the data in the tile and converting it to/fro...
TSMShape expandedTilesPerDim_p
Precomputed tilesPerDim information.
IPosition startPixelInFirstTile_p
First pixel in first tile.
void setLastColSlice(const IPosition &slice)
TSMCube(TiledStMan *stman, TSMFile *file, const IPosition &cubeShape, const IPosition &tileShape, const Record &values, Int64 fileOffset, Bool useDerived=False)
Construct the hypercube using the given file with the given shape.
virtual void accessStrided(const IPosition &start, const IPosition &end, const IPosition &stride, char *section, uInt colnr, uInt localPixelSize, uInt externalPixelSize, Bool writeFlag)
Read or write a section in a strided way.
AccessType lastColAccess_p
Was the last column access to a cell, slice, or column?
static char * initCallBack(void *owner)
IPosition endPixelInLastTile_p
Last pixel in last tile.
Bool matches(const PtrBlock< TSMColumn * > &idColSet, const Record &idValues)
Test if the id values match.
Bool useDerived_p
Is the class used directly or only by a derived class only?
BucketCache * getCache()
Get the cache object.
uInt nrdim_p
Dimensionality of the hypercube.
Int64 fileOffset_p
Offset in the TSMFile object where the data of this hypercube starts.
IPosition endTile_p
Last tile needed.
const IPosition & cubeShape() const
Get the shape of the hypercube.
Bool extensible_p
Is the hypercube extensible?
virtual void flushCache()
Flush the data in the cache.
static uInt validateCacheSize(uInt cacheSize, uInt maxSizeMiB, uInt bucketSize)
void writeTile(char *external, const char *local)
uInt bucketSize_p
The bucket size in bytes (is equal to tile size in bytes).
Record values_p
The values of the possible id and coordinate columns.
Int getObject(AipsIO &ios)
Get the data of the object from the AipsIO stream.
void setup()
Initialize the various variables.
uInt calcCacheSize(const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath) const
Calculate the cache size (in buckets) for the given slice and access path.
virtual void deleteCache()
Delete the cache object.
TSMShape expandedTileShape_p
Precomputed tileShape information.
IPosition cellShape() const
Get the shape of the data cells in the cube.
static void writeCallBack(void *owner, char *external, const char *local)
AccessType
Define the possible access types for TSMDataColumn.
TiledStMan * stmanPtr_p
Pointer to the parent storage manager.
Bool userSetCache_p
Did the user set the cache size?
virtual void accessSection(const IPosition &start, const IPosition &end, char *section, uInt colnr, uInt localPixelSize, uInt externalPixelSize, Bool writeFlag)
Read or write a section in the cube.
IPosition startTile_p
First tile needed.
BucketCache * cache_p
The bucket cache.
AccessType getLastColAccess() const
Functions for TSMDataColumn to keep track of the last type of access to a hypercube.
virtual void setCacheSize(uInt cacheSize, Bool forceSmaller, Bool userSet)
Resize the cache object.
Bool isExtensible() const
Is the hypercube extensible?
uInt localTileLength_p
The tile size in bytes in local format.
const IPosition & getLastColSlice() const
IPosition nrTileSection_p
IPosition variables used in accessSection(); declared here as member variables to avoid significant c...
uInt bucketSize() const
Get the bucket size (bytes).
this file contains all the compiler specific defines
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
bool Bool
Define the standard types used by Casacore.
unsigned long long uInt64