28 #ifndef TABLES_EXPRNODEREP_H
29 #define TABLES_EXPRNODEREP_H
51 class TableExprNodeColumn;
52 class TableExprGroupFuncBase;
53 template<
class T>
class Block;
242 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
245 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
440 virtual void show (ostream&,
uInt indent)
const;
510 Bool convertConstType);
569 virtual void show (ostream&,
uInt indent)
const;
572 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
575 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
671 virtual void show (ostream&,
uInt indent)
const;
674 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
677 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
683 const std::vector<TENShPtr>& nodes);
694 const std::vector<TENShPtr>& nodes,
void setAttributes(const Record &)
Set the attributes.
A Vector of integers, for indexing into Array<T> objects.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
CountedPtr< TableExprNodeRep > TENShPtr
virtual Bool isDefined(const TableExprId &id)
Is the value in the given row defined? The default implementation returns True.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
MArray< Double > getDoubleAS(const TableExprId &id)
virtual MArray< Bool > hasArrayString(const TableExprId &id, const MArray< String > &value)
Int ndim() const
Get the fixed dimensionality (same for all rows).
TaqlRegex(const Regex ®ex)
Construct from a regex.
ExprType exprType() const
Get the expression type.
static uInt checkNumOfArg(uInt low, uInt high, const std::vector< TENShPtr > &nodes)
Check number of arguments low <= number_of_args <= high It throws an exception if wrong number of arg...
virtual Array< Int > getColumnInt(const Vector< rownr_t > &rownrs)
Main interface class to a read/write table.
void adaptDataTypes()
If one of the children is a constant, convert its data type to that of the other operand.
const Record & attributes() const
Get the attributes.
const TENShPtr & getLeftChild() const
Get the child nodes.
virtual Array< Bool > getColumnBool(const Vector< rownr_t > &rownrs)
Get the value of the expression evaluated for the entire column.
MArray< String > getStringAS(const TableExprId &id)
virtual Array< Short > getColumnShort(const Vector< rownr_t > &rownrs)
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.
virtual Double getUnitFactor() const
Get the unit conversion factor.
virtual Array< DComplex > getColumnDComplex(const Vector< rownr_t > &rownrs)
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual MVTime getDate(const TableExprId &id)
void fillExprType(const TENShPtr &node)
Set expression type to Variable if node is Variable.
virtual void show(ostream &, uInt indent) const
Show the expression tree.
virtual Array< Float > getColumnFloat(const Vector< rownr_t > &rownrs)
A constant subexpression which can be evaluated immediately.
virtual ~TableExprNodeMulti()
Destructor.
Bool isConstant() const
Is the expression a constant?
virtual Int64 getInt(const TableExprId &id)
Scalar column in table select expression tree.
void setChildren(const TENShPtr &left, const TENShPtr &right, Bool adapt=True)
Set the children.
OperType operType() const
Get the operator type.
virtual void applySelection(const Vector< rownr_t > &rownrs)
Re-create the column object for a selection of rows.
static void createRange(Block< TableExprRange > &, TableExprNodeColumn *, Double start, Double end)
Create a range object from a column and an interval.
virtual MArray< Bool > hasArrayDComplex(const TableExprId &id, const MArray< DComplex > &value)
MArray< Int64 > getIntAS(const TableExprId &id)
TaqlRegex(const StringDistance &dist)
Construct from a StringDistance.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
NodeDataType
Define the data types of a node.
Abstract base class for a node in a table column expression tree.
MArray< MVTime > getDateAS(const TableExprId &id)
virtual void convertConstChild()
If one of the children is a constant, convert its data type to that of the other operand (if appropri...
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
virtual Bool hasDComplex(const TableExprId &id, const DComplex &value)
virtual Bool hasInt(const TableExprId &id, Int64 value)
virtual CountedPtr< TableExprGroupFuncBase > makeGroupAggrFunc()
Create the correct immediate aggregate function object.
void setValueType(ValueType vtype)
Set the value type.
virtual Array< Complex > getColumnComplex(const Vector< rownr_t > &rownrs)
virtual ~TableExprNodeBinary()
Destructor.
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
virtual Double getDouble(const TableExprId &id)
ExprType
Define (sub-)expression type.
const TENShPtr & getRightChild() const
ArgType
Define the value types of the 2 arguments when arrays are involved.
virtual Array< String > getColumnString(const Vector< rownr_t > &rownrs)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
virtual MArray< Bool > hasArrayDate(const TableExprId &id, const MArray< MVTime > &value)
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
Abstract base class for a node having multiple child nodes.
NodeDataType dataType() const
Get the data type of the derived TableExprNode object.
std::complex< Double > DComplex
OperType
Define the operator types.
Regular expression class (based on std::regex)
static NodeDataType getDT(NodeDataType leftDtype, NodeDataType rightDype, OperType operType)
Check the data types and get the common one.
virtual Array< Double > getColumnDouble(const Vector< rownr_t > &rownrs)
virtual MArray< Bool > hasArrayInt(const TableExprId &id, const MArray< Int64 > &value)
virtual const IPosition & getShape(const TableExprId &id)
Get the shape for the given row.
virtual void show(ostream &, uInt indent) const
Show the expression tree.
virtual Bool hasDate(const TableExprId &id, const MVTime &value)
virtual Bool hasBool(const TableExprId &id, Bool value)
Does a value occur in an array or set? The default implementation tests if it is in an array...
static TENShPtr replaceConstNode(const TENShPtr &node)
Replace a node with a constant expression by node with its value.
ValueType valueType() const
Get the value type.
virtual Array< Int64 > getColumnInt64(const Vector< rownr_t > &rownrs)
const std::vector< TENShPtr > & getChildren() const
Get the child nodes.
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
virtual MArray< Bool > hasArrayDouble(const TableExprId &id, const MArray< Double > &value)
ValueType
Define the value types.
TableExprNodeMulti(NodeDataType, ValueType, OperType, const TableExprNodeRep &source)
Constructor.
virtual Array< uChar > getColumnuChar(const Vector< rownr_t > &rownrs)
virtual void handleUnits()
Handle the units of the children and possibly set the parent's unit.
virtual void ranges(Block< TableExprRange > &)
Convert the tree to a number of range vectors which at least select the same things.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
virtual Bool getBool(const TableExprId &id)
Get a scalar value for this node in the given row.
void checkTablePtr(const TENShPtr &node)
Check if this node uses the same table pointer.
Bool match(const String &str) const
Does the regex or maximum string distance match?
std::vector< TENShPtr > operands_p
virtual void disableApplySelection()
Do not apply the selection.
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
const Unit & unit() const
Get the unit.
uInt64 rownr_t
Define the type of a row number in a table.
const Regex & regex() const
Return the regular expression.
MArray< Bool > getBoolAS(const TableExprId &id)
Get a value as an array, even it it is a scalar.
virtual Bool hasDouble(const TableExprId &id, Double value)
const String & regexp() const
Get the regular expression string.
void checkAggrFuncs()
Throw an exception if an aggregate function is used in the expression node or its children...
static String typeString(NodeDataType)
Convert a NodeDataType to a string.
virtual ~TableExprNodeRep()
The destructor deletes all the underlying TableExprNode objects.
TableExprNodeBinary(NodeDataType, ValueType, OperType, const Table &)
Constructor.
The identification of a TaQL selection subject.
Bool match(const String &target) const
Test if the given target string is within the maximum distance.
virtual String getString(const TableExprId &id)
Table & table()
Get table.
virtual MArray< Bool > hasArrayBool(const TableExprId &id, const MArray< Bool > &value)
Class to handle a Regex or StringDistance.
static NodeDataType checkDT(Block< Int > &dtypeOper, NodeDataType dtIn, NodeDataType dtOut, const std::vector< TENShPtr > &nodes, Bool dateConv=True)
Check datatype of nodes and return output type.
virtual TaqlRegex getRegex(const TableExprId &id)
virtual MArray< String > getArrayString(const TableExprId &id)
Bool matches(const string &str, Int pos=0) const
Matches entire string from pos (or till pos if negative pos).
TableExprNodeRep(NodeDataType, ValueType, OperType, ArgType, ExprType, Int ndim, const IPosition &shape, const Table &table)
Construct a node.
String: the storage and methods of handling collections of characters.
virtual Bool isLazyAggregate() const
Is the aggregate function a lazy or an immediate one? The default implementation returns True (becaus...
static TENShPtr convertNode(const TENShPtr &thisNode, Bool convertConstType)
If the node is constant, it is evaluated and replaced by the appropriate TableExprNodeConst object...
Class to deal with Levensthein distance of strings.
MArray< DComplex > getDComplexAS(const TableExprId &id)
rownr_t nrow() const
Get the number of rows in the table associated with this expression.
virtual void show(ostream &, uInt indent) const
Show the expression tree.
virtual Array< uShort > getColumnuShort(const Vector< rownr_t > &rownrs)
virtual DComplex getDComplex(const TableExprId &id)
Class to handle date/time type conversions and I/O.
static const Unit & makeEqualUnits(const TENShPtr &left, TENShPtr &right)
Make the units equal.
void setUnit(const Unit &unit)
Set the unit.
virtual Bool getColumnDataType(DataType &) const
Get the data type of the column.
Bool isReal() const
Is the data type real (i.e., integer or double)?
const IPosition & shape() const
Get the fixed shape (same for all rows).
virtual Bool hasString(const TableExprId &id, const String &value)
Abstract base class for a node having 0, 1, or 2 child nodes.
virtual Array< uInt > getColumnuInt(const Vector< rownr_t > &rownrs)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
TableExprNodeRep & operator=(const TableExprNodeRep &)
A copy of a TableExprNodeRep cannot be made.
static TableExprNodeRep getCommonTypes(const TENShPtr &left, const TENShPtr &right, OperType operType)
Check the data and value types and get the common one.
Bool empty() const
Test for empty.