casacore
|
Abstract base class for data object in a TaQL expression. More...
#include <TableExprData.h>
Public Member Functions | |
TableExprData () | |
Construct it from a row number. More... | |
virtual | ~TableExprData () |
virtual IPosition | shape (const Block< Int > &fieldNrs) const |
Get the shape of the given field. More... | |
virtual DataType | dataType (const Block< Int > &fieldNrs) const =0 |
Get the data type of the given field. More... | |
virtual Bool | getBool (const Block< Int > &fieldNrs) const |
Get a scalar in the given type. More... | |
virtual Int64 | getInt (const Block< Int > &fieldNrs) const |
virtual Double | getDouble (const Block< Int > &fieldNrs) const |
virtual DComplex | getDComplex (const Block< Int > &fieldNrs) const |
virtual String | getString (const Block< Int > &fieldNrs) const |
virtual Array< Bool > | getArrayBool (const Block< Int > &fieldNrs) const |
Get an array in the given type. More... | |
virtual Array< Int64 > | getArrayInt (const Block< Int > &fieldNrs) const |
virtual Array< Double > | getArrayDouble (const Block< Int > &fieldNrs) const |
virtual Array< DComplex > | getArrayDComplex (const Block< Int > &fieldNrs) const |
virtual Array< String > | getArrayString (const Block< Int > &fieldNrs) const |
Abstract base class for data object in a TaQL expression.
Public interface
The Table Query Language (TaQL) is implemented by means of the TableExprNode
classes. It is primarily meant to do selection on tables. However, it is also possible to use it for selection on any other set of data resembling tabular data.
An example of such a data set is a set of Record objects. TaQL can be used to select some of those records based on the contents of one or more fields in the records. Note that this example is already directly supported by TaQL.
Another example is when a user has several equally long vectors with data. The vectors can be seen as fields and TaQL can be used to select entries from the vectors. This example requires that this class TableExprData is used.
The TableExprNodeRecordField and TableExprId classes form the means by which TaQL can deal with any set of data.
First the TaQL expression has to be setup. This is done by constructing a TableExprNodeRecordField
object for each 'field' to be used in the expression. TableExprNodeRecordField
uses a RecordInterface object to make the data type of a field in the data set known and to map a field name to a field index (the index is the sequence number of the field in the record description).
When evaluating the expression for each member in the data set, a TableExprData>
needs to be passed (which is automatically converted to TableExprId). So a class needs to be written to access the data in the data set. It needs to be derived from the abstract base class TableExprData
defined in this file. An example is given below.
It is also possible that the data set contains records and that the selection is based on fields in those records. In such a case the record passed to TableExprNodeRecordField
should contain subrecords representing those records. The field index in the various functions as passed as a Block<Int>
to denote the fields in the subrecords (and possibly subsubrecords, etc.. However, normally records won't be used and fieldNrs[0]
gives the field index.
This example shows how a data set consisting of two vectors of scalars can be used.
This class makes it possible that TaQL can be used in a very versatile way.
Definition at line 202 of file TableExprData.h.
|
inline |
Construct it from a row number.
Definition at line 206 of file TableExprData.h.
|
virtual |
|
pure virtual |
Get the data type of the given field.
Note that TpArray types have to be returned for arrays. If the field is unknown, TpOther should be returned. It is used for the isdefined function to check if the field is really defined.
Implemented in casacore::LogFilterExpr.
|
virtual |
Get an array in the given type.
This might involve converting for Double and DComplex. Most default implementations throws an "not possible" exception. The default getArrayDComplex
invokes getArrayDouble
.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Get a scalar in the given type.
This might involve converting for Double and DComplex. Most default implementations throws an "not possible" exception. The default getDouble
invokes getInt
. The default getDComplex
invokes getDouble
.
|
virtual |
Reimplemented in casacore::LogFilterExpr.
Reimplemented in casacore::LogFilterExpr.
Get the shape of the given field.
Need only be implemented if there are arrays in the data. The default implementation returns an empty IPosition.