casa
$Rev:20696$
|
Tiled Cell Storage Manager. More...
#include <TiledCellStMan.h>
Public Member Functions | |
TiledCellStMan (const String &hypercolumnName, const IPosition &defaultTileShape, uInt maximumCacheSize=0) | |
Create a TiledDataStMan storage manager for the hypercolumn with the given name. | |
TiledCellStMan (const String &hypercolumnName, const Record &spec) | |
~TiledCellStMan () | |
DataManager * | clone () const |
Clone this object. | |
String | dataManagerType () const |
Get the type name of the data manager (i.e. | |
Bool | canChangeShape () const |
This tiled storage manager can handle changing array shapes. | |
virtual void | setShape (uInt rownr, TSMCube *hypercube, const IPosition &shape, const IPosition &tileShape) |
Set the shape and tile shape of the hypercube. | |
Static Public Member Functions | |
static DataManager * | makeObject (const String &dataManagerType, const Record &spec) |
Make the object from the type name string. | |
Private Member Functions | |
TiledCellStMan () | |
Create a TiledCellStMan. | |
TiledCellStMan (const TiledCellStMan &) | |
Forbid copy constructor. | |
TiledCellStMan & | operator= (const TiledCellStMan &) |
Forbid assignment. | |
virtual IPosition | defaultTileShape () const |
Get the default tile shape. | |
void | addRow (uInt nrrow) |
Add rows to the storage manager. | |
virtual TSMCube * | getHypercube (uInt rownr) |
Get the hypercube in which the given row is stored. | |
virtual TSMCube * | getHypercube (uInt rownr, IPosition &position) |
Get the hypercube in which the given row is stored. | |
virtual void | setupCheck (const TableDesc &tableDesc, const Vector< String > &dataNames) const |
Check if the hypercolumn definition fits this storage manager. | |
virtual Bool | flush (AipsIO &, Bool fsync) |
Flush and optionally fsync the data. | |
virtual void | create (uInt nrrow) |
Let the storage manager create files as needed for a new table. | |
virtual void | readHeader (uInt nrrow, Bool firstTime) |
Read the header info. | |
Private Attributes | |
IPosition | defaultTileShape_p |
Tiled Cell Storage Manager.
Public interface
TiledCellStMan is the Tiled Storage Manager storing each cell as a separate hypercube.
TiledCellStMan is a derivation from TiledStMan, the abstract tiled storage manager class. A description of the basics of tiled storage managers is given in the Tables module description.
TiledCellStMan allows the user to create a tiled hypercube for each data cell in an automatic way. It is meant to be used for storing regularly shaped data like images (where the table contains a possibly differently shaped image in each row).
The TiledCellStMan has the following (extra) properties:
This tiled storage manager does not require any special action (like calling add/extendHypercube) when used with a column containing variable shaped arrays.
// Define the table description and the columns in it. TableDesc td ("", "1", TableDesc::Scratch); td.addColumn (ArrayColumnDesc<float> ("RA", 1)); td.addColumn (ArrayColumnDesc<float> ("Dec", 1)); td.addColumn (ArrayColumnDesc<float> ("Velocity", 1)); td.addColumn (ArrayColumnDesc<float> ("Image", 3)); // Define the 3-dim hypercolumn with its data and coordinate columns. // Note that its dimensionality must match the dimensionality // of the data cells. td.defineHypercolumn ("TSMExample", 3, stringToVector ("Image"), stringToVector ("RA,Dec,Velocity")); // Now create a new table from the description. SetupNewTable newtab("tTiledCellStMan_tmp.data", td, Table::New); // Create a TiledCellStMan storage manager for the hypercolumn // and bind the columns to it. TiledCellStMan sm1 ("TSMExample"); newtab.bindAll (sm1); // Create the table. Table table(newtab); // Define the values for the coordinates of the hypercube. Vector<float> raValues(512); Vector<float> DecValues(512); Vector<float> VelocityValues(64); indgen (raValues); indgen (decValues, float(100)); indgen (velocityValues, float(200)); ArrayColumn<float> ra (table, "RA"); ArrayColumn<float> dec (table, "Dec"); ArrayColumn<float> velocity (table, "Velocity"); ArrayColumn<float> image (table, "Image"); Cube<float> imageValues(IPosition(3,512,512,64)); indgen (imageValues); // Write some data into the data columns. uInt i; for (i=0; i<4; i++) { table.addRow(); image.put (i, imageValues); ra.put (i, raValues); dec.put (i, decValues); velocity.put (i, velocityValues); }
Definition at line 157 of file TiledCellStMan.h.
casa::TiledCellStMan::TiledCellStMan | ( | const String & | hypercolumnName, |
const IPosition & | defaultTileShape, | ||
uInt | maximumCacheSize = 0 |
||
) |
Create a TiledDataStMan storage manager for the hypercolumn with the given name.
The columns used should have the FixedShape attribute set. The hypercolumn name is also the name of the storage manager. The given tile shape will be used as the default for the hypercube in each cell. Per cell it can be redefined via ArrayColumn::setShape. The given maximum cache size (default is unlimited) is persistent, thus will be reused when the table is read back. Note that the class ROTiledStManAccessor allows one to overwrite the maximum cache size temporarily. Its description contains a discussion about the effects of setting a maximum cache.
The constructor taking a Record expects fields in the record with the name of the arguments in uppercase. If not defined, their default value is used.
casa::TiledCellStMan::TiledCellStMan | ( | const String & | hypercolumnName, |
const Record & | spec | ||
) |
casa::TiledCellStMan::TiledCellStMan | ( | ) | [private] |
Create a TiledCellStMan.
This constructor is private, because it should only be used by makeObject.
casa::TiledCellStMan::TiledCellStMan | ( | const TiledCellStMan & | ) | [private] |
Forbid copy constructor.
void casa::TiledCellStMan::addRow | ( | uInt | nrrow | ) | [private, virtual] |
Add rows to the storage manager.
Reimplemented from casa::DataManager.
Bool casa::TiledCellStMan::canChangeShape | ( | ) | const [virtual] |
This tiled storage manager can handle changing array shapes.
Reimplemented from casa::TiledStMan.
DataManager* casa::TiledCellStMan::clone | ( | ) | const [virtual] |
virtual void casa::TiledCellStMan::create | ( | uInt | nrrow | ) | [private, virtual] |
Let the storage manager create files as needed for a new table.
This allows a column with an indirect array to create its file.
Implements casa::DataManager.
String casa::TiledCellStMan::dataManagerType | ( | ) | const [virtual] |
virtual IPosition casa::TiledCellStMan::defaultTileShape | ( | ) | const [private, virtual] |
Get the default tile shape.
Reimplemented from casa::TiledStMan.
virtual Bool casa::TiledCellStMan::flush | ( | AipsIO & | , |
Bool | fsync | ||
) | [private, virtual] |
Flush and optionally fsync the data.
It returns a True status if it had to flush (i.e. if data have changed).
Implements casa::DataManager.
virtual TSMCube* casa::TiledCellStMan::getHypercube | ( | uInt | rownr | ) | [private, virtual] |
Get the hypercube in which the given row is stored.
Implements casa::TiledStMan.
virtual TSMCube* casa::TiledCellStMan::getHypercube | ( | uInt | rownr, |
IPosition & | position | ||
) | [private, virtual] |
Get the hypercube in which the given row is stored.
It also returns the position of the row in that hypercube.
Implements casa::TiledStMan.
static DataManager* casa::TiledCellStMan::makeObject | ( | const String & | dataManagerType, |
const Record & | spec | ||
) | [static] |
Make the object from the type name string.
This function gets registered in the DataManager "constructor" map.
TiledCellStMan& casa::TiledCellStMan::operator= | ( | const TiledCellStMan & | ) | [private] |
Forbid assignment.
virtual void casa::TiledCellStMan::readHeader | ( | uInt | nrrow, |
Bool | firstTime | ||
) | [private, virtual] |
Read the header info.
Implements casa::TiledStMan.
virtual void casa::TiledCellStMan::setShape | ( | uInt | rownr, |
TSMCube * | hypercube, | ||
const IPosition & | shape, | ||
const IPosition & | tileShape | ||
) | [virtual] |
Set the shape and tile shape of the hypercube.
Reimplemented from casa::TiledStMan.
virtual void casa::TiledCellStMan::setupCheck | ( | const TableDesc & | tableDesc, |
const Vector< String > & | dataNames | ||
) | const [private, virtual] |
Check if the hypercolumn definition fits this storage manager.
Reimplemented from casa::TiledStMan.
Definition at line 247 of file TiledCellStMan.h.