casacore
|
Handle class for a table column expression tree. More...
#include <ExprNode.h>
Public Member Functions | |
TableExprNode () | |
TableExprNode | operator+ () const |
Unary operators on numeric TableExprNode's. More... | |
TableExprNode | operator- () const |
TableExprNode | operator! () const |
Unary NOT-operator on boolean TableExprNode's. More... | |
TableExprNode | operator~ () const |
Unary bitwise negate-operator on integer TableExprNode's. More... | |
TableExprNode | in (const TableExprNodeSet &set, const TaQLStyle &=TaQLStyle(0)) const |
TableExprNode | useUnit (const Unit &unit) const |
Use a unit for the given TableExprNode. More... | |
TableExprNode (const Bool &value) | |
Constructors to convert a constant value to a TableExprNode. More... | |
TableExprNode (const Int64 &value) | |
TableExprNode (const Int &value) | |
TableExprNode (const uInt &value) | |
TableExprNode (const Float &value) | |
TableExprNode (const Double &value) | |
TableExprNode (const Complex &value) | |
TableExprNode (const DComplex &value) | |
TableExprNode (const String &value) | |
TableExprNode (const std::string &value) | |
TableExprNode (const char *) | |
TableExprNode (const Regex &value) | |
TableExprNode (const StringDistance &value) | |
TableExprNode (const TaqlRegex &value) | |
TableExprNode (const MVTime &value) | |
TableExprNode (const Array< Bool > &value) | |
TableExprNode (const Array< uChar > &value) | |
TableExprNode (const Array< Short > &value) | |
TableExprNode (const Array< uShort > &value) | |
TableExprNode (const Array< Int > &value) | |
TableExprNode (const Array< uInt > &value) | |
TableExprNode (const Array< Float > &value) | |
TableExprNode (const Array< Double > &value) | |
TableExprNode (const Array< Complex > &value) | |
TableExprNode (const Array< DComplex > &value) | |
TableExprNode (const Array< String > &value) | |
TableExprNode (const Array< MVTime > &value) | |
TableExprNode (const MArray< Bool > &value) | |
TableExprNode (const MArray< uChar > &value) | |
TableExprNode (const MArray< Short > &value) | |
TableExprNode (const MArray< uShort > &value) | |
TableExprNode (const MArray< Int > &value) | |
TableExprNode (const MArray< uInt > &value) | |
TableExprNode (const MArray< Float > &value) | |
TableExprNode (const MArray< Double > &value) | |
TableExprNode (const MArray< Complex > &value) | |
TableExprNode (const MArray< DComplex > &value) | |
TableExprNode (const MArray< String > &value) | |
TableExprNode (const MArray< MVTime > &value) | |
TableExprNode (const TENShPtr &) | |
Construct a node from a node representation shared pointer which increments the reference count. More... | |
TableExprNode (TableExprNodeRep *rep) | |
Construct from a node representation. More... | |
TableExprNode (const TableExprNode &) | |
copy constructor (reference semantics). More... | |
TableExprNode & | operator= (const TableExprNode &) |
Assignment (reference semantics). More... | |
~TableExprNode () | |
The destructor deletes all the underlying TableExprNode objects,. More... | |
Bool | isNull () const |
Does the node contain no actual node? More... | |
void | disableApplySelection () |
Do not apply the selection. More... | |
void | applySelection (const Vector< uInt > &rownrs) |
Re-create the column object for a selection of rows. More... | |
const Unit & | unit () const |
Get the unit of the expression. More... | |
const Record & | attributes () const |
Get the attributes of the expression. More... | |
DataType | dataType () const |
Get the data type of the expression. More... | |
Bool | isScalar () const |
Is the expression a scalar? More... | |
uInt | nrow () const |
Get the number of rows in the table associated with this expression. More... | |
DataType | getColumnDataType () const |
Get the data type for doing a getColumn on the expression. More... | |
Bool | checkTableSize (const Table &table, Bool canBeConst) const |
Check if tables used in expression have the same number of rows as the given table. More... | |
void | adaptUnit (const Unit &) |
Adapt the unit of the expression to the given unit (if not empty). More... | |
TableExprNode | operator() (const TableExprNodeSet &indices) |
Slicing in a node containing an array. More... | |
TableExprNode | in (const TableExprNode &array, const TaQLStyle &=TaQLStyle(0)) const |
The IN operator to test if a value is contained in an array or set. More... | |
void | get (const TableExprId &id, Bool &value) const |
Get a value for this node in the given row. More... | |
void | get (const TableExprId &id, Int64 &value) const |
void | get (const TableExprId &id, Double &value) const |
void | get (const TableExprId &id, DComplex &value) const |
void | get (const TableExprId &id, String &value) const |
void | get (const TableExprId &id, TaqlRegex &value) const |
void | get (const TableExprId &id, MVTime &value) const |
void | get (const TableExprId &id, MArray< Bool > &value) const |
void | get (const TableExprId &id, MArray< Int64 > &value) const |
void | get (const TableExprId &id, MArray< Double > &value) const |
void | get (const TableExprId &id, MArray< DComplex > &value) const |
void | get (const TableExprId &id, MArray< String > &value) const |
void | get (const TableExprId &id, MArray< MVTime > &value) const |
void | get (const TableExprId &id, Array< Bool > &value) const |
void | get (const TableExprId &id, Array< Int64 > &value) const |
void | get (const TableExprId &id, Array< Double > &value) const |
void | get (const TableExprId &id, Array< DComplex > &value) const |
void | get (const TableExprId &id, Array< String > &value) const |
void | get (const TableExprId &id, Array< MVTime > &value) const |
Bool | getBool (const TableExprId &id) const |
Int64 | getInt (const TableExprId &id) const |
Double | getDouble (const TableExprId &id) const |
DComplex | getDComplex (const TableExprId &id) const |
MVTime | getDate (const TableExprId &id) const |
String | getString (const TableExprId &id) const |
Array< Bool > | getArrayBool (const TableExprId &id) const |
Array< Int64 > | getArrayInt (const TableExprId &id) const |
Array< Double > | getArrayDouble (const TableExprId &id) const |
Array< DComplex > | getArrayDComplex (const TableExprId &id) const |
Array< String > | getArrayString (const TableExprId &id) const |
Array< MVTime > | getArrayDate (const TableExprId &id) const |
MArray< Bool > | getBoolAS (const TableExprId &id) const |
Get a value as an array, even it it is a scalar. More... | |
MArray< Int64 > | getIntAS (const TableExprId &id) const |
MArray< Double > | getDoubleAS (const TableExprId &id) const |
MArray< DComplex > | getDComplexAS (const TableExprId &id) const |
MArray< String > | getStringAS (const TableExprId &id) const |
MArray< MVTime > | getDateAS (const TableExprId &id) const |
Array< Bool > | getColumnBool (const Vector< uInt > &rownrs) const |
Get the value of the expression evaluated for the entire column. More... | |
Array< uChar > | getColumnuChar (const Vector< uInt > &rownrs) const |
Array< Short > | getColumnShort (const Vector< uInt > &rownrs) const |
Array< uShort > | getColumnuShort (const Vector< uInt > &rownrs) const |
Array< Int > | getColumnInt (const Vector< uInt > &rownrs) const |
Array< uInt > | getColumnuInt (const Vector< uInt > &rownrs) const |
Array< Float > | getColumnFloat (const Vector< uInt > &rownrs) const |
Array< Double > | getColumnDouble (const Vector< uInt > &rownrs) const |
Array< Complex > | getColumnComplex (const Vector< uInt > &rownrs) const |
Array< DComplex > | getColumnDComplex (const Vector< uInt > &rownrs) const |
Array< String > | getColumnString (const Vector< uInt > &rownrs) const |
void | show (ostream &) const |
Show the tree. More... | |
void | ranges (Block< TableExprRange > &) |
Convert the tree to a number of range vectors which at least select the same things. More... | |
const Table & | table () const |
Get table. More... | |
const TENShPtr & | getRep () const |
returns const pointer to the underlying TableExprNodeRep object. More... | |
const TableExprNodeRep * | getNodeRep () const |
Static Public Member Functions | |
static TableExprNode | newColumnNode (const Table &tab, const String &name, const Vector< String > &fieldNames) |
Create a column node on behalf of the Table class. More... | |
static TableExprNode | newKeyConst (const TableRecord &, const Vector< String > &fieldNames) |
Create a TableExprNodeConst for a table keyword (which is handled as a constant). More... | |
static TableRecord * | findLastKeyRec (const TableRecord &keyset, const Vector< String > &fieldNames, String &fullName) |
Handle all field names except the last one. More... | |
static void | throwInvDT (const String &message) |
Throw invalid data type exception. More... | |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNodeSet &set, const Table &table, const TaQLStyle &=TaQLStyle(0)) |
Create function node of the given type with the given arguments. More... | |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNode &node) |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNode &node1, const TableExprNode &node2) |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNode &node1, const TableExprNode &node2, const TableExprNode &node3) |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNode &array, const TableExprNodeSet &axes) |
static TableExprNode | newFunctionNode (TableExprFuncNode::FunctionType, const TableExprNode &array, const TableExprNode &node, const TableExprNodeSet &axes) |
static TableExprNode | newUDFNode (const String &name, const TableExprNodeSet &set, const Table &table, const TaQLStyle &=TaQLStyle(0)) |
Create a user defined function node. More... | |
static TableExprNode | newConeNode (TableExprFuncNode::FunctionType, const TableExprNodeSet &set, uInt origin=0) |
Create cone function node of the given type with the given arguments. More... | |
static TableExprNode | newConeNode (TableExprFuncNode::FunctionType, const TableExprNode &node1, const TableExprNode &node2) |
static TableExprNode | newConeNode (TableExprFuncNode::FunctionType, const TableExprNode &node1, const TableExprNode &node2, const TableExprNode &node3) |
static TableExprNode | newRownrNode (const Table &table, uInt origin) |
Create rownumber() function node. More... | |
static TableExprNode | newRowidNode (const Table &table) |
Create rowid() function node. More... | |
static TableExprNode | newRandomNode (const Table &table) |
Create rand() function node. More... | |
static TableExprNode | newArrayPartNode (const TableExprNode &arrayNode, const TableExprNodeSet &indices, const TaQLStyle &=TaQLStyle(0)) |
Create ArrayElement node for the given array with the given index. More... | |
Private Member Functions | |
TENShPtr | setBinaryNodeInfo (TableExprNodeBinary *tsnptr, const TENShPtr &right=TENShPtr()) const |
Put the new binary node object in a shared pointer. More... | |
TENShPtr | newPlus (const TENShPtr &right) const |
Construct a new node for the given operation. More... | |
TENShPtr | newMinus (const TENShPtr &right) const |
TENShPtr | newTimes (const TENShPtr &right) const |
TENShPtr | newDivide (const TENShPtr &right) const |
TENShPtr | newModulo (const TENShPtr &right) const |
TENShPtr | newBitAnd (const TENShPtr &right) const |
TENShPtr | newBitOr (const TENShPtr &right) const |
TENShPtr | newBitXor (const TENShPtr &right) const |
TENShPtr | newEQ (const TENShPtr &right) const |
TENShPtr | newNE (const TENShPtr &right) const |
TENShPtr | newGE (const TENShPtr &right) const |
TENShPtr | newGT (const TENShPtr &right) const |
TENShPtr | newIN (const TENShPtr &right, const TaQLStyle &) const |
TENShPtr | newOR (const TENShPtr &right) const |
TENShPtr | newAND (const TENShPtr &right) const |
Static Private Member Functions | |
static std::vector< TENShPtr > | convertBlockTEN (Block< TableExprNode > &nodes) |
convert Block of TableExprNode to vector of TENShPtr. More... | |
Private Attributes | |
TENShPtr | node_p |
The actual (counted referenced) representation of a node. More... | |
Handle class for a table column expression tree.
Public interface
TableExprNode represents a node in the tree reflecting a table select expression.
TableExprNode is the class to store a table select expression, which allows to select rows from the table. The selected rows form a table which is a view of the original table.
TableExprNode is a handle class for the counted referenced class TableExprNodeRep. Classes (like TableExprNodePlusXX) derived from TableExprNodeRep hold the individual nodes in the expression, i.e. the operators and operands. The nodes form a binary tree reflecting the expression. E.g. the expression 2*COLUMN results in the node TableExprNodeTimes with its children TableExprNodeConst and TableExprNodeColumn. Constant subexpressions (like 2*3) are evaluated immediately and only the result is stored as a node.
There are a few TableExprNode constructors taking a constant scalar or array. In this way constant value are automatically converted to the appropriate TableExprNodeConst object.
The derived classes also reflect the data type of the node. Data types Bool, Double, DComplex and String are used. Char, uChar, Short, uShort, Int, uInt and float are converted to Double and Complex to DComplex. Binary operators +, -, *, /, %, &, }, ^, ==, >=, >, <, <= and != are recognized. Also &&, ||, parentheses and unary +, -, ~ and ! are recognized. For strings the binary operator + can also be used. The operators have the normal C++ precedence. Furthermore functions (like sin, max, ceil) can be used in an expression.
Operator() can be used to take a slice from an array.
The Table function col has to be used to create a TableExprNode object for a column in the table. The Table operator() can be used the do the actual selection from the top TableExprNode object.
Having TableExprNode as a handle class makes it possible to handle temporary objects created by the compiler in a smooth way. TableExprNode and its derivations allow to store an expression before actually evaluating it. This also allows the classes to be used by the table expression parser defined in TableParse and TableGram.
For each operator a special derived class is implemented. Another approach could have been to store the operator as a flag and switch on that. However, that causes extra overhead and the C++ virtual function mechanism is the designed for these purposes.
Definition at line 616 of file ExprNode.h.
casacore::TableExprNode::TableExprNode | ( | ) |
Referenced by casacore::diagonal(), TableExprNode(), and casacore::transpose().
casacore::TableExprNode::TableExprNode | ( | const Bool & | value | ) |
Constructors to convert a constant value to a TableExprNode.
The constructor for char* is also supported to convert a character-array to a string, since a two step conversion is not done automatically.
casacore::TableExprNode::TableExprNode | ( | const Int64 & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Int & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const uInt & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Float & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Double & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Complex & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const DComplex & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const String & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const std::string & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const char * | ) |
casacore::TableExprNode::TableExprNode | ( | const Regex & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const StringDistance & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const TaqlRegex & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const MVTime & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Array< Complex > & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const Array< DComplex > & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const MArray< Complex > & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const MArray< DComplex > & | value | ) |
casacore::TableExprNode::TableExprNode | ( | const TENShPtr & | ) |
Construct a node from a node representation shared pointer which increments the reference count.
|
inline |
Construct from a node representation.
It takes over the pointer, so the object gets deleted automatically.
Definition at line 941 of file ExprNode.h.
References operator=(), TableExprNode(), and ~TableExprNode().
casacore::TableExprNode::TableExprNode | ( | const TableExprNode & | ) |
copy constructor (reference semantics).
casacore::TableExprNode::~TableExprNode | ( | ) |
The destructor deletes all the underlying TableExprNode objects,.
Referenced by TableExprNode().
void casacore::TableExprNode::adaptUnit | ( | const Unit & | ) |
Adapt the unit of the expression to the given unit (if not empty).
Referenced by nrow().
Re-create the column object for a selection of rows.
Nothing is done if the node does not represent a column object.
Definition at line 963 of file ExprNode.h.
References casacore::TableExprNodeRep::applySelection(), and node_p.
|
inline |
Get the attributes of the expression.
Definition at line 971 of file ExprNode.h.
References casacore::TableExprNodeRep::attributes(), dataType(), and node_p.
Check if tables used in expression have the same number of rows as the given table.
Referenced by nrow().
|
staticprivate |
convert Block of TableExprNode to vector of TENShPtr.
Referenced by nrow().
DataType casacore::TableExprNode::dataType | ( | ) | const |
Get the data type of the expression.
Currently the only possible values are TpBool, TpInt, TpDouble, TpDComplex, TpString, and TpOther. The latter is returned for a date or regex.
Referenced by attributes().
|
inline |
Do not apply the selection.
Definition at line 958 of file ExprNode.h.
References casacore::TableExprNodeRep::disableApplySelection(), and node_p.
|
static |
Handle all field names except the last one.
ALl of them must be records. The last record is returned. fullName is filled with the full keyword name separated by dots.
Referenced by nrow().
|
inline |
Get a value for this node in the given row.
These functions are implemented in the derived classes and will usually invoke the get in their children and apply the operator on the resulting values.
Definition at line 1221 of file ExprNode.h.
References casacore::TableExprNodeRep::getBool(), and node_p.
|
inline |
Definition at line 1223 of file ExprNode.h.
References casacore::TableExprNodeRep::getInt(), and node_p.
|
inline |
Definition at line 1225 of file ExprNode.h.
References casacore::TableExprNodeRep::getDouble(), and node_p.
|
inline |
Definition at line 1227 of file ExprNode.h.
References casacore::TableExprNodeRep::getDComplex(), and node_p.
|
inline |
Definition at line 1229 of file ExprNode.h.
References casacore::TableExprNodeRep::getString(), and node_p.
|
inline |
Definition at line 1231 of file ExprNode.h.
References casacore::TableExprNodeRep::getRegex(), and node_p.
|
inline |
Definition at line 1233 of file ExprNode.h.
References casacore::TableExprNodeRep::getDate(), and node_p.
|
inline |
Definition at line 1235 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayBool(), and node_p.
|
inline |
Definition at line 1238 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayInt(), and node_p.
|
inline |
Definition at line 1241 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayDouble(), and node_p.
|
inline |
Definition at line 1244 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayDComplex(), and node_p.
|
inline |
Definition at line 1247 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayString(), and node_p.
|
inline |
Definition at line 1250 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayDate(), and node_p.
|
inline |
Definition at line 1253 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayBool(), and node_p.
|
inline |
Definition at line 1256 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayInt(), and node_p.
|
inline |
Definition at line 1259 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayDouble(), and node_p.
|
inline |
Definition at line 1262 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayDComplex(), and node_p.
|
inline |
Definition at line 1265 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayString(), and node_p.
|
inline |
Definition at line 1268 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayDate(), and node_p.
|
inline |
Definition at line 1283 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayBool(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1293 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayDate(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1289 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayDComplex(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1287 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayDouble(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1285 of file ExprNode.h.
References casacore::MArray< T >::array(), casacore::TableExprNodeRep::getArrayInt(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1291 of file ExprNode.h.
References casacore::TableExprNodeRep::getArrayString(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1271 of file ExprNode.h.
References casacore::TableExprNodeRep::getBool(), and node_p.
Referenced by nrow().
|
inline |
Get a value as an array, even it it is a scalar.
This is useful in case one can give an argument as scalar or array.
Definition at line 1295 of file ExprNode.h.
References casacore::TableExprNodeRep::getBoolAS(), and node_p.
Referenced by nrow().
Get the value of the expression evaluated for the entire column.
The data of function called should match the data type as returned by function getColumnDataType
.
Definition at line 1308 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnBool(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1324 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnComplex(), and node_p.
Referenced by nrow().
DataType casacore::TableExprNode::getColumnDataType | ( | ) | const |
Get the data type for doing a getColumn on the expression.
This is the data type of the column if the expression consists of a single column only. Otherwise it is the expression data type as returned by function dataType
.
Referenced by nrow().
|
inline |
Definition at line 1326 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnDComplex(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1322 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnDouble(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1320 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnFloat(), and node_p.
Referenced by nrow().
Definition at line 1316 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnInt(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1312 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnShort(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1328 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnString(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1310 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnuChar(), and node_p.
Referenced by nrow().
Definition at line 1318 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnuInt(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1314 of file ExprNode.h.
References casacore::TableExprNodeRep::getColumnuShort(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1279 of file ExprNode.h.
References casacore::TableExprNodeRep::getDate(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1305 of file ExprNode.h.
References casacore::TableExprNodeRep::getDateAS(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1277 of file ExprNode.h.
References casacore::TableExprNodeRep::getDComplex(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1301 of file ExprNode.h.
References casacore::TableExprNodeRep::getDComplexAS(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1275 of file ExprNode.h.
References casacore::TableExprNodeRep::getDouble(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1299 of file ExprNode.h.
References casacore::TableExprNodeRep::getDoubleAS(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1273 of file ExprNode.h.
References casacore::TableExprNodeRep::getInt(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1297 of file ExprNode.h.
References casacore::TableExprNodeRep::getIntAS(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 2184 of file ExprNode.h.
References casacore::CountedPtr< t >::get(), and node_p.
Referenced by nrow().
|
inline |
returns const pointer to the underlying TableExprNodeRep object.
Definition at line 2180 of file ExprNode.h.
References node_p.
Referenced by nrow().
|
inline |
Definition at line 1281 of file ExprNode.h.
References casacore::TableExprNodeRep::getString(), and node_p.
Referenced by nrow().
|
inline |
Definition at line 1303 of file ExprNode.h.
References casacore::TableExprNodeRep::getStringAS(), and node_p.
Referenced by nrow().
|
inline |
The IN operator to test if a value is contained in an array or set.
The array can also be a scalar.
Definition at line 1402 of file ExprNode.h.
TableExprNode casacore::TableExprNode::in | ( | const TableExprNodeSet & | set, |
const TaQLStyle & | = TaQLStyle(0) |
||
) | const |
|
inline |
Does the node contain no actual node?
Definition at line 954 of file ExprNode.h.
References node_p.
Referenced by casacore::TaQLResult::isTable().
|
inline |
Is the expression a scalar?
Definition at line 981 of file ExprNode.h.
References node_p, casacore::TableExprNodeRep::valueType(), and casacore::TableExprNodeRep::VTScalar.
Referenced by nrow().
|
static |
Create ArrayElement node for the given array with the given index.
The origin is 0 for C++ and 1 for TaQL.
Referenced by nrow(), and operator()().
Referenced by nrow(), and casacore::operator &().
Referenced by nrow(), and casacore::operator|().
Referenced by nrow(), and casacore::operator^().
|
static |
|
static |
Create cone function node of the given type with the given arguments.
Referenced by casacore::anyCone(), casacore::cones(), casacore::findCone(), and nrow().
|
static |
|
static |
Referenced by nrow(), and casacore::operator/().
Referenced by nrow(), and casacore::operator==().
|
static |
Create function node of the given type with the given arguments.
Referenced by casacore::abs(), casacore::acos(), casacore::all(), casacore::alls(), casacore::amplitude(), casacore::angdist(), casacore::angdistx(), casacore::any(), casacore::anys(), casacore::arg(), casacore::array(), casacore::arrayData(), casacore::arrayFlatten(), casacore::arrayMask(), casacore::asin(), casacore::atan(), casacore::atan2(), casacore::avdev(), casacore::avdevs(), casacore::boolean(), casacore::boxedAll(), casacore::boxedAny(), casacore::boxedAvdev(), casacore::boxedMax(), casacore::boxedMean(), casacore::boxedMedian(), casacore::boxedMin(), casacore::boxedRms(), casacore::boxedStddev(), casacore::boxedVariance(), casacore::capitalize(), casacore::cdate(), casacore::cdow(), casacore::ceil(), casacore::cmonth(), casacore::conj(), casacore::cos(), casacore::cosh(), casacore::ctime(), casacore::ctodt(), casacore::cube(), casacore::date(), casacore::datetime(), casacore::day(), casacore::diagonal(), casacore::dms(), casacore::downcase(), casacore::exp(), casacore::floor(), casacore::fmod(), casacore::formComplex(), casacore::fractile(), casacore::fractiles(), casacore::hdms(), casacore::hms(), casacore::iif(), casacore::imag(), casacore::integer(), casacore::isdefined(), casacore::isFinite(), casacore::isInf(), casacore::isNaN(), casacore::log(), casacore::log10(), casacore::ltrim(), casacore::marray(), casacore::max(), casacore::maxs(), casacore::mean(), casacore::means(), casacore::median(), casacore::medians(), casacore::min(), casacore::mins(), casacore::mjd(), casacore::mjdtodate(), casacore::month(), casacore::ndim(), casacore::near(), casacore::nearAbs(), casacore::nelements(), casacore::nfalse(), casacore::nfalses(), casacore::norm(), nrow(), casacore::ntrue(), casacore::ntrues(), casacore::pattern(), casacore::phase(), casacore::pow(), casacore::product(), casacore::products(), casacore::real(), casacore::regex(), casacore::replace(), casacore::rms(), casacore::rmss(), casacore::round(), casacore::rtrim(), casacore::runningAll(), casacore::runningAny(), casacore::runningAvdev(), casacore::runningMax(), casacore::runningMean(), casacore::runningMedian(), casacore::runningMin(), casacore::runningRms(), casacore::runningStddev(), casacore::runningVariance(), casacore::shape(), casacore::sign(), casacore::sin(), casacore::sinh(), casacore::sqlpattern(), casacore::sqrt(), casacore::square(), casacore::stddev(), casacore::stddevs(), casacore::strlength(), casacore::substr(), casacore::sum(), casacore::sums(), casacore::sumSquare(), casacore::sumSquares(), casacore::tan(), casacore::tanh(), casacore::time(), casacore::toString(), casacore::transpose(), casacore::trim(), casacore::upcase(), casacore::variance(), casacore::variances(), casacore::week(), casacore::weekday(), and casacore::year().
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by nrow(), casacore::operator<=(), and casacore::operator>=().
Referenced by nrow(), casacore::operator<(), and casacore::operator>().
|
static |
Create a TableExprNodeConst for a table keyword (which is handled as a constant).
Referenced by nrow().
Referenced by nrow(), and casacore::operator-().
Referenced by nrow(), and casacore::operator%().
Referenced by nrow(), and casacore::operator!=().
Referenced by nrow().
Construct a new node for the given operation.
Referenced by nrow(), and casacore::operator+().
|
static |
Create rand() function node.
Referenced by nrow().
|
static |
|
static |
Create rownumber() function node.
Origin indicates whether the first row should be zero (for C++ binding) or an other value (one for TaQL binding).
Referenced by nrow().
Referenced by nrow(), and casacore::operator*().
|
static |
Create a user defined function node.
Referenced by nrow().
|
inline |
Get the number of rows in the table associated with this expression.
One is returned if the expression is a constant. Zero is returned if no table is associated with it.
Definition at line 987 of file ExprNode.h.
References adaptUnit(), checkTableSize(), convertBlockTEN(), findLastKeyRec(), getArrayBool(), getArrayDate(), getArrayDComplex(), getArrayDouble(), getArrayInt(), getArrayString(), getBool(), getBoolAS(), getColumnBool(), getColumnComplex(), getColumnDataType(), getColumnDComplex(), getColumnDouble(), getColumnFloat(), getColumnInt(), getColumnShort(), getColumnString(), getColumnuChar(), getColumnuInt(), getColumnuShort(), getDate(), getDateAS(), getDComplex(), getDComplexAS(), getDouble(), getDoubleAS(), getInt(), getIntAS(), getNodeRep(), getRep(), getString(), getStringAS(), newAND(), newArrayPartNode(), newBitAnd(), newBitOr(), newBitXor(), newColumnNode(), newConeNode(), newDivide(), newEQ(), newFunctionNode(), newGE(), newGT(), newIN(), newKeyConst(), newMinus(), newModulo(), newNE(), newOR(), newPlus(), newRandomNode(), newRowidNode(), newRownrNode(), newTimes(), newUDFNode(), node_p, casacore::TableExprNodeRep::nrow(), ranges(), setBinaryNodeInfo(), show(), table(), throwInvDT(), and casacore::value().
TableExprNode casacore::TableExprNode::operator! | ( | ) | const |
Unary NOT-operator on boolean TableExprNode's.
|
inline |
Slicing in a node containing an array.
It is possible to address a single pixel or an n-dimensional subarray. In case of a single pixel the result is a scalar node. Otherwise the result is an array node with the same dimensionality as the source.
Note that there exist TableExprNodeSet constructors to convert an IPosition
or Slicer
object automatically to a TableExprNodeSet
. An IPosition
addresses a single element and results in a scalar node, while a Slicer
can address multiple elements and always results in an array node.
C++ indexing is 0-based.
Definition at line 1407 of file ExprNode.h.
References newArrayPartNode().
TableExprNode casacore::TableExprNode::operator+ | ( | ) | const |
Unary operators on numeric TableExprNode's.
TableExprNode casacore::TableExprNode::operator- | ( | ) | const |
TableExprNode& casacore::TableExprNode::operator= | ( | const TableExprNode & | ) |
Assignment (reference semantics).
Referenced by TableExprNode().
TableExprNode casacore::TableExprNode::operator~ | ( | ) | const |
Unary bitwise negate-operator on integer TableExprNode's.
|
inline |
Convert the tree to a number of range vectors which at least select the same things.
This function is very useful to convert the expression to some intervals covering the select expression. This can be used to do a rough fast selection via an index and do the the slower final selection on that much smaller subset. The function can only convert direct comparisons of columns with constants (via ==, !=, >, >=, < or <=) and their combinations using && or ||.
Definition at line 1213 of file ExprNode.h.
References node_p, and casacore::TableExprNodeRep::ranges().
Referenced by nrow().
|
private |
Put the new binary node object in a shared pointer.
Set the node's info and adapt the children if needed. If the node is constant, it is evaluated and returned as result.
Referenced by nrow().
|
inline |
Show the tree.
Definition at line 2176 of file ExprNode.h.
References node_p, and casacore::TableExprNodeRep::show().
Referenced by nrow().
|
inline |
Get table.
This gets the Table object to which a TableExprNode belongs. A TableExprNode belongs to the Table to which the column(s) used in an expression belong. Note that all columns in an expression have to belong to the same table.
Definition at line 1217 of file ExprNode.h.
References node_p, and casacore::TableExprNodeRep::table().
Referenced by nrow().
|
static |
Throw invalid data type exception.
Referenced by nrow().
|
inline |
Get the unit of the expression.
Definition at line 967 of file ExprNode.h.
References node_p, and casacore::TableExprNodeRep::unit().
TableExprNode casacore::TableExprNode::useUnit | ( | const Unit & | unit | ) | const |
Use a unit for the given TableExprNode.
Note that if a column has a unit, it is automatically set. In that case this can be used to convert units.
|
friend |
Definition at line 1568 of file ExprNode.h.
|
friend |
Definition at line 1540 of file ExprNode.h.
|
friend |
Definition at line 1876 of file ExprNode.h.
|
friend |
Definition at line 1967 of file ExprNode.h.
|
friend |
The amplitude (i.e.
sqrt(re*re + im*im)) of a complex node. This is a synonym for function abs. Defined for scalars and arrays.
Definition at line 1616 of file ExprNode.h.
|
friend |
Angular distance between positions.
Both arguments have to be arrays. If both arrays contain 2 values (ra and dec), the result is a scalar. Otherwise the arrays have to contain a multiple of 2 values and the result is a 2-dim array giving the distance of each position in the first array to each position in the second array.
Definition at line 1439 of file ExprNode.h.
|
friend |
Definition at line 1872 of file ExprNode.h.
|
friend |
The result is always a Bool scalar telling if any cone contains the source.
Definition at line 1457 of file ExprNode.h.
|
friend |
Definition at line 1476 of file ExprNode.h.
|
friend |
Definition at line 1961 of file ExprNode.h.
|
friend |
The arg (i.e.
atan2(im, re)) of a complex node. Defined for scalars and arrays.
Definition at line 1620 of file ExprNode.h.
|
friend |
Create an array of the given shape and fill it with the values.
The values
array is rewound as needed.
Definition at line 2105 of file ExprNode.h.
|
friend |
Get the data array of a masked array.
Definition at line 2117 of file ExprNode.h.
|
friend |
Flatten a masked array (get unmasked elements).
Definition at line 2127 of file ExprNode.h.
|
friend |
Get the mask of a masked array.
If the array has no mask, it return an array with all False values.
Definition at line 2122 of file ExprNode.h.
|
friend |
Transcendental functions applied to to nodes containing scalars or arrays with double values.
They are invalid for Complex nodes.
Definition at line 1544 of file ExprNode.h.
|
friend |
Definition at line 1548 of file ExprNode.h.
|
friend |
Definition at line 1552 of file ExprNode.h.
|
friend |
Definition at line 1851 of file ExprNode.h.
|
friend |
Definition at line 1936 of file ExprNode.h.
|
friend |
Convert numeric or string value to bool (0, no, false, - means false)
Definition at line 1608 of file ExprNode.h.
|
friend |
Definition at line 1654 of file ExprNode.h.
|
friend |
Definition at line 1721 of file ExprNode.h.
|
friend |
Definition at line 1713 of file ExprNode.h.
|
friend |
Definition at line 1564 of file ExprNode.h.
|
friend |
Definition at line 1703 of file ExprNode.h.
|
friend |
Cone search; test if the position of a source is inside a cone.
Argument sourcePos
must be a double array containing two values (ra and dec of source) in radians.
Argument cones
must be a double array specifying the position of the cone centers and radii in radians. So the array must contain three values (ra,dec,radius) or a multiple of it.
The result is a bool array telling for each cone if it contains the source. If there is only one cone, the result is a scalar.
Definition at line 1451 of file ExprNode.h.
|
friend |
Cone search as above.
However, the cone positions and radii are specified separately and (virtually) a larger array containing every combination of position/radius is formed.
Definition at line 1469 of file ExprNode.h.
|
friend |
The complex conjugate of a complex node.
Defined for scalars and arrays.
Definition at line 1612 of file ExprNode.h.
|
friend |
Definition at line 1490 of file ExprNode.h.
|
friend |
Definition at line 1494 of file ExprNode.h.
|
friend |
Definition at line 1725 of file ExprNode.h.
|
friend |
Definition at line 1717 of file ExprNode.h.
|
friend |
Definition at line 1527 of file ExprNode.h.
|
friend |
Definition at line 1687 of file ExprNode.h.
|
friend |
Functions for date-values.
Defined for scalars and arrays.
Definition at line 1673 of file ExprNode.h.
|
friend |
Definition at line 1699 of file ExprNode.h.
|
friend |
Get the diagonal of a (masked) array; If the array is not a Matrix, it will take the diagonals of the subarrays given by the two axes in the axes argument.
Those axes have to have the same length (thus each subarray is a Matrix). If no axes are given, they default to the first two axes.
The diag
argument tells which diagonal to take. 0 is the main diagonal, >0 is above main diagonal, <0 is below.
Definition at line 2145 of file ExprNode.h.
|
friend |
|
friend |
|
friend |
Definition at line 1649 of file ExprNode.h.
|
friend |
Definition at line 1498 of file ExprNode.h.
|
friend |
The sourcePos can contain multiple sources.
The result is a double array giving the index of the first cone containing the corresponding source. If there is one source, the result is a double scalar.
Definition at line 1463 of file ExprNode.h.
|
friend |
Definition at line 1483 of file ExprNode.h.
|
friend |
Definition at line 1572 of file ExprNode.h.
|
friend |
Definition at line 1576 of file ExprNode.h.
|
friend |
Form a complex number from two Doubles.
One or both arguments can be scalar or array.
Definition at line 1628 of file ExprNode.h.
|
friend |
Form a complex number from a string.
Defined for scalars and arrays.
Definition at line 1634 of file ExprNode.h.
|
friend |
Definition at line 1866 of file ExprNode.h.
|
friend |
Definition at line 1954 of file ExprNode.h.
|
friend |
Function resembling the ternary ?:
construct in C++.
The argument "condition" has to be a Bool value. If an element in "condition" is True, the corresponding element from "arg1" is taken, otherwise it is taken from "arg2". The arguments can be scalars or array or any combination.
Definition at line 2167 of file ExprNode.h.
|
friend |
The imaginary part of a complex node.
Defined for scalars and arrays.
Definition at line 1600 of file ExprNode.h.
|
friend |
Convert double, bool, or string to int (using floor).
Definition at line 1604 of file ExprNode.h.
|
friend |
Function operating on a field resulting in a bool scalar.
It can be used to test if a column has an array in the current row. It can also be used to test if a record contains a field.
Definition at line 2151 of file ExprNode.h.
|
friend |
Function to test if a scalar or array is finite.
It results in a Bool scalar or array.
Definition at line 1806 of file ExprNode.h.
|
friend |
Function to test if a scalar or array is NaN (not-a-number).
It results in a Bool scalar or array.
Definition at line 1798 of file ExprNode.h.
|
friend |
Definition at line 1502 of file ExprNode.h.
|
friend |
Definition at line 1506 of file ExprNode.h.
|
friend |
Definition at line 1764 of file ExprNode.h.
|
friend |
Form a masked array.
Definition at line 2111 of file ExprNode.h.
|
friend |
Definition at line 1592 of file ExprNode.h.
|
friend |
Definition at line 1816 of file ExprNode.h.
|
friend |
Definition at line 1912 of file ExprNode.h.
|
friend |
Definition at line 1836 of file ExprNode.h.
|
friend |
Definition at line 1918 of file ExprNode.h.
|
friend |
Definition at line 1861 of file ExprNode.h.
|
friend |
Definition at line 1948 of file ExprNode.h.
|
friend |
Minimum or maximum of 2 nodes.
Makes sense for numeric and String values. For Complex values the norm is compared. One or both arguments can be scalar or array.
Definition at line 1588 of file ExprNode.h.
|
friend |
Functions operating on a Double scalar or array resulting in a Double scalar.
Definition at line 1811 of file ExprNode.h.
|
friend |
Definition at line 1906 of file ExprNode.h.
|
friend |
Definition at line 1683 of file ExprNode.h.
|
friend |
Definition at line 1678 of file ExprNode.h.
|
friend |
Definition at line 1695 of file ExprNode.h.
|
friend |
Definition at line 2159 of file ExprNode.h.
|
friend |
Functions to return whether a value is "relatively" near another.
Returns tol > abs(val2 - val1)/max(abs(val1),(val2))
. If tol <= 0, returns val1 == val2. If either val is 0.0, takes care of area around the minimum number that can be represented.
The nearAbs functions return whether a value is "absolutely" near another. Returns tol > abs(val2 - val1)
. Default tolerance is 1.0e-13. They operate on scalars and arrays.
Definition at line 1413 of file ExprNode.h.
|
friend |
Definition at line 1419 of file ExprNode.h.
|
friend |
Definition at line 1426 of file ExprNode.h.
|
friend |
Definition at line 1432 of file ExprNode.h.
|
friend |
Functions operating on any scalar or array resulting in a Double scalar.
A scalar has 1 element and dimensionality 0.
Definition at line 2155 of file ExprNode.h.
|
friend |
Definition at line 1884 of file ExprNode.h.
|
friend |
Definition at line 1979 of file ExprNode.h.
|
friend |
Definition at line 1536 of file ExprNode.h.
|
friend |
Definition at line 1880 of file ExprNode.h.
|
friend |
Definition at line 1973 of file ExprNode.h.
|
friend |
Definition at line 1357 of file ExprNode.h.
|
friend |
Logical operators to combine boolean TableExprNode's.
A null TableExprNode object is ignored, so it is possible to build up a full expression gradually.
|
friend |
Definition at line 1377 of file ExprNode.h.
|
friend |
Definition at line 1352 of file ExprNode.h.
|
friend |
Definition at line 1342 of file ExprNode.h.
|
friend |
Define all global functions as friends.
Arithmetic operators for numeric TableExprNode's.
Definition at line 1332 of file ExprNode.h.
|
friend |
Definition at line 1337 of file ExprNode.h.
|
friend |
Definition at line 1347 of file ExprNode.h.
|
friend |
Definition at line 1397 of file ExprNode.h.
|
friend |
Definition at line 1392 of file ExprNode.h.
|
friend |
Comparison operators.
Definition at line 1372 of file ExprNode.h.
|
friend |
Definition at line 1382 of file ExprNode.h.
|
friend |
Not defined for Bool.
Definition at line 1387 of file ExprNode.h.
|
friend |
Definition at line 1367 of file ExprNode.h.
|
friend |
Definition at line 1362 of file ExprNode.h.
|
friend |
|
friend |
Definition at line 1663 of file ExprNode.h.
|
friend |
The phase (i.e.
atan2(im, re)) of a complex node. This is a synonym for function arg. Defined for scalars and arrays.
Definition at line 1624 of file ExprNode.h.
|
friend |
Definition at line 1510 of file ExprNode.h.
|
friend |
Definition at line 1826 of file ExprNode.h.
|
friend |
Definition at line 1894 of file ExprNode.h.
|
friend |
The real part of a complex node.
Defined for scalars and arrays.
Definition at line 1596 of file ExprNode.h.
|
friend |
Functions for regular expression matching and pattern matching.
Defined for scalars and arrays.
pattern
is for a file name like pattern.
sqlpattern
is for an SQL like pattern.
Definition at line 1659 of file ExprNode.h.
|
friend |
Definition at line 1785 of file ExprNode.h.
|
friend |
Definition at line 1791 of file ExprNode.h.
|
friend |
Definition at line 1856 of file ExprNode.h.
|
friend |
Definition at line 1942 of file ExprNode.h.
|
friend |
Definition at line 1560 of file ExprNode.h.
|
friend |
Definition at line 1768 of file ExprNode.h.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Function operating on any scalar or array resulting in a Double array containing the shape.
A scalar has shape [1].
Definition at line 2163 of file ExprNode.h.
|
friend |
Definition at line 1556 of file ExprNode.h.
|
friend |
Transcendental functions that can be applied to essentially all numeric nodes containing scalars or arrays.
Definition at line 1514 of file ExprNode.h.
|
friend |
Definition at line 1518 of file ExprNode.h.
|
friend |
Definition at line 1668 of file ExprNode.h.
|
friend |
Definition at line 1532 of file ExprNode.h.
|
friend |
Definition at line 1522 of file ExprNode.h.
|
friend |
Definition at line 1846 of file ExprNode.h.
|
friend |
Definition at line 1930 of file ExprNode.h.
|
friend |
String functions on scalars or arrays.
Definition at line 1639 of file ExprNode.h.
|
friend |
Definition at line 1772 of file ExprNode.h.
|
friend |
Definition at line 1778 of file ExprNode.h.
|
friend |
Functions operating on a Double or Complex scalar or array resulting in a scalar with the same data type.
Definition at line 1821 of file ExprNode.h.
|
friend |
The partial version of the functions above.
They are applied to the array subsets defined by the axes in the set using the partialXXX functions in ArrayMath. The axes must be 0-relative.
Definition at line 1888 of file ExprNode.h.
|
friend |
Definition at line 1831 of file ExprNode.h.
|
friend |
Definition at line 1900 of file ExprNode.h.
|
friend |
Definition at line 1580 of file ExprNode.h.
|
friend |
Definition at line 1584 of file ExprNode.h.
|
friend |
Definition at line 1756 of file ExprNode.h.
|
friend |
Transpose all axes of a (masked) array.
Needs an empty axes argument.
Definition at line 2132 of file ExprNode.h.
|
friend |
Definition at line 2139 of file ExprNode.h.
|
friend |
Definition at line 1760 of file ExprNode.h.
|
friend |
Definition at line 1644 of file ExprNode.h.
|
friend |
Definition at line 1841 of file ExprNode.h.
|
friend |
Definition at line 1924 of file ExprNode.h.
|
friend |
Definition at line 1752 of file ExprNode.h.
|
friend |
Definition at line 1708 of file ExprNode.h.
|
friend |
Definition at line 1691 of file ExprNode.h.
|
private |
The actual (counted referenced) representation of a node.
Definition at line 1208 of file ExprNode.h.
Referenced by applySelection(), attributes(), disableApplySelection(), get(), getArrayBool(), getArrayDate(), getArrayDComplex(), getArrayDouble(), getArrayInt(), getArrayString(), getBool(), getBoolAS(), getColumnBool(), getColumnComplex(), getColumnDComplex(), getColumnDouble(), getColumnFloat(), getColumnInt(), getColumnShort(), getColumnString(), getColumnuChar(), getColumnuInt(), getColumnuShort(), getDate(), getDateAS(), getDComplex(), getDComplexAS(), getDouble(), getDoubleAS(), getInt(), getIntAS(), getNodeRep(), getRep(), getString(), getStringAS(), in(), isNull(), isScalar(), nrow(), casacore::operator &(), casacore::operator!=(), casacore::operator%(), casacore::operator*(), casacore::operator+(), casacore::operator-(), casacore::operator/(), casacore::operator<(), casacore::operator<=(), casacore::operator==(), casacore::operator>(), casacore::operator>=(), casacore::operator^(), casacore::operator|(), ranges(), show(), table(), and unit().