26#ifndef TABLES_EXPRNODESETELEM_H
27#define TABLES_EXPRNODESETELEM_H
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/ExprNodeRep.h>
41 class TableExprNodeSetElemBase;
42 typedef std::shared_ptr<TableExprNodeSetElemBase>
TENSEBShPtr;
81 void show (ostream& os,
uInt indent)
const override;
84 virtual void flattenTree (std::vector<TableExprNodeRep*>&)
override;
601 void show (ostream& os,
uInt indent)
const override
602 {
itsElem->show (os, indent); }
606 {
return itsElem->isDiscrete(); }
610 {
return itsElem->isSingle(); }
615 {
return itsElem->isLeftClosed(); }
617 {
return itsElem->isRightClosed(); }
622 {
return itsElem->isMidWidth(); }
633 {
return itsElem->increment(); }
String: the storage and methods of handling collections of characters.
Abstract base class for a node in a table column expression tree.
NodeDataType
Define the data types of a node.
const TENShPtr & increment() const
void getStart(const TableExprId &id, Double &) const
Get the start or end value of a Double or DateTime interval.
void getStart(const TableExprId &id, String &) const
Get the start or end value of a String interval.
virtual void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const
virtual void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const
void adaptSetUnits(const Unit &) override
Let a set node convert itself to the given unit.
TableExprNodeSetElemBase & operator=(const TableExprNodeSetElemBase &)=delete
A copy of a TableExprNodeSetElem cannot be made.
virtual void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const
virtual TENSEBShPtr evaluate(const TableExprId &id) const =0
Evaluate the element for the given row and construct a new (constant) element from it.
TableExprNodeSetElemBase(NodeDataType=NTDouble)
Constructor to initialize the parent.
virtual void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const
TENShPtr evalExpr(const TENShPtr &expr, const TableExprId &id) const
Evaluate the expression for the given row id.
const TENShPtr & end() const
virtual Bool isMidWidth() const
Is the interval given as mid-width? Default implementation returns False.
void getEnd(const TableExprId &id, Double &) const
virtual void flattenTree(std::vector< TableExprNodeRep * > &) override
Flatten the node tree by adding the node and its children to the vector.
virtual Bool isRightClosed() const
virtual void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const
virtual void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const
virtual Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & start() const
Get the start, end or increment expression.
virtual void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const
virtual void matchBool(Bool *match, const Bool *value, size_t nval, const TableExprId &id) const
Set a flag in the match output array if the corresponding element in the value array is included in t...
virtual void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const
virtual ~TableExprNodeSetElemBase()=default
virtual void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const
void show(ostream &os, uInt indent) const override
Show the node.
virtual Bool isLeftClosed() const
Is the interval left or right closed? Default implementation returns False.
virtual void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const
void setExprType()
Set the expression type (Variable or Constant) depending on the children.
virtual Bool isSingle() const
Is a single value given? Default implementation returns False.
virtual void fillVector(Vector< Bool > &vec, Int64 &cnt, const TableExprId &id) const
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void getEnd(const TableExprId &id, String &) const
Class defining a set element containing a continuous interval.
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
TableExprNodeSetElemCont(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
Bool isRightClosed() const override
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
TableExprNodeSetElemCont(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
TableExprNodeSetElemCont(const TableExprNodeSetElemCont &that, const TENShPtr &start, const TENShPtr &end)
Construct an element from the given parts and take over their pointers.
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
TableExprNodeSetElemCont(const TableExprNode &mid, const TableExprNode &width)
Constructor used by the derived class TableExprNodeSetElemMidWidth.
TableExprNodeSetElemCont(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
void setup(Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
Setup the object for a continuous interval.
~TableExprNodeSetElemCont() override=default
Bool isLeftClosed() const override
Is the interval left or right closed?
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const override
Class defining a set element containing a discrete range.
TableExprNodeSetElemDiscrete(const TableExprNodeSetElemDiscrete &that, const TENShPtr &start, const TENShPtr &end, const TENShPtr &incr)
Construct an element from the given parts and take over their pointers.
TableExprNodeSetElemDiscrete(const TableExprNode &start, const TableExprNode &end, const TableExprNode &incr, Bool isEndExcl=False)
Create the object for a discrete range.
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
Bool isDiscrete() const override
It is a discrete set element.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const override
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const override
~TableExprNodeSetElemDiscrete() override=default
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const override
Class defining a set element containing a continuous mid/width interval.
TableExprNodeSetElemMidWidth(const TableExprNode &mid, const TableExprNode &width)
Create the object for a continuous bounded interval given as mid-width.
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the set element for the given row and construct a new (constant) TableExprNodeSetElemCont el...
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
Bool isMidWidth() const override
The interval is given as mid-width.
~TableExprNodeSetElemMidWidth() override=default
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
Class defining a set element containing a single value.
TableExprNodeSetElemSingle(const TableExprNode &node)
Create the object for a single expression node.
void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const override
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Bool > &vec, Int64 &cnt, const TableExprId &id) const override
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const override
void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const override
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
Bool isDiscrete() const override
It is a discrete set element.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const override
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const override
~TableExprNodeSetElemSingle() override=default
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const override
void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const override
Bool isSingle() const override
A single value is given (which can be an array).
TableExprNodeSetElemSingle(const TableExprNodeSetElemSingle &that, const TENShPtr &start)
Construct an element from the given parts and take over their pointers.
void matchBool(Bool *match, const Bool *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
Class to hold the table expression nodes for an element in a set.
void show(ostream &os, uInt indent) const override
Show the node.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
TableExprNodeSetElem(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
Bool isRightClosed() const
~TableExprNodeSetElem() override=default
const TENShPtr & end() const
TableExprNodeSetElem(const TableExprNode *start, const TableExprNode *end, const TableExprNode *incr, Bool isEndExcl=False)
Create the object for a discrete range.
const TENSEBShPtr & getElem() const
Get the internal pointer to the underlying TableExprNodeSetElemBase.
TableExprNodeSetElem(const TENSEBShPtr &elem)
Create from a Base element.
Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & increment() const
Bool isMidWidth() const
Is the interval given as mid-width?
void init()
Set the data and expression type in the superclass.
Bool isSingle() const
Is a single value given?
Bool isLeftClosed() const
Is the interval left or right closed?
TableExprNodeSetElem(const TableExprNode &mid, const TableExprNode &width)
Create the object for a mid-width interval (closed on both sides).
const TENShPtr & start() const
Get the start, end or increment expression.
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
this file contains all the compiler specific defines
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
std::shared_ptr< TableExprNodeRep > TENShPtr
std::shared_ptr< TableExprNodeSetElemBase > TENSEBShPtr
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.