Loading...
Searching...
No Matches
casacore::TSMCubeBuff Class Reference
tables package (libcasa_tables) » DataMan_module » DataMan_module_internal_classes

More...

`#include <TSMCubeBuff.h>`

## Public Member Functions

| TSMCubeBuff (TiledStMan *stman, TSMFile *file, const IPosition &cubeShape, const IPosition &tileShape, const Record &values, Int64 fileOffset)
| Construct the hypercube using the given file with the given shape.
| TSMCubeBuff (TiledStMan *stman, AipsIO &ios)
| Reconstruct the hypercube by reading its data from the AipsIO stream.
| ~TSMCubeBuff () override=default
| TSMCubeBuff (const TSMCubeBuff &)=delete
| Forbid copy constructor.
TSMCubeBuff & | operator= (const TSMCubeBuff &)=delete
| Forbid assignment.
virtual void | flushCache () override
| Flush the data in the cache.
void | showCacheStatistics (ostream &os) const override
| Show the cache statistics.
void | setShape (const IPosition &cubeShape, const IPosition &tileShape) override
| Set the hypercube shape.
void | extend (uInt64 nr, const Record &coordValues, const TSMColumn *lastCoordColumn) override
| Extend the last dimension of the cube with the given number.
void | accessSection (const IPosition &start, const IPosition &end, char *section, uInt colnr, uInt localPixelSize, uInt externalPixelSize, Bool writeFlag) override
| Read or write a section in the cube.
void | accessStrided (const IPosition &start, const IPosition &end, const IPosition &stride, char *section, uInt colnr, uInt localPixelSize, uInt externalPixelSize, Bool writeFlag) override
| Read or write a section in a strided way.
void | setCacheSize (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, Bool forceSmaller, Bool userSet) override
| Set the cache size for the given slice and access path.
void | setCacheSize (uInt cacheSize, Bool forceSmaller, Bool userSet) override
| Resize the cache object.
Public Member Functions inherited from casacore::TSMCube
| 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.
| TSMCube (TiledStMan *stman, AipsIO &ios, Bool useDerived=False)
| Reconstruct the hypercube by reading its data from the AipsIO stream.
virtual | ~TSMCube ()
| TSMCube (const TSMCube &)=delete
| Forbid copy constructor.
TSMCube & | operator= (const TSMCube &)=delete
| Forbid assignment.
void | clearCache (Bool doFlush=True)
| Clear the cache, so data will be reread.
void | emptyCache ()
| Empty the cache.
void | putObject (AipsIO &ios)
| Put the data of the object into the AipsIO stream.
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.
Bool | isExtensible () const
| Is the hypercube extensible?
uInt | bucketSize () const
| Get the bucket size (bytes).
uInt | localTileLength () const
| Get the length of a tile (in bytes) in local format.
const IPosition & | cubeShape () const
| Get the shape of the hypercube.
const IPosition & | tileShape () const
| Get the shape of the tiles.
IPosition | cellShape () const
| Get the shape of the data cells in the cube.
uInt | coordinateSize (const String &coordinateName) const
| Get the size of a coordinate (i.e.
const Record & | valueRecord () const
| Get the record containing the id and coordinate values.
Record & | rwValueRecord ()
Bool | matches (const PtrBlock< TSMColumn * > &idColSet, const Record &idValues)
| Test if the id values match.
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).
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 | validateCacheSize (uInt cacheSize) const
| Validate the cache size (in buckets).
Bool | userSetCache () const
| Determine if the user set the cache size (using setCacheSize).
AccessType | getLastColAccess () const
| Functions for TSMDataColumn to keep track of the last type of access to a hypercube.
const IPosition & | getLastColSlice () const
void | setLastColAccess (AccessType type)
void | setLastColSlice (const IPosition &slice)

## Private Member Functions

BucketBuffered * | getCache ()
| Get the cache object.
void | makeCache () override
| Construct the cache object (if not constructed yet).
void | resyncCache () override
| Resync the cache object.
void | deleteCache () override
| Delete the cache object.

## Private Attributes

std::unique_ptr< BucketBuffered > | cache_p
| The bucket cache.

## Additional Inherited Members

Public Types inherited from casacore::TSMCube
enum | AccessType { NoAccess , CellAccess , SliceAccess , ColumnAccess , ColumnSliceAccess }
| Define the possible access types for TSMDataColumn. More...
Static Public Member Functions inherited from casacore::TSMCube
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)
static uInt | validateCacheSize (uInt cacheSize, uInt maxSizeMiB, uInt bucketSize)
Protected Member Functions inherited from casacore::TSMCube
void | setup ()
| Initialize the various variables.
void | setupNrTiles ()
IPosition | adjustTileShape (const IPosition &cubeShape, const IPosition &tileShape) const
| Adjust the tile shape to the hypercube shape.
void | resizeTileSections ()
| Resize the IPosition member variables used in accessSection() if nrdim_p changes value.
Protected Attributes inherited from casacore::TSMCube
char * | cachedTile_p
TiledStMan * | stmanPtr_p
| Pointer to the parent storage manager.
Bool | useDerived_p
| Is the class used directly or only by a derived class only?
Record | values_p
| The values of the possible id and coordinate columns.
Bool | extensible_p
| Is the hypercube extensible?
uInt | nrdim_p
| Dimensionality of the hypercube.
uInt | nrTiles_p
| Number of tiles in the hypercube.
IPosition | cubeShape_p
| The shape of the hypercube.
IPosition | tileShape_p
| The shape of the tiles in the hypercube.
IPosition | tilesPerDim_p
| The number of tiles in each hypercube dimension.
TSMShape | expandedTileShape_p
| Precomputed tileShape information.
TSMShape | expandedTilesPerDim_p
| Precomputed tilesPerDim information.
uInt | nrTilesSubCube_p
| Number of tiles in all but last dimension (used when extending).
uInt | tileSize_p
| The tilesize in bytes.
TSMFile * | filePtr_p
| Pointer to the TSMFile object holding the data.
Int64 | fileOffset_p
| Offset in the TSMFile object where the data of this hypercube starts.
Block< uInt > | externalOffset_p
| Offset for each data column in a tile (in external format).
Block< uInt > | localOffset_p
| Offset for each data column in a tile (in local format).
uInt | bucketSize_p
| The bucket size in bytes (is equal to tile size in bytes).
uInt | localTileLength_p
| The tile size in bytes in local format.
BucketCache * | cache_p
| The bucket cache.
Bool | userSetCache_p
| Did the user set the cache size?
AccessType | lastColAccess_p
| Was the last column access to a cell, slice, or column?
IPosition | lastColSlice_p
| The slice shape of the last column access to a slice.
IPosition | nrTileSection_p
| IPosition variables used in accessSection(); declared here as member variables to avoid significant construction and desctruction overhead if they are local to accessSection() #tiles needed for the section.
IPosition | startTile_p
| First tile needed.
IPosition | endTile_p
| Last tile needed.
IPosition | startPixelInFirstTile_p
| First pixel in first tile.
IPosition | endPixelInFirstTile_p
| Last pixel in first tile.
IPosition | endPixelInLastTile_p
| Last pixel in last tile.

## Detailed Description

Tiled hypercube in a table

### Intended use:

Internal

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

### Prerequisite

- TiledStMan
- ROTiledStManAccessor for a discussion of the maximum cache size
- TSMFile
- BucketBuffered

### Etymology

TSMCubeBuff represents a hypercube in the Tiled Storage Manager.

### Synopsis

TSMCubeBuff defines a tiled hypercube. The data is stored in a TSMFile object and accessed using a BucketBuffered object. The hypercube can be extensible in its last dimension to support tables with a size which is not known in advance.
Normally hypercubes share the same TSMFile object, but extensible hypercubes have their own TSMFile object (to be extensible). If the hypercolumn has multiple data columns, their cells share the same tiles. Per tile data column A appears first, thereafter B, etc..
The data in the cache is held in external format and is converted when accessed. The alternative would be to hold it in the cache in local format and convert it when read/written from the file. It was felt that the latter approach would generate more needless conversions.

The possible id and coordinate values are stored in a Record object. They are written in the main hypercube AipsIO file.

TSMCubeBuff uses the maximum cache size set for a Tiled Storage manager. The description of class ROTiledStManAccessor contains a discussion about the effect of setting the maximum cache size.

### Motivation

TSMCubeBuff encapsulates all operations on a hypercube.

Definition at line 95 of file TSMCubeBuff.h.

## Constructor & Destructor Documentation

## TSMCubeBuff() [1/3]

casacore::TSMCubeBuff::TSMCubeBuff | ( | TiledStMan * | stman,
|  | TSMFile * | file,
|  | const IPosition & | cubeShape,
|  | const IPosition & | tileShape,
|  | const Record & | values,
|  | Int64 | fileOffset )

Construct the hypercube using the given file with the given shape.

The record contains the id and possible coordinate values.
If the cubeshape is empty, the hypercube is still undefined and can be added later with setShape. That is only used by TiledCellStMan.
The fileOffset argument is meant for class TiledFileAccess.

References casacore::TSMCube::cubeShape(), casacore::Record(), and casacore::TSMCube::tileShape().

Referenced by operator=(), and TSMCubeBuff().

## TSMCubeBuff() [2/3]

casacore::TSMCubeBuff::TSMCubeBuff | ( | TiledStMan * | stman,
|  | AipsIO & | ios )

Reconstruct the hypercube by reading its data from the AipsIO stream.

It will link itself to the correct TSMFile. The TSMFile objects must have been reconstructed in advance.

## ~TSMCubeBuff()

casacore::TSMCubeBuff::~TSMCubeBuff | ( |  | ) |

override default

## TSMCubeBuff() [3/3]

casacore::TSMCubeBuff::TSMCubeBuff | ( | const TSMCubeBuff & |  | ) |

delete

Forbid copy constructor.

References TSMCubeBuff().

## Member Function Documentation

## accessSection()

void casacore::TSMCubeBuff::accessSection | ( | const IPosition & | start,
|  | const IPosition & | end,
|  | char * | section,
|  | uInt | colnr,
|  | uInt | localPixelSize,
|  | uInt | externalPixelSize,
|  | Bool | writeFlag )

override virtual

Read or write a section in the cube.

It is assumed that the section buffer is long enough.

Reimplemented from casacore::TSMCube.

## accessStrided()

void casacore::TSMCubeBuff::accessStrided | ( | const IPosition & | start,
|  | const IPosition & | end,
|  | const IPosition & | stride,
|  | char * | section,
|  | uInt | colnr,
|  | uInt | localPixelSize,
|  | uInt | externalPixelSize,
|  | Bool | writeFlag )

override virtual

Read or write a section in a strided way.

It is assumed that the section buffer is long enough.

Reimplemented from casacore::TSMCube.

## deleteCache()

void casacore::TSMCubeBuff::deleteCache | ( |  | ) |

override private virtual

Delete the cache object.

Reimplemented from casacore::TSMCube.

## extend()

void casacore::TSMCubeBuff::extend | ( | uInt64 | nr,
|  | const Record & | coordValues,
|  | const TSMColumn * | lastCoordColumn )

override virtual

Extend the last dimension of the cube with the given number.

The record can contain the coordinates of the elements added.

Reimplemented from casacore::TSMCube.

References casacore::Record().

## flushCache()

virtual void casacore::TSMCubeBuff::flushCache | ( |  | ) |

override virtual

Flush the data in the cache.

Reimplemented from casacore::TSMCube.

## getCache()

BucketBuffered * casacore::TSMCubeBuff::getCache | ( |  | ) |

inline private

Get the cache object.

This will construct the cache object if not present yet.

Definition at line 189 of file TSMCubeBuff.h.

References cache_p, and makeCache().

## makeCache()

void casacore::TSMCubeBuff::makeCache | ( |  | ) |

override private virtual

Construct the cache object (if not constructed yet).

Reimplemented from casacore::TSMCube.

Referenced by getCache().

## operator=()

TSMCubeBuff & casacore::TSMCubeBuff::operator= | ( | const TSMCubeBuff & |  | ) |

delete

Forbid assignment.

References TSMCubeBuff().

## resyncCache()

void casacore::TSMCubeBuff::resyncCache | ( |  | ) |

override private virtual

Resync the cache object.

Reimplemented from casacore::TSMCube.

## setCacheSize() [1/2]

void casacore::TSMCubeBuff::setCacheSize | ( | const IPosition & | sliceShape,
|  | const IPosition & | windowStart,
|  | const IPosition & | windowLength,
|  | const IPosition & | axisPath,
|  | Bool | forceSmaller,
|  | Bool | userSet )

override virtual

Set the cache size for the given slice and access path.

Reimplemented from casacore::TSMCube.

## setCacheSize() [2/2]

void casacore::TSMCubeBuff::setCacheSize | ( | uInt | cacheSize,
|  | Bool | forceSmaller,
|  | Bool | userSet )

override virtual

Resize the cache object.

If forceSmaller is False, the cache will only be resized when it grows. If the given size exceeds the maximum size with more than 10%, the maximum size will be used. The cacheSize has to be given in buckets.
The flag userSet inidicates if the cache size is set by the user (by an Accessor object) or automatically (by TSMDataColumn).

Reimplemented from casacore::TSMCube.

References casacore::TSMCube::cacheSize().

## setShape()

void casacore::TSMCubeBuff::setShape | ( | const IPosition & | cubeShape,
|  | const IPosition & | tileShape )

override virtual

Set the hypercube shape.

This is only possible if the shape was not defined yet.

Reimplemented from casacore::TSMCube.

References casacore::TSMCube::cubeShape(), and casacore::TSMCube::tileShape().

## showCacheStatistics()

void casacore::TSMCubeBuff::showCacheStatistics | ( | ostream & | os | ) | const

override virtual

Show the cache statistics.

Reimplemented from casacore::TSMCube.

## Member Data Documentation

## cache_p

std::unique_ptr<BucketBuffered> casacore::TSMCubeBuff::cache_p

private

The bucket cache.

Definition at line 184 of file TSMCubeBuff.h.

Referenced by getCache().

The documentation for this class was generated from the following file:

- tables/DataMan/TSMCubeBuff.h