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;
410 Bool isConstant()
const;
413 const Unit& unit()
const;
417 void setUnit (
const Unit& unit);
420 const Record& attributes()
const;
423 void setAttributes (
const Record&);
440 virtual void show (ostream&,
uInt indent)
const;
447 const Table& table()
const;
451 static TENShPtr replaceConstNode (
const TENShPtr& node);
455 virtual void adaptSetUnits (
const Unit&);
490 virtual void convertConstChild();
495 void checkTablePtr (
const TENShPtr& node);
496 static void checkTablePtr (
Table& table,
const TENShPtr& node);
501 void fillExprType (
const TENShPtr& node);
502 static void fillExprType (
ExprType&,
const TENShPtr& node);
509 static TENShPtr convertNode (
const TENShPtr& thisNode,
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);
584 const TENShPtr& right,
589 void setChildren (
const TENShPtr& left,
const TENShPtr& right,
595 virtual void handleUnits();
600 void adaptDataTypes();
613 static const Unit& makeEqualUnits (
const TENShPtr& left,
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);
687 {
return operands_p; }
694 const std::vector<TENShPtr>& nodes,
708 {
return dtype_p==NTInt || dtype_p==NTDouble; }
724 {
return exprtype_p; }
728 {
return (exprtype_p == Constant); }
735 {
return attributes_p; }
738 { attributes_p = attributes; }
755 { checkTablePtr (table_p, node); }
757 { 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.