28 #ifndef TABLES_TSMCUBE_H
29 #define TABLES_TSMCUBE_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,
338 static char*
readCallBack (
void* owner,
const char* external);
348 char*
readTile (
const char* external);
349 void writeTile (
char* external,
const char* local);
static void deleteCallBack(void *owner, char *buffer)
A Vector of integers, for indexing into Array<T> objects.
Bool extensible_p
Is the hypercube extensible?
void setLastColAccess(AccessType type)
IPosition lastColSlice_p
The slice shape of the last column access to a slice.
uInt bucketSize() const
Get the bucket size (bytes).
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Cache for buckets in a part of a file.
const IPosition & tileShape() const
Get the shape of the tiles.
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.
Bool userSetCache() const
Determine if the user set the cache size (using setCacheSize).
Bool useDerived_p
Is the class used directly or only by a derived class only?
uInt localTileLength() const
Get the length of a tile (in bytes) in local format.
Tiled hypercube in a table.
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.
AipsIO is the object persistency mechanism of Casacore.
TiledStMan * stmanPtr_p
Pointer to the parent storage manager.
IPosition endPixelInLastTile_p
Last pixel in last tile.
unsigned long long uInt64
AccessType
Define the possible access types for TSMDataColumn.
uInt validateCacheSize(uInt cacheSize) const
Validate the cache size (in buckets).
IPosition adjustTileShape(const IPosition &cubeShape, const IPosition &tileShape) const
Adjust the tile shape to the hypercube shape.
Base class for Tiled Storage Manager classes.
IPosition cubeShape_p
The shape of the hypercube.
uInt localTileLength_p
The tile size in bytes in local format.
static char * initCallBack(void *owner)
uInt cacheSize() const
Get the current cache size (in buckets).
IPosition tileShape_p
The shape of the tiles in the hypercube.
uInt coordinateSize(const String &coordinateName) const
Get the size of a coordinate (i.e.
Bool matches(const PtrBlock< TSMColumn * > &idColSet, const Record &idValues)
Test if the id values match.
TSMShape expandedTilesPerDim_p
Precomputed tilesPerDim information.
Block< uInt > localOffset_p
Offset for each data column in a tile (in local format).
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...
Bool isExtensible() const
Is the hypercube extensible?
IPosition nrTileSection_p
IPosition variables used in accessSection(); declared here as member variables to avoid significant c...
void setup()
Initialize the various variables.
IPosition tilesPerDim_p
The number of tiles in each hypercube dimension.
IPosition startPixelInFirstTile_p
First pixel in first tile.
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.
uInt nrdim_p
Dimensionality of the hypercube.
const IPosition & getLastColSlice() const
IPosition cellShape() const
Get the shape of the data cells in the cube.
uInt nrTilesSubCube_p
Number of tiles in all but last dimension (used when extending).
Int64 fileOffset_p
Offset in the TSMFile object where the data of this hypercube starts.
Int getObject(AipsIO &ios)
Get the data of the object from the AipsIO stream.
virtual void resync(AipsIO &ios)
Resync the object with the data file.
virtual void flushCache()
Flush the data in the cache.
virtual void showCacheStatistics(ostream &os) const
Show the cache statistics.
AccessType lastColAccess_p
Was the last column access to a cell, slice, or column?
BucketCache * getCache()
Get the cache object.
Bool userSetCache_p
Did the user set the cache size?
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
const IPosition & cubeShape() const
Get the shape of the hypercube.
void resizeTileSections()
Resize the IPosition member variables used in accessSection() if nrdim_p changes value.
void clearCache(Bool doFlush=True)
Clear the cache, so data will be reread.
size_t nelements() const
The number of elements in this IPosition.
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
IPosition startTile_p
First tile needed.
A column in the Tiled Storage Manager.
virtual void extend(uInt64 nr, const Record &coordValues, const TSMColumn *lastCoordColumn)
Extend the last dimension of the cube with the given number.
TSMShape expandedTileShape_p
Precomputed tileShape information.
File object for Tiled Storage Manager.
void putObject(AipsIO &ios)
Put the data of the object into the AipsIO stream.
A drop-in replacement for Block<T*>.
virtual void resyncCache()
Resync the cache object.
AccessType getLastColAccess() const
Functions for TSMDataColumn to keep track of the last type of access to a hypercube.
const Record & valueRecord() const
Get the record containing the id and coordinate values.
TSMCube & operator=(const TSMCube &)
Forbid assignment.
uInt nrTiles_p
Number of tiles in the hypercube.
IPosition endPixelInFirstTile_p
Last pixel in first tile.
uInt tileSize_p
The tilesize in bytes.
Expanded IPosition for shapes.
BucketCache * cache_p
The bucket cache.
virtual void makeCache()
Construct the cache object (if not constructed yet).
void resize(size_t newSize, bool copy=true)
Old values are copied on resize if copy==true.
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.
TSMFile * filePtr_p
Pointer to the TSMFile object holding the data.
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.
void setLastColSlice(const IPosition &slice)
virtual void deleteCache()
Delete the cache object.
String: the storage and methods of handling collections of characters.
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...
IPosition endTile_p
Last tile needed.
virtual void setShape(const IPosition &cubeShape, const IPosition &tileShape)
Set the hypercube shape.
static char * readCallBack(void *owner, const char *external)
Define the callback functions for the BucketCache.
static void writeCallBack(void *owner, char *external, const char *local)
Record values_p
The values of the possible id and coordinate columns.
void emptyCache()
Empty the cache.
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.
uInt bucketSize_p
The bucket size in bytes (is equal to tile size in bytes).
Block< uInt > externalOffset_p
Offset for each data column in a tile (in external format).
void writeTile(char *external, const char *local)