28 #ifndef TABLES_EXPRNODEREP_H 29 #define TABLES_EXPRNODEREP_H 32 #include <casacore/casa/aips.h> 33 #include <casacore/tables/Tables/Table.h> 34 #include <casacore/tables/TaQL/TableExprId.h> 35 #include <casacore/tables/TaQL/ExprRange.h> 36 #include <casacore/tables/TaQL/MArray.h> 37 #include <casacore/casa/Containers/Record.h> 38 #include <casacore/casa/BasicSL/Complex.h> 39 #include <casacore/casa/Quanta/MVTime.h> 40 #include <casacore/casa/Quanta/Unit.h> 41 #include <casacore/casa/Utilities/DataType.h> 42 #include <casacore/casa/Utilities/Regex.h> 43 #include <casacore/casa/Utilities/StringDistance.h> 44 #include <casacore/casa/iosfwd.h> 51 class TableExprNodeColumn;
52 class TableExprGroupFuncBase;
53 template<
class T>
class Block;
191 OtColumn, OtField, OtLiteral, OtFunc, OtSlice,
OtUndef,
197 NoArr, ArrArr, ArrSca, ScaArr
227 virtual void disableApplySelection();
231 virtual void applySelection (
const Vector<uInt>& rownrs);
235 virtual Double getUnitFactor()
const;
239 void checkAggrFuncs();
242 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
245 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
255 virtual Bool isLazyAggregate()
const;
287 {
value = getBool (
id); }
289 {
value = getInt (
id); }
291 {
value = getDouble (
id); }
293 {
value = getDComplex (
id); }
295 {
value = getDate (
id); }
297 {
value = getString (
id); }
299 {
value = getArrayBool (
id); }
301 {
value = getArrayInt (
id); }
303 {
value = getArrayDouble (
id); }
305 {
value = getArrayDComplex (
id); }
307 {
value = getArrayDate (
id); }
309 {
value = getArrayString (
id); }
355 virtual Bool getColumnDataType (DataType&)
const;
409 Bool isConstant()
const;
412 const Unit& unit()
const;
416 void setUnit (
const Unit& unit);
419 const Record& attributes()
const;
422 void setAttributes (
const Record&);
439 virtual void show (ostream&,
uInt indent)
const;
446 const Table& table()
const;
450 static TENShPtr replaceConstNode (
const TENShPtr& node);
454 virtual void adaptSetUnits (
const Unit&);
489 virtual void convertConstChild();
494 void checkTablePtr (
const TENShPtr& node);
495 static void checkTablePtr (
Table& table,
const TENShPtr& node);
500 void fillExprType (
const TENShPtr& node);
501 static void fillExprType (
ExprType&,
const TENShPtr& node);
508 static TENShPtr convertNode (
const TENShPtr& thisNode,
509 Bool convertConstType);
568 virtual void show (ostream&,
uInt indent)
const;
571 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
574 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
583 const TENShPtr& right,
588 void setChildren (
const TENShPtr& left,
const TENShPtr& right,
594 virtual void handleUnits();
599 void adaptDataTypes();
612 static const Unit& makeEqualUnits (
const TENShPtr& left,
670 virtual void show (ostream&,
uInt indent)
const;
673 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
676 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
682 const std::vector<TENShPtr>& nodes);
686 {
return operands_p; }
693 const std::vector<TENShPtr>& nodes,
707 {
return dtype_p==NTInt || dtype_p==NTDouble; }
723 {
return exprtype_p; }
727 {
return (exprtype_p == Constant); }
734 {
return attributes_p; }
737 { attributes_p = attributes; }
754 { checkTablePtr (table_p, node); }
756 { fillExprType (exprtype_p, node); }
void setAttributes(const Record &)
Set the attributes.
A Vector of integers, for indexing into Array<T> objects.
CountedPtr< TableExprNodeRep > TENShPtr
const Record & attributes() const
Get the attributes.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
TaqlRegex(const Regex ®ex)
Construct from a regex.
Bool matches(const string &str, Int pos=0) const
Matches entire string from pos (or till pos if negative pos).
Main interface class to a read/write table.
Int ndim() const
Get the fixed dimensionality (same for all rows).
void fillExprType(const TENShPtr &node)
Set expression type to Variable if node is Variable.
A constant subexpression which can be evaluated immediately.
PtrHolder< T > & operator=(const PtrHolder< T > &other)
Scalar column in table select expression tree.
Bool match(const String &str) const
Does the regex or maximum string distance match?
const std::vector< TENShPtr > & getChildren() const
Get the child nodes.
TaqlRegex(const StringDistance &dist)
Construct from a StringDistance.
NodeDataType
Define the data types of a node.
Abstract base class for a node in a table column expression tree.
Bool empty() const
Test for empty.
ValueType valueType() const
Get the value type.
const TENShPtr & getLeftChild() const
Get the child nodes.
void setValueType(ValueType vtype)
Set the value type.
const IPosition & shape() const
Get the fixed shape (same for all rows).
ExprType
Define (sub-)expression type.
ArgType
Define the value types of the 2 arguments when arrays are involved.
NodeDataType dataType() const
Get the data type of the derived TableExprNode object.
Abstract base class for a node having multiple child nodes.
std::complex< Double > DComplex
OperType
Define the operator types.
Regular expression class.
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
const Regex & regex() const
Return the regular expression.
OperType operType() const
Get the operator type.
const String & regexp() const
Get the regular expression string.
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
Bool isReal() const
Is the data type real (i.e., integer or double)?
ValueType
Define the value types.
const Unit & unit() const
Get the unit.
ExprType exprType() const
Get the expression type.
Bool match(const String &target) const
Test if the given target string is within the maximum distance.
void checkTablePtr(const TENShPtr &node)
Check if this node uses the same table pointer.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
const TENShPtr & getRightChild() const
std::vector< TENShPtr > operands_p
Bool isConstant() const
Is the expression a constant?
The identification of a TaQL selection subject.
Table & table()
Get table.
Class to handle a Regex or StringDistance.
String: the storage and methods of handling collections of characters.
Class to deal with Levensthein distance of strings.
Class to handle date/time type conversions and I/O.
Abstract base class for a node having 0, 1, or 2 child nodes.
this file contains all the compiler specific defines
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.