casa
5.7.0-16
|
Virtual scalar column using TaQL. More...
#include <VirtualTaQLColumn.h>
Public Member Functions | |
VirtualTaQLColumn (const String &expr) | |
Construct it with the given TaQL expression. More... | |
VirtualTaQLColumn (const Record &spec) | |
Construct it with the given specification. More... | |
virtual | ~VirtualTaQLColumn () |
Destructor is mandatory. More... | |
virtual DataManager * | clone () const |
Clone the engine object. More... | |
virtual Record | dataManagerSpec () const |
Get the data manager specification. More... | |
virtual String | dataManagerType () const |
Return the type name of the engine. More... | |
const String & | expression () const |
Return the TaQL expression used. More... | |
virtual int | dataType () const |
Functions to return column info. More... | |
virtual Bool | isWritable () const |
Test if data can be put into this column. More... | |
virtual uInt | ndim (uInt rownr) |
Get the dimensionality of the item in the given row. More... | |
virtual IPosition | shape (uInt rownr) |
Get the shape of the item in the given row. More... | |
virtual Bool | isShapeDefined (uInt rownr) |
Is the value shape defined in the given row? By default it returns True. More... | |
Public Member Functions inherited from casacore::VirtualColumnEngine | |
VirtualColumnEngine () | |
Create the object. More... | |
virtual | ~VirtualColumnEngine () |
Public Member Functions inherited from casacore::DataManager | |
DataManager () | |
Default constructor. More... | |
virtual | ~DataManager () |
virtual String | dataManagerName () const |
Return the name of the data manager. More... | |
void | dataManagerInfo (Record &info) const |
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info. More... | |
virtual Record | getProperties () const |
Get data manager properties that can be modified. More... | |
virtual void | setProperties (const Record &spec) |
Modify data manager properties given in record fields. More... | |
virtual Bool | canReallocateColumns () const |
Tell if the data manager wants to reallocate the data manager column objects. More... | |
virtual DataManagerColumn * | reallocateColumn (DataManagerColumn *column) |
Reallocate the column object if it is part of this data manager. More... | |
uInt | sequenceNr () const |
Get the (unique) sequence nr of this data manager. More... | |
uInt | ncolumn () const |
Get the nr of columns in this data manager (can be zero). More... | |
Bool | asBigEndian () const |
Have the data to be stored in big or little endian canonical format? More... | |
const TSMOption & | tsmOption () const |
Get the TSM option. More... | |
MultiFileBase * | multiFile () |
Get the MultiFile pointer (can be 0). More... | |
String | keywordName (const String &keyword) const |
Compose a keyword name from the given keyword appended with the sequence number (e.g. More... | |
String | fileName () const |
Compose a unique filename from the table name and sequence number. More... | |
ByteIO::OpenOption | fileOption () const |
Get the AipsIO option of the underlying file. More... | |
virtual Bool | isRegular () const |
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in them. More... | |
Table & | table () const |
Get the table this object is associated with. More... | |
virtual void | reopenRW () |
Reopen the data manager for read/write access. More... | |
virtual Bool | canAddColumn () const |
Does the data manager allow to add columns? (default no) More... | |
virtual Bool | canRemoveColumn () const |
Does the data manager allow to delete columns? (default no) More... | |
virtual Bool | canRenameColumn () const |
Does the data manager allow to rename columns? (default yes) More... | |
virtual void | setMaximumCacheSize (uInt nbytes) |
Set the maximum cache size (in bytes) to be used by a storage manager. More... | |
virtual void | showCacheStatistics (std::ostream &) const |
Show the data manager's IO statistics. More... | |
DataManagerColumn * | createScalarColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a column in the data manager on behalf of a table column. More... | |
DataManagerColumn * | createDirArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create a direct array column. More... | |
DataManagerColumn * | createIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create an indirect array column. More... | |
DataManager * | getClone () const |
Has the object already been cloned? More... | |
void | setClone (DataManager *clone) const |
Set the pointer to the clone. More... | |
Public Member Functions inherited from casacore::DataManagerColumn | |
DataManagerColumn () | |
Create a column. More... | |
virtual | ~DataManagerColumn () |
Frees up the storage. More... | |
void | setIsFixedShape (Bool isFixedShape) |
Set the isFixedShape flag. More... | |
Bool | isFixedShape () const |
Is this a fixed shape column? More... | |
virtual String | dataTypeId () const |
Get the data type id of the column for dataType==TpOther. More... | |
virtual void | setMaxLength (uInt maxLength) |
Set the maximum length of the value (can be used for strings). More... | |
void | setFixedShapeColumn (const IPosition &shape) |
Set the shape of all (fixed-shaped) arrays in the column. More... | |
virtual void | setShape (uInt rownr, const IPosition &shape) |
Set the shape of an (variable-shaped) array in the given row. More... | |
virtual void | setShapeTiled (uInt rownr, const IPosition &shape, const IPosition &tileShape) |
Set the shape and tile shape of an (variable-shaped) array in the given row. More... | |
virtual IPosition | tileShape (uInt rownr) |
Get the tile shape of the item in the given row. More... | |
virtual Bool | canChangeShape () const |
Can the data manager handle chaging the shape of an existing array? Default is no. More... | |
virtual Bool | canAccessScalarColumn (Bool &reask) const |
Can the column data manager handle access to a scalar column? If not, the caller should access the column by looping through all cells in the column. More... | |
virtual Bool | canAccessScalarColumnCells (Bool &reask) const |
Can the column data manager handle access to a clooection of cells in a scalar column? If not, the caller should access the column cells by looping through the cells in the column. More... | |
virtual Bool | canAccessArrayColumn (Bool &reask) const |
Can the column data manager handle access to a scalar column? If not, the caller should access the column by looping through all cells in the column. More... | |
virtual Bool | canAccessArrayColumnCells (Bool &reask) const |
Can the column data manager handle access to a collection of cells in an array column? If not, the caller should access the column cells by looping through the cells in the column. More... | |
virtual Bool | canAccessSlice (Bool &reask) const |
Can the column data manager handle access to a cell slice? If not, the caller should do slicing itself (by accessing the entire array and slicing it). More... | |
virtual Bool | canAccessColumnSlice (Bool &reask) const |
Can the column data manager handle access to a column slice? If not, the caller should access the column slice by looping through all cell slices in the column. More... | |
ColumnCache & | columnCache () |
Get access to the ColumnCache object. More... | |
const ColumnCache * | columnCachePtr () const |
void | get (uInt rownr, Bool *dataPtr) |
Get the scalar value in the given row. More... | |
void | get (uInt rownr, uChar *dataPtr) |
void | get (uInt rownr, Short *dataPtr) |
void | get (uInt rownr, uShort *dataPtr) |
void | get (uInt rownr, Int *dataPtr) |
void | get (uInt rownr, uInt *dataPtr) |
void | get (uInt rownr, Int64 *dataPtr) |
void | get (uInt rownr, float *dataPtr) |
void | get (uInt rownr, double *dataPtr) |
void | get (uInt rownr, Complex *dataPtr) |
void | get (uInt rownr, DComplex *dataPtr) |
void | get (uInt rownr, String *dataPtr) |
void | get (uInt rownr, void *dataPtr) |
This function is the get for all non-standard data types. More... | |
void | put (uInt rownr, const Bool *dataPtr) |
Put the scalar value into the given row. More... | |
void | put (uInt rownr, const uChar *dataPtr) |
void | put (uInt rownr, const Short *dataPtr) |
void | put (uInt rownr, const uShort *dataPtr) |
void | put (uInt rownr, const Int *dataPtr) |
void | put (uInt rownr, const uInt *dataPtr) |
void | put (uInt rownr, const Int64 *dataPtr) |
void | put (uInt rownr, const float *dataPtr) |
void | put (uInt rownr, const double *dataPtr) |
void | put (uInt rownr, const Complex *dataPtr) |
void | put (uInt rownr, const DComplex *dataPtr) |
void | put (uInt rownr, const String *dataPtr) |
void | put (uInt rownr, const void *dataPtr) |
This function is the put for all non-standard data types. More... | |
virtual void | getScalarColumnV (void *dataPtr) |
Get all scalar values in the column. More... | |
virtual void | putScalarColumnV (const void *dataPtr) |
Put all scalar values in the column. More... | |
virtual void | getScalarColumnCellsV (const RefRows &rownrs, void *dataPtr) |
Get some scalar values in the column. More... | |
virtual void | putScalarColumnCellsV (const RefRows &rownrs, const void *dataPtr) |
Put some scalar values in the column. More... | |
virtual uInt | getBlockV (uInt rownr, uInt nrmax, void *dataPtr) |
Get scalars from the given row on with a maximum of nrmax values. More... | |
virtual void | putBlockV (uInt rownr, uInt nrmax, const void *dataPtr) |
Put nrmax scalars from the given row on. More... | |
virtual void | putArrayV (uInt rownr, const void *dataPtr) |
Put the array value into the given row. More... | |
virtual void | getArrayColumnV (void *dataPtr) |
Get all array values in the column. More... | |
virtual void | putArrayColumnV (const void *dataPtr) |
Put all array values in the column. More... | |
virtual void | getArrayColumnCellsV (const RefRows &rownrs, void *dataPtr) |
Get some array values in the column. More... | |
virtual void | putArrayColumnCellsV (const RefRows &rownrs, const void *dataPtr) |
Put some array values in the column. More... | |
virtual void | getSliceV (uInt rownr, const Slicer &slicer, void *dataPtr) |
Get a section of the array in the given row. More... | |
virtual void | putSliceV (uInt rownr, const Slicer &slicer, const void *dataPtr) |
Put into a section of the array in the given row. More... | |
virtual void | getColumnSliceV (const Slicer &slicer, void *dataPtr) |
Get a section of all arrays in the column. More... | |
virtual void | putColumnSliceV (const Slicer &slicer, const void *dataPtr) |
Put into a section of all arrays in the column. More... | |
virtual void | getColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, void *dataPtr) |
Get a section of some arrays in the column. More... | |
virtual void | putColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, const void *dataPtr) |
Put into a section of some arrays in the column. More... | |
void | throwGet () const |
Throw an "invalid operation" exception for the default implementation of get. More... | |
void | throwPut () const |
Throw an "invalid operation" exception for the default implementation of put. More... | |
void | setColumnName (const String &colName) |
Set the column name. More... | |
const String & | columnName () const |
Get rhe column name. More... | |
Static Public Member Functions | |
static String | className () |
Return the name of the class. More... | |
static void | registerClass () |
Register the class name and the static makeObject "constructor". More... | |
static DataManager * | makeObject (const String &dataManagerName, const Record &spec) |
Define the "constructor" to construct this engine when a table is read back. More... | |
Static Public Member Functions inherited from casacore::DataManager | |
static void | registerCtor (const String &type, DataManagerCtor func) |
Register a mapping of a data manager type to its static construction function. More... | |
static DataManagerCtor | getCtor (const String &dataManagerType) |
Get the "constructor" of a data manager (thread-safe). More... | |
static Bool | isRegistered (const String &dataManagerType) |
Test if a data manager is registered (thread-safe). More... | |
static DataManager * | unknownDataManager (const String &dataManagerType, const Record &spec) |
Serve as default function for theirRegisterMap, which catches all unknown data manager types. More... | |
Private Member Functions | |
VirtualTaQLColumn (const VirtualTaQLColumn &) | |
Copy is not needed and therefore forbidden (so it is made private). More... | |
VirtualTaQLColumn & | operator= (const VirtualTaQLColumn &) |
Assignment is not needed and therefore forbidden (so it is made private). More... | |
virtual DataManagerColumn * | makeScalarColumn (const String &columnName, int dataType, const String &) |
Create the column object for the scalar column in this engine. More... | |
virtual DataManagerColumn * | makeIndArrColumn (const String &columnName, int dataType, const String &dataTypeId) |
Create the column object for the indirect array column in this engine. More... | |
virtual void | create (uInt) |
Let the engine initialize the object for a new table. More... | |
virtual void | prepare () |
Prepare compiles the expression. More... | |
virtual void | getBoolV (uInt rownr, Bool *dataPtr) |
Get the scalar value in the given row. More... | |
virtual void | getuCharV (uInt rownr, uChar *dataPtr) |
virtual void | getShortV (uInt rownr, Short *dataPtr) |
virtual void | getuShortV (uInt rownr, uShort *dataPtr) |
virtual void | getIntV (uInt rownr, Int *dataPtr) |
virtual void | getuIntV (uInt rownr, uInt *dataPtr) |
virtual void | getInt64V (uInt rownr, Int64 *dataPtr) |
virtual void | getfloatV (uInt rownr, float *dataPtr) |
virtual void | getdoubleV (uInt rownr, double *dataPtr) |
virtual void | getComplexV (uInt rownr, Complex *dataPtr) |
virtual void | getDComplexV (uInt rownr, DComplex *dataPtr) |
virtual void | getStringV (uInt rownr, String *dataPtr) |
virtual void | getArrayV (uInt rownr, void *dataPtr) |
Get the array value in the given row. More... | |
IPosition | getResult (uInt rownr) |
Get the array result into itsCurResult. More... | |
void | makeCurResult () |
Make the result cache. More... | |
void | clearCurResult () |
Clear the result cache. More... | |
Private Attributes | |
int | itsDataType |
Bool | itsIsArray |
String | itsColumnName |
String | itsExpr |
TableExprNode * | itsNode |
Bool | itsTempWritable |
Int | itsCurRow |
void * | itsCurResult |
IPosition | itsCurShape |
Additional Inherited Members | |
Protected Member Functions inherited from casacore::DataManager | |
void | decrementNcolumn () |
Decrement number of columns (in case a column is deleted). More... | |
void | setEndian (Bool bigEndian) |
Tell the data manager if big or little endian format is needed. More... | |
void | setTsmOption (const TSMOption &tsmOption) |
Tell the data manager which TSM option to use. More... | |
void | setMultiFile (MultiFileBase *mfile) |
Tell the data manager that MultiFile can be used. More... | |
virtual Bool | hasMultiFileSupport () const |
Does the data manager support use of MultiFile? A derived class has to return True if it can use the MultiFile. More... | |
void | throwDataTypeOther (const String &columnName, int dataType) const |
Throw an exception in case data type is TpOther, because the storage managers (and maybe other data managers) do not support such columns. More... | |
Protected Member Functions inherited from casacore::DataManagerColumn | |
virtual void | getOtherV (uInt rownr, void *dataPtr) |
This function is the get for all non-standard data types. More... | |
virtual void | putBoolV (uInt rownr, const Bool *dataPtr) |
Put the scalar value into the given row. More... | |
virtual void | putuCharV (uInt rownr, const uChar *dataPtr) |
virtual void | putShortV (uInt rownr, const Short *dataPtr) |
virtual void | putuShortV (uInt rownr, const uShort *dataPtr) |
virtual void | putIntV (uInt rownr, const Int *dataPtr) |
virtual void | putuIntV (uInt rownr, const uInt *dataPtr) |
virtual void | putInt64V (uInt rownr, const Int64 *dataPtr) |
virtual void | putfloatV (uInt rownr, const float *dataPtr) |
virtual void | putdoubleV (uInt rownr, const double *dataPtr) |
virtual void | putComplexV (uInt rownr, const Complex *dataPtr) |
virtual void | putDComplexV (uInt rownr, const DComplex *dataPtr) |
virtual void | putStringV (uInt rownr, const String *dataPtr) |
virtual void | putOtherV (uInt rownr, const void *dataPtr) |
This function is the put for all non-standard data types. More... | |
Virtual scalar column using TaQL.
VirtualTaQLColumn is a virtual column engine to define the contents of a column as a TaQL expression in which possibly other columns are used. It is (of course) only possible to get data from the column; puts cannot be done.
The expression result can be a scalar or array of the basic TaQL data types. The column data type has to be conformant with that TaQL type, thus a column of any integer type has to be used for an integer TaQL result.
Caution: One has to be careful with deleting columns; If in an existing table a TaQL expression uses a deleted column, the expression cannot be parsed anymore and the table cannot be opened anymore; In the future the Table System will be made more forgiving;
The following example creates a table with a few columns. One column is virtual and has a random value if Col3 is true. Otherwise it has value 0.
Definition at line 89 of file VirtualTaQLColumn.h.
casacore::VirtualTaQLColumn::VirtualTaQLColumn | ( | const String & | expr | ) |
Construct it with the given TaQL expression.
casacore::VirtualTaQLColumn::VirtualTaQLColumn | ( | const Record & | spec | ) |
Construct it with the given specification.
|
virtual |
Destructor is mandatory.
|
private |
Copy is not needed and therefore forbidden (so it is made private).
|
static |
Return the name of the class.
|
private |
Clear the result cache.
|
virtual |
Clone the engine object.
Implements casacore::DataManager.
|
privatevirtual |
Let the engine initialize the object for a new table.
It defines a column keyword holding the expression.
Reimplemented from casacore::VirtualColumnEngine.
|
virtual |
Get the data manager specification.
Reimplemented from casacore::DataManager.
|
virtual |
Return the type name of the engine.
(i.e. its class name VirtualTaQLColumn).
Implements casacore::DataManager.
|
virtual |
Functions to return column info.
Implements casacore::DataManagerColumn.
|
inline |
Return the TaQL expression used.
Definition at line 129 of file VirtualTaQLColumn.h.
References itsExpr.
|
privatevirtual |
Get the array value in the given row.
The argument dataPtr is in fact an Array<T>*, but a void* is needed to be generic. The array pointed to by dataPtr has to have the correct shape (which is guaranteed by the ArrayColumn get function). The default implementation throws an "invalid operation" exception.
Reimplemented from casacore::DataManagerColumn.
Get the scalar value in the given row.
The default implementation throws an "invalid operation" exception.
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
Reimplemented from casacore::DataManagerColumn.
Reimplemented from casacore::DataManagerColumn.
Get the array result into itsCurResult.
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
Reimplemented from casacore::DataManagerColumn.
Reimplemented from casacore::DataManagerColumn.
|
privatevirtual |
Reimplemented from casacore::DataManagerColumn.
Is the value shape defined in the given row? By default it returns True.
Reimplemented from casacore::DataManagerColumn.
|
virtual |
Test if data can be put into this column.
This does not test if the data file is writable, only if it is in principle allowed to store data into the column. (It may not be allowed for virtual columns). The default is True.
Reimplemented from casacore::DataManagerColumn.
|
private |
Make the result cache.
|
privatevirtual |
Create the column object for the indirect array column in this engine.
Reimplemented from casacore::VirtualColumnEngine.
|
static |
Define the "constructor" to construct this engine when a table is read back.
This "constructor" has to be registered by the user of the engine. If the engine is commonly used, its registration can be added into the registerAllCtor function in DataManReg.cc. This function gets automatically invoked by the table system.
|
privatevirtual |
Create the column object for the scalar column in this engine.
Reimplemented from casacore::VirtualColumnEngine.
Get the dimensionality of the item in the given row.
By default it returns shape(rownr).nelements().
Reimplemented from casacore::DataManagerColumn.
|
private |
Assignment is not needed and therefore forbidden (so it is made private).
|
privatevirtual |
Prepare compiles the expression.
Reimplemented from casacore::VirtualColumnEngine.
|
static |
Register the class name and the static makeObject "constructor".
This will make the engine known to the table system.
Get the shape of the item in the given row.
By default it returns a zero-length IPosition (for a scalar value).
Reimplemented from casacore::DataManagerColumn.
|
private |
Definition at line 208 of file VirtualTaQLColumn.h.
|
private |
Definition at line 213 of file VirtualTaQLColumn.h.
|
private |
Definition at line 212 of file VirtualTaQLColumn.h.
|
private |
Definition at line 214 of file VirtualTaQLColumn.h.
|
private |
Definition at line 206 of file VirtualTaQLColumn.h.
|
private |
Definition at line 209 of file VirtualTaQLColumn.h.
Referenced by expression().
|
private |
Definition at line 207 of file VirtualTaQLColumn.h.
|
private |
Definition at line 210 of file VirtualTaQLColumn.h.
|
private |
Definition at line 211 of file VirtualTaQLColumn.h.