casacore
|
#include <TableDesc.h>
Public Types | |
enum | TDOption { Old , New , NewNoReplace , Scratch , Update , Delete } |
Public Member Functions | |
TableDesc () | |
The default constructor creates a table description with option = Scratch and a blank name. More... | |
TableDesc (const String &type, TDOption=Old) | |
Create a table description object with the given name. More... | |
TableDesc (const String &type, const String &version, TDOption=Old) | |
Create a table description object with the given name (i.e. More... | |
TableDesc (const String &type, const String &version, const TabPath &, TDOption=Old) | |
Create a table description object. More... | |
TableDesc (const TableDesc &, const String &type, const String &version, TDOption, Bool copyColumns=True) | |
Create a table description object with the given name (i.e. More... | |
TableDesc (const TableDesc &, const String &type, const String &version, const TabPath &, TDOption, Bool copyColumns=True) | |
Create a table description object with the given name (i.e. More... | |
TableDesc (const TableDesc &, TDOption=Scratch) | |
This copy constructor makes a copy of the table description maintaining its name and version. More... | |
~TableDesc () | |
The destructor writes the table description if changed. More... | |
const ColumnDescSet & | columnDescSet () const |
Get access to the set of column descriptions. More... | |
void | add (const TableDesc &other, Bool addKeywordSet=True) |
Add another table description to this table description. More... | |
TableRecord & | rwKeywordSet () |
Get access to the keyword set. More... | |
const TableRecord & | keywordSet () const |
const TableRecord & | privateKeywordSet () const |
Get readonly access to the private set of keywords. More... | |
ColumnDesc & | addColumn (const ColumnDesc &) |
Add a column to the table description. More... | |
ColumnDesc & | addColumn (const ColumnDesc &, const String &newname) |
Add a column to the table description and give it another name. More... | |
void | removeColumn (const String &name) |
Remove a column. More... | |
void | renameColumn (const String &newname, const String &oldname) |
Rename a column. More... | |
uInt | ncolumn () const |
Get number of columns. More... | |
Bool | isColumn (const String &name) const |
Test if a column with this name exists. More... | |
Vector< String > | columnNames () const |
Get a vector containing all column names. More... | |
const ColumnDesc & | columnDesc (const String &name) const |
Get the column description by name or by index. More... | |
const ColumnDesc & | operator[] (const String &name) const |
const ColumnDesc & | columnDesc (uInt index) const |
const ColumnDesc & | operator[] (uInt index) const |
ColumnDesc & | rwColumnDesc (const String &name) |
ColumnDesc & | rwColumnDesc (uInt index) |
const String & | comment () const |
Get comment string. More... | |
String & | comment () |
Get comment string (allowing it to be changed). More... | |
void | show () const |
Show the table description on cout. More... | |
void | show (ostream &os) const |
Show the table description. More... | |
const String & | getType () const |
Get the table type (i.e. More... | |
const String & | version () const |
Get the table description version. More... | |
void | defineHypercolumn (const String &hypercolumnName, uInt ndim, const Vector< String > &dataColumnNames) |
Define a hypercolumn. More... | |
void | defineHypercolumn (const String &hypercolumnName, uInt ndim, const Vector< String > &dataColumnNames, const Vector< String > &coordColumnNames) |
void | defineHypercolumn (const String &hypercolumnName, uInt ndim, const Vector< String > &dataColumnNames, const Vector< String > &coordColumnNames, const Vector< String > &idColumnNames) |
Bool | isHypercolumn (const String &hypercolumnName) const |
Test if the given hypercolumn exists. More... | |
Vector< String > | hypercolumnNames () const |
Get the names of all hypercolumns. More... | |
uInt | hypercolumnDesc (const String &hypercolumnName, Vector< String > &dataColumnNames, Vector< String > &coordColumnNames, Vector< String > &idColumnNames) const |
Get the columns involved in a hypercolumn. More... | |
void | adjustHypercolumns (const std::map< String, String > &old2new, Bool keepUnknownData=False, Bool keepUnknownCoord=False, Bool keppUnknownId=False) |
Adjust the hypercolumn definitions (for a RefTable). More... | |
void | removeIDhypercolumns (const Vector< String > &hcNames) |
Remove ID-columns from the given hypercolumn definitions and set their default data manager type to IncrementalStMan and group to ISM_TSM. More... | |
void | removeHypercolumnDesc (const String &hypercolumnName) |
Remove given hypercolumn definition. More... | |
void | checkSubTableDesc () const |
Check recursively if the descriptions of all subtables are known. More... | |
void | renameHypercolumn (const String &newHypercolumnName, const String &hypercolumnName) |
void | putFile (AipsIO &, const TableAttr &) const |
Put the table description into the file. More... | |
void | getFile (AipsIO &, const TableAttr &) |
Get the table description from the file. More... | |
Static Public Member Functions | |
static Bool | isReadable (const String &tableDescName) |
Test if a description file exists (i.e. More... | |
Private Member Functions | |
TableDesc & | operator= (const TableDesc &) |
Assignment is not supported, because it is impossible to define its semantics. More... | |
void | init (const TabPath &) |
Initialize the table description. More... | |
void | copy (const TableDesc &, const TabPath &, Bool copyColumns) |
Initialize and copy a table description. More... | |
void | throwHypercolumn (const String &hyperColumnName, const String &message) |
Throw an invalid hypercolumn exception. More... | |
Private Attributes | |
String | name_p |
String | vers_p |
String | dir_p |
String | comm_p |
TableRecord * | key_p |
TableRecord * | privKey_p |
ColumnDescSet | col_p |
Bool | swwrite_p |
TDOption | option_p |
AipsIO | iofil_p |
Define the structure of a Casacore table
Public interface
A TableDesc object contains the description, or structure, of a table. This description is required for the creation of a new table.
Descriptions are subsequently associated with every table and embedded in them.
The TableDesc class structure is shown in this UML diagram.
A table description consists of the following items:
A TableDesc object can be constructed with one of the following options:
More information is provided in the Tables module documentation.
A table description specifies the structure, but not the contents, of a Casacore table. Since many tables will have identical structure and different content, it makes good sense to separate structure ("description") from content.
Definition at line 190 of file TableDesc.h.
Enumerator | |
---|---|
Old | |
New | |
NewNoReplace | |
Scratch | |
Update | |
Delete |
Definition at line 195 of file TableDesc.h.
casacore::TableDesc::TableDesc | ( | ) |
The default constructor creates a table description with option = Scratch and a blank name.
Create a table description object with the given name.
This name can be seen as the table type in the same way as a class name is the data type of an object. The name can only be blank when option=Scratch. The default table description path is used for the description file.
Create a table description object with the given name (i.e.
table type) and version. The name can only be blank when option=Scratch. The default table description path is used for the description file.
casacore::TableDesc::TableDesc | ( | const String & | type, |
const String & | version, | ||
const TabPath & | , | ||
TDOption | = Old |
||
) |
Create a table description object.
The given table description path is used for the description file. The name can only be blank with option=Scratch.
casacore::TableDesc::TableDesc | ( | const TableDesc & | , |
const String & | type, | ||
const String & | version, | ||
TDOption | , | ||
Bool | copyColumns = True |
||
) |
Create a table description object with the given name (i.e.
table type) and version by copying the input table description. If the given name or version is blank, it will be copied from the input table description. The default table description path is used for the description file. The only options allowed are New, NewNoReplace and Scratch.
casacore::TableDesc::TableDesc | ( | const TableDesc & | , |
const String & | type, | ||
const String & | version, | ||
const TabPath & | , | ||
TDOption | , | ||
Bool | copyColumns = True |
||
) |
Create a table description object with the given name (i.e.
table type) and version by copying the input table description. If the given name or version is blank, it will be copied from the input table description. The given table description path is used for the description file. The only options allowed are New, NewNoReplace and Scratch.
casacore::TableDesc::~TableDesc | ( | ) |
The destructor writes the table description if changed.
Add another table description to this table description.
It merges the column descriptions, the special keywordSet (containing hypercolumn definitions) and the user keywordSet (this last one is not added if the flag is False). The two table descriptions have to be disjoint, i.e. no column nor keyword should already exist. Otherwise an TableInvOper exception is thrown and nothing gets added.
|
inline |
Add a column to the table description.
An exception is thrown if a keyword or column with this name already exists. Although this function has a ColumnDesc
as argument, it is usually needed to construct a more specialized object like ArrayColumnDesc<float>
. A ColumnDesc
constructor converts that automatically to a ColumnDesc
object.
On the other hand this function can also be used to add a column description from another table as in:
Definition at line 571 of file TableDesc.h.
References casacore::ColumnDescSet::addColumn(), and col_p.
|
inline |
Add a column to the table description and give it another name.
This may be useful to use a description of another column.
Definition at line 574 of file TableDesc.h.
References casacore::ColumnDescSet::addColumn(), and col_p.
void casacore::TableDesc::adjustHypercolumns | ( | const std::map< String, String > & | old2new, |
Bool | keepUnknownData = False , |
||
Bool | keepUnknownCoord = False , |
||
Bool | keppUnknownId = False |
||
) |
Adjust the hypercolumn definitions (for a RefTable).
It removes and/or renames columns as necessary. Column names which are not part of the map are removed if keepUnknown==False
. If all data columns of a hypercolumn are removed, the entire hypercolumn is removed.
|
inline |
Check recursively if the descriptions of all subtables are known.
Definition at line 589 of file TableDesc.h.
References casacore::ColumnDescSet::checkSubTableDesc(), and col_p.
|
inline |
Get the column description by name or by index.
An exception is thrown if the column does not exist. Function isColumn should be used to test if a column exists.
Definition at line 536 of file TableDesc.h.
References col_p.
|
inline |
Definition at line 540 of file TableDesc.h.
References col_p.
|
inline |
Get access to the set of column descriptions.
In this way const ColumnDescSet functions (e.g. isDisjoint) can be used.
Definition at line 567 of file TableDesc.h.
References col_p.
|
inline |
Get comment string (allowing it to be changed).
Definition at line 586 of file TableDesc.h.
References comm_p.
|
inline |
Initialize and copy a table description.
void casacore::TableDesc::defineHypercolumn | ( | const String & | hypercolumnName, |
uInt | ndim, | ||
const Vector< String > & | dataColumnNames | ||
) |
Define a hypercolumn.
A hypercolumn is a group of one or more data columns of which the data is treated as one or more (regular) hypercubes. The hypercolumn has coordinate axes (e.g. time, frequency) which are columns in the table. When the entire hypercolumn consists of multiple hypercubes, ID-columns can be defined, which uniquely determine the hypercube to be used. Note that only TiledDataStMan requires the use of ID-columns. A hypercolumn definition is needed to be able to use a Tiled Storage Manager.
The following has to be specified:
It will be checked if the given columns exists and have an appropriate type.
The default data manager type of the columns involved will be set to TiledColumnStMan if all data columns have a fixed shape. Otherwise they are set to TiledShapeStMan. The storage manager group of all columns involved will be set to the hypercolumn name. In that way binding columns to storage managers during the table creation process is easier because a simple bindGroup
can be used.
For example:
A table contains data matrices with axes pol and freq. Those axes are defined in columns pol and freq containing vectors with the same length as the corresponding axis. The table also contains scalar columns time and baseline, which superimpose dimensions upon the data. So the data will be stored in a 4-d hypercube with axes pol,freq,time,baseline. It would be defined as follows:
Note that the function stringToVector is very convenient for creating a vector of Strings.
void casacore::TableDesc::defineHypercolumn | ( | const String & | hypercolumnName, |
uInt | ndim, | ||
const Vector< String > & | dataColumnNames, | ||
const Vector< String > & | coordColumnNames | ||
) |
void casacore::TableDesc::defineHypercolumn | ( | const String & | hypercolumnName, |
uInt | ndim, | ||
const Vector< String > & | dataColumnNames, | ||
const Vector< String > & | coordColumnNames, | ||
const Vector< String > & | idColumnNames | ||
) |
Get the table description from the file.
|
inline |
Get the table type (i.e.
name of table description).
Definition at line 551 of file TableDesc.h.
References name_p.
uInt casacore::TableDesc::hypercolumnDesc | ( | const String & | hypercolumnName, |
Vector< String > & | dataColumnNames, | ||
Vector< String > & | coordColumnNames, | ||
Vector< String > & | idColumnNames | ||
) | const |
Get the columns involved in a hypercolumn.
It returns the dimensionality of the hypercolumn. An exception is thrown if the hypercolumn does not exist.
|
private |
Initialize the table description.
Test if a column with this name exists.
Definition at line 532 of file TableDesc.h.
References col_p, and casacore::ColumnDescSet::isDefined().
Test if the given hypercolumn exists.
Test if a description file exists (i.e.
isReadable).
|
inline |
Definition at line 561 of file TableDesc.h.
References key_p.
|
inline |
Get number of columns.
Definition at line 528 of file TableDesc.h.
References col_p, and casacore::ColumnDescSet::ncolumn().
Assignment is not supported, because it is impossible to define its semantics.
Does the data need to be written into a file before being overwritten? Declaring it private, makes it unusable.
|
inline |
Definition at line 538 of file TableDesc.h.
References col_p.
|
inline |
Definition at line 542 of file TableDesc.h.
References col_p.
|
inline |
Get readonly access to the private set of keywords.
Definition at line 563 of file TableDesc.h.
References privKey_p.
|
inline |
Remove a column.
An exception is thrown if the column does not exist.
Definition at line 579 of file TableDesc.h.
References col_p, and casacore::ColumnDescSet::remove().
void casacore::TableDesc::removeHypercolumnDesc | ( | const String & | hypercolumnName | ) |
Remove given hypercolumn definition.
An exception is thrown if it is not a hypercolumn.
Remove ID-columns from the given hypercolumn definitions and set their default data manager type to IncrementalStMan and group to ISM_TSM.
Rename a column.
An exception is thrown if the old name does not exist or if the name already exists.
Caution: Renaming a column should be done with care, because other columns may be referring this column; Also a hypercolumn definition might be using the old name;
void casacore::TableDesc::renameHypercolumn | ( | const String & | newHypercolumnName, |
const String & | hypercolumnName | ||
) |
|
inline |
Definition at line 544 of file TableDesc.h.
References col_p.
|
inline |
Definition at line 546 of file TableDesc.h.
References col_p.
|
inline |
void casacore::TableDesc::show | ( | ) | const |
Show the table description on cout.
void casacore::TableDesc::show | ( | ostream & | os | ) | const |
Show the table description.
|
private |
Throw an invalid hypercolumn exception.
|
inline |
|
private |
Definition at line 494 of file TableDesc.h.
Referenced by addColumn(), checkSubTableDesc(), columnDesc(), columnDescSet(), isColumn(), ncolumn(), operator[](), removeColumn(), and rwColumnDesc().
|
private |
Definition at line 489 of file TableDesc.h.
Referenced by comment().
|
private |
Definition at line 488 of file TableDesc.h.
|
private |
Definition at line 497 of file TableDesc.h.
|
private |
Definition at line 492 of file TableDesc.h.
Referenced by keywordSet(), and rwKeywordSet().
|
private |
Definition at line 486 of file TableDesc.h.
Referenced by getType().
|
private |
Definition at line 496 of file TableDesc.h.
|
private |
Definition at line 493 of file TableDesc.h.
Referenced by privateKeywordSet().
|
private |
Definition at line 495 of file TableDesc.h.
|
private |
Definition at line 487 of file TableDesc.h.
Referenced by version().