casa
$Rev:20696$
|
Class with static functions for copying a table. More...
#include <TableCopy.h>
Static Public Member Functions | |
static Table | makeEmptyTable (const String &newName, const Record &dataManagerInfo, const Table &tab, Table::TableOption option, Table::EndianFormat endianFormat, Bool replaceTSM=True, Bool noRows=False) |
Make an (empty) table with the given description. | |
static Table | makeEmptyMemoryTable (const String &newName, const Table &tab, Bool noRows=False) |
Make an (empty) memory table with the same layout as the input one. | |
static void | copyRows (Table &out, const Table &in, Bool flush=True) |
Copy rows from the input to the output. | |
static void | copyRows (Table &out, const Table &in, uInt startout, uInt startin, uInt nrrow, Bool flush=True) |
static void | copyInfo (Table &out, const Table &in) |
Copy the table info block from input to output table. | |
static void | copySubTables (Table &out, const Table &in, Bool noRows=False, const Block< String > &omit=Block< String >()) |
Copy all subtables (in table and column keywords) from input to output table. | |
static void | copySubTables (TableRecord &outKeys, const TableRecord &inKeys, const String &outName, Table::TableType outType, const Table &in, Bool noRows=False, const Block< String > &omit=Block< String >()) |
Copy the subtables in the given keywordset to the output keywordset in the table with the given name. | |
static void | adjustTSM (TableDesc &tabDesc, Record &dminfo) |
Replace TiledDataStMan by TiledShapeStMan in the DataManagerInfo record. | |
static Record | adjustStMan (const Record &dminfo) |
Replace non-writable storage managers by StandardStMan. | |
static void | setTiledStMan (Record &dminfo, const Vector< String > &columns, const String &dmType, const String &dmName, const IPosition &defaultTileShape) |
Set the data managers of the given column(s) to the given tiled storage manager (normally TiledShapeStMan or TiledColumnStMan). | |
static Vector< String > | removeDminfoColumns (Record &dminfo, const Vector< String > &columns, const String &keepType=String()) |
Remove the columns from the dminfo record and return a vector with the names of the columns actually removed. | |
static void | adjustDesc (TableDesc &tabDesc, const Record &dminfo) |
Adjust the data manager types and groups and the hypercolumn definitions to the actual data manager info. |
Class with static functions for copying a table.
Public interface
TableCopy is a class for making a deep copy of a table. The table can be a PlainTable or a RefTable. It contains the following static functions:
makeEmptyTable
creates a new table using the description and storage managers of the input table. By default TiledDataStMan (which is more or less obsolete) will be replaced by TiledShapeStMan. By default the new table contains the same number of rows as the existing table. copyRows
copies the data of one to another table. It is possible to specify where to start in the input and output. CopyInfo
copies the table info data. copySubTables
copies all the subtables in table and column keywords. It is done recursively. Definition at line 77 of file TableCopy.h.
static void casa::TableCopy::adjustDesc | ( | TableDesc & | tabDesc, |
const Record & | dminfo | ||
) | [inline, static] |
Adjust the data manager types and groups and the hypercolumn definitions to the actual data manager info.
Definition at line 179 of file TableCopy.h.
static Record casa::TableCopy::adjustStMan | ( | const Record & | dminfo | ) | [inline, static] |
Replace non-writable storage managers by StandardStMan.
This is needed for special storage managers like LofarStMan.
Definition at line 153 of file TableCopy.h.
static void casa::TableCopy::adjustTSM | ( | TableDesc & | tabDesc, |
Record & | dminfo | ||
) | [inline, static] |
Replace TiledDataStMan by TiledShapeStMan in the DataManagerInfo record.
Since TiledShapeStMan does not support ID columns, they are adjusted as well in tabDesc and dminfo.
Definition at line 148 of file TableCopy.h.
static void casa::TableCopy::copyInfo | ( | Table & | out, |
const Table & | in | ||
) | [static] |
Copy the table info block from input to output table.
static void casa::TableCopy::copyRows | ( | Table & | out, |
const Table & | in, | ||
Bool | flush = True |
||
) | [inline, static] |
Copy rows from the input to the output.
By default all rows will be copied starting at row 0 of the output. Rows will be added to the output table as needed. The output table will by default be flushed after the rows are copied.
All columns in Table out
will be filled from the column with the same name in table in
. In principle only stored columns will be filled; however if the output table has only one column, it can also be a virtual one.
Definition at line 116 of file TableCopy.h.
References copyRows(), and casa::Table::nrow().
Referenced by copyRows().
static void casa::TableCopy::copyRows | ( | Table & | out, |
const Table & | in, | ||
uInt | startout, | ||
uInt | startin, | ||
uInt | nrrow, | ||
Bool | flush = True |
||
) | [static] |
static void casa::TableCopy::copySubTables | ( | Table & | out, |
const Table & | in, | ||
Bool | noRows = False , |
||
const Block< String > & | omit = Block< String >() |
||
) | [static] |
Copy all subtables (in table and column keywords) from input to output table.
Subtables of which the keyword name matches an omit value are skipped. Optionally the row contents are not copied.
static void casa::TableCopy::copySubTables | ( | TableRecord & | outKeys, |
const TableRecord & | inKeys, | ||
const String & | outName, | ||
Table::TableType | outType, | ||
const Table & | in, | ||
Bool | noRows = False , |
||
const Block< String > & | omit = Block< String >() |
||
) | [static] |
Copy the subtables in the given keywordset to the output keywordset in the table with the given name.
Subtables of which the keyword name matches an omit value are skipped. Optionally the row contents are not copied.
static Table casa::TableCopy::makeEmptyMemoryTable | ( | const String & | newName, |
const Table & | tab, | ||
Bool | noRows = False |
||
) | [static] |
Make an (empty) memory table with the same layout as the input one.
It has the same keywords and columns as the input one. By default, the new table has the same nr of rows as the input table. If noRows=True
is given, it does not contain any row.
static Table casa::TableCopy::makeEmptyTable | ( | const String & | newName, |
const Record & | dataManagerInfo, | ||
const Table & | tab, | ||
Table::TableOption | option, | ||
Table::EndianFormat | endianFormat, | ||
Bool | replaceTSM = True , |
||
Bool | noRows = False |
||
) | [static] |
Make an (empty) table with the given description.
If the description contains no columns, the description of the input table is used, so it has the same keywords and columns as the input one. The data managers can be given in the dataManagerInfo record. If it is empty, the info is taken from the input table.
Non-writable storage managers (like LofarStMan) are by default replaced by StandardStMan. If replaceMSM
is set, MemoryStMan is also replaced by StandardStMan.
By default, the TiledDataStMan will be replaced by the TiledShapeStMan.
By default, the new table has the same nr of rows as the input table. If noRows=True
is given, it does not contain any row.
static Vector<String> casa::TableCopy::removeDminfoColumns | ( | Record & | dminfo, |
const Vector< String > & | columns, | ||
const String & | keepType = String() |
||
) | [inline, static] |
Remove the columns from the dminfo record and return a vector with the names of the columns actually removed.
The columns having a data manager matching keepType
are not removed. Matching means that the beginning of the data manager name have to match, so "Tiled" matches all tiled storagemanagers.
Definition at line 172 of file TableCopy.h.
static void casa::TableCopy::setTiledStMan | ( | Record & | dminfo, |
const Vector< String > & | columns, | ||
const String & | dmType, | ||
const String & | dmName, | ||
const IPosition & | defaultTileShape | ||
) | [inline, static] |
Set the data managers of the given column(s) to the given tiled storage manager (normally TiledShapeStMan or TiledColumnStMan).
The columns are combined in a single storage manager, so the function has to be called multiple times if, say, one per column is needed. The columns already having a tiled storage manager are not changed.
Definition at line 161 of file TableCopy.h.