Class to hold multiple table expression nodes. More...
#include <ExprNodeSet.h>
Public Member Functions | |
TableExprNodeSet () | |
Construct an empty set. | |
TableExprNodeSet (const IPosition &) | |
Construct from an IPosition . | |
TableExprNodeSet (const Slicer &) | |
Construct from a Slicer . | |
TableExprNodeSet (const Vector< uInt > &rownrs, const TableExprNodeSet &) | |
Construct a set with n*set.nelements() elements where n is the number of rows. | |
TableExprNodeSet (const TableExprNodeSet &) | |
~TableExprNodeSet () | |
void | add (const TableExprNodeSetElem &, Bool adaptType=False) |
Add an element to the set. | |
void | show (ostream &os, uInt indent) const |
Show the node. | |
virtual void | getAggrNodes (vector< TableExprNodeRep * > &aggr) |
Get the nodes representing an aggregate function. | |
virtual void | getColumnNodes (vector< TableExprNodeRep * > &cols) |
Get the nodes representing a table column. | |
void | checkEqualDataTypes () const |
Check if the data type of the set elements are the same. | |
Bool | isSingle () const |
Contains the set only single elements? Single means that only single values are given (thus end nor incr). | |
Bool | isDiscrete () const |
Contains the set only discrete elements? Discrete means that no continuous ranges are given, but discrete ranges (using :) are possible. | |
Bool | isBounded () const |
Is the set fully bounded (discrete and no undefined end values)? | |
uInt | nelements () const |
Get the number of elements. | |
const TableExprNodeSetElem & | operator[] (uInt index) const |
Get the i-th element. | |
Bool | hasArrays () const |
Contains the set array values? | |
TableExprNodeRep * | setOrArray () const |
Try to convert the set to an array. | |
template<typename T > | |
MArray< T > | toArray (const TableExprId &id) const |
virtual MArray< Bool > | getArrayBool (const TableExprId &id) |
Get an array value for this bounded set in the given row. | |
virtual MArray< Int64 > | getArrayInt (const TableExprId &id) |
virtual MArray< Double > | getArrayDouble (const TableExprId &id) |
virtual MArray< DComplex > | getArrayDComplex (const TableExprId &id) |
virtual MArray< String > | getArrayString (const TableExprId &id) |
virtual MArray< MVTime > | getArrayDate (const TableExprId &id) |
virtual Bool | hasBool (const TableExprId &id, Bool value) |
Does a value occur in the set? | |
virtual Bool | hasInt (const TableExprId &id, Int64 value) |
virtual Bool | hasDouble (const TableExprId &id, Double value) |
virtual Bool | hasDComplex (const TableExprId &id, const DComplex &value) |
virtual Bool | hasString (const TableExprId &id, const String &value) |
virtual Bool | hasDate (const TableExprId &id, const MVTime &value) |
virtual MArray< Bool > | hasArrayBool (const TableExprId &id, const MArray< Bool > &value) |
virtual MArray< Bool > | hasArrayInt (const TableExprId &id, const MArray< Int64 > &value) |
virtual MArray< Bool > | hasArrayDouble (const TableExprId &id, const MArray< Double > &value) |
virtual MArray< Bool > | hasArrayDComplex (const TableExprId &id, const MArray< DComplex > &value) |
virtual MArray< Bool > | hasArrayString (const TableExprId &id, const MArray< String > &value) |
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. | |
Private Types | |
typedef Bool(TableExprNodeSet::* | FindFuncPtr )(Double value) |
Define the functions to find a double, which depend on open/closed-ness. | |
Private Member Functions | |
TableExprNodeSet & | operator= (const TableExprNodeSet &) |
A copy of a TableExprNodeSet cannot be made. | |
void | deleteElems () |
Delete all set elements in itsElems. | |
TableExprNodeRep * | toConstArray () const |
Convert the const set to an array. | |
void | getArray (MArray< Bool > &marr, TableExprNodeRep *node, const TableExprId &id) const |
Get the array in a templated way. | |
void | getArray (MArray< Int64 > &marr, TableExprNodeRep *node, const TableExprId &id) const |
void | getArray (MArray< Double > &marr, TableExprNodeRep *node, const TableExprId &id) const |
void | getArray (MArray< DComplex > &marr, TableExprNodeRep *node, const TableExprId &id) const |
void | getArray (MArray< String > &marr, TableExprNodeRep *node, const TableExprId &id) const |
void | getArray (MArray< MVTime > &marr, TableExprNodeRep *node, const TableExprId &id) const |
void | combineIntIntervals () |
Sort and combine intervals. | |
void | combineDoubleIntervals () |
void | combineDateIntervals () |
Bool | findOpenOpen (Double value) |
Bool | findOpenClosed (Double value) |
Bool | findClosedOpen (Double value) |
Bool | findClosedClosed (Double value) |
void | setFindFunc (Bool isLeftClosed, Bool isRightClosed) |
Private Attributes | |
PtrBlock< TableExprNodeSetElem * > | itsElems |
Bool | itsSingle |
Bool | itsDiscrete |
Bool | itsBounded |
Bool | itsCheckTypes |
Bool | itsAllIntervals |
Block< Double > | itsStart |
Block< Double > | itsEnd |
FindFuncPtr | itsFindFunc |
Class to hold multiple table expression nodes.
Public interface
This class is used to assemble several table expression nodes. It is used for 3 purposes:
The type of all set elements has to be the same. The set consists of TableExprNodeSetElem elements. The add
function has to be used to add an element to the set.
It is possible to construct the object directly from an IPosition object. In that case all elements are single. Furthermore it is possible to construct it directly from a Slicer object. In that case all elements represent a discrete interval.
Definition at line 305 of file ExprNodeSet.h.
typedef Bool(TableExprNodeSet::* casacore::TableExprNodeSet::FindFuncPtr)(Double value) [private] |
Define the functions to find a double, which depend on open/closed-ness.
In this way a test on open/closed is done only once.
Definition at line 459 of file ExprNodeSet.h.
casacore::TableExprNodeSet::TableExprNodeSet | ( | ) |
Construct an empty set.
casacore::TableExprNodeSet::TableExprNodeSet | ( | const IPosition & | ) |
casacore::TableExprNodeSet::TableExprNodeSet | ( | const Slicer & | ) |
Construct from a Slicer
.
The number of elements in the set is the dimensionality of the Slicer
. All set elements are discrete intervals. Their start and/or end is undefined if it is was not defined (i.e. Slicer::MimicSource used) in the Slicer
object.
casacore::TableExprNodeSet::TableExprNodeSet | ( | const Vector< uInt > & | rownrs, | |
const TableExprNodeSet & | ||||
) |
Construct a set with n*set.nelements() elements where n is the number of rows.
Element i is constructed by evaluating the input element for row rownr[i].
casacore::TableExprNodeSet::TableExprNodeSet | ( | const TableExprNodeSet & | ) |
casacore::TableExprNodeSet::~TableExprNodeSet | ( | ) |
virtual void casacore::TableExprNodeSet::adaptSetUnits | ( | const Unit & | ) | [virtual] |
Let a set node convert itself to the given unit.
Reimplemented from casacore::TableExprNodeRep.
void casacore::TableExprNodeSet::add | ( | const TableExprNodeSetElem & | , | |
Bool | adaptType = False | |||
) |
Add an element to the set.
If adaptType=True, the data type is the highest of the elements added. Otherwise it is that of the first element. True is meant for a set of values, False for function arguments.
void casacore::TableExprNodeSet::checkEqualDataTypes | ( | ) | const |
Check if the data type of the set elements are the same.
If not, an exception is thrown.
void casacore::TableExprNodeSet::combineDateIntervals | ( | ) | [private] |
void casacore::TableExprNodeSet::combineDoubleIntervals | ( | ) | [private] |
void casacore::TableExprNodeSet::combineIntIntervals | ( | ) | [private] |
Sort and combine intervals.
void casacore::TableExprNodeSet::deleteElems | ( | ) | [private] |
Delete all set elements in itsElems.
virtual void casacore::TableExprNodeSet::getAggrNodes | ( | vector< TableExprNodeRep * > & | aggr | ) | [virtual] |
Get the nodes representing an aggregate function.
void casacore::TableExprNodeSet::getArray | ( | MArray< MVTime > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Definition at line 444 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayDate(), and casacore::MArray< T >::reference().
void casacore::TableExprNodeSet::getArray | ( | MArray< String > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Definition at line 441 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayString(), and casacore::MArray< T >::reference().
void casacore::TableExprNodeSet::getArray | ( | MArray< DComplex > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Definition at line 438 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayDComplex(), and casacore::MArray< T >::reference().
void casacore::TableExprNodeSet::getArray | ( | MArray< Double > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Definition at line 435 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayDouble(), and casacore::MArray< T >::reference().
void casacore::TableExprNodeSet::getArray | ( | MArray< Int64 > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Definition at line 432 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayInt(), and casacore::MArray< T >::reference().
void casacore::TableExprNodeSet::getArray | ( | MArray< Bool > & | marr, | |
TableExprNodeRep * | node, | |||
const TableExprId & | id | |||
) | const [inline, private] |
Get the array in a templated way.
Definition at line 429 of file ExprNodeSet.h.
References casacore::TableExprNodeRep::getArrayBool(), and casacore::MArray< T >::reference().
Referenced by toArray().
virtual MArray<Bool> casacore::TableExprNodeSet::getArrayBool | ( | const TableExprId & | id | ) | [virtual] |
Get an array value for this bounded set in the given row.
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<MVTime> casacore::TableExprNodeSet::getArrayDate | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<DComplex> casacore::TableExprNodeSet::getArrayDComplex | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Double> casacore::TableExprNodeSet::getArrayDouble | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Int64> casacore::TableExprNodeSet::getArrayInt | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<String> casacore::TableExprNodeSet::getArrayString | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual void casacore::TableExprNodeSet::getColumnNodes | ( | vector< TableExprNodeRep * > & | cols | ) | [virtual] |
Get the nodes representing a table column.
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayBool | ( | const TableExprId & | id, | |
const MArray< Bool > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayDate | ( | const TableExprId & | id, | |
const MArray< MVTime > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayDComplex | ( | const TableExprId & | id, | |
const MArray< DComplex > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayDouble | ( | const TableExprId & | id, | |
const MArray< Double > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayInt | ( | const TableExprId & | id, | |
const MArray< Int64 > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Bool casacore::TableExprNodeSet::hasArrays | ( | ) | const |
Contains the set array values?
Referenced by toArray().
virtual MArray<Bool> casacore::TableExprNodeSet::hasArrayString | ( | const TableExprId & | id, | |
const MArray< String > & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasBool | ( | const TableExprId & | id, | |
Bool | value | |||
) | [virtual] |
Does a value occur in the set?
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasDate | ( | const TableExprId & | id, | |
const MVTime & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasDComplex | ( | const TableExprId & | id, | |
const DComplex & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasDouble | ( | const TableExprId & | id, | |
Double | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasInt | ( | const TableExprId & | id, | |
Int64 | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
virtual Bool casacore::TableExprNodeSet::hasString | ( | const TableExprId & | id, | |
const String & | value | |||
) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Bool casacore::TableExprNodeSet::isBounded | ( | ) | const [inline] |
Is the set fully bounded (discrete and no undefined end values)?
Definition at line 487 of file ExprNodeSet.h.
References itsBounded.
Bool casacore::TableExprNodeSet::isDiscrete | ( | ) | const [inline] |
Contains the set only discrete elements? Discrete means that no continuous ranges are given, but discrete ranges (using :) are possible.
Definition at line 483 of file ExprNodeSet.h.
References itsDiscrete.
Bool casacore::TableExprNodeSet::isSingle | ( | ) | const [inline] |
Contains the set only single elements? Single means that only single values are given (thus end nor incr).
Definition at line 479 of file ExprNodeSet.h.
References itsSingle.
uInt casacore::TableExprNodeSet::nelements | ( | ) | const [inline] |
Get the number of elements.
Definition at line 491 of file ExprNodeSet.h.
References itsElems, and casacore::PtrBlock< T >::nelements().
Referenced by toArray().
TableExprNodeSet& casacore::TableExprNodeSet::operator= | ( | const TableExprNodeSet & | ) | [private] |
A copy of a TableExprNodeSet cannot be made.
Reimplemented from casacore::TableExprNodeRep.
const TableExprNodeSetElem & casacore::TableExprNodeSet::operator[] | ( | uInt | index | ) | const [inline] |
TableExprNodeRep* casacore::TableExprNodeSet::setOrArray | ( | ) | const |
Try to convert the set to an array.
If not possible, a copy of the set is returned.
void casacore::TableExprNodeSet::show | ( | ostream & | os, | |
uInt | indent | |||
) | const [virtual] |
Show the node.
Reimplemented from casacore::TableExprNodeRep.
MArray< T > casacore::TableExprNodeSet::toArray | ( | const TableExprId & | id | ) | const [inline] |
TODO: align possible units
Handle a nested array; this is done recursively.
Definition at line 503 of file ExprNodeSet.h.
References casacore::MArray< T >::array(), DebugAssert, casacore::C::e, casacore::False, getArray(), hasArrays(), casacore::MArrayBase::hasMask(), casacore::IPosition::isEqual(), casacore::MArrayBase::isNull(), itsBounded, itsElems, casacore::mask(), casacore::MArrayBase::mask(), nelements(), casacore::Vector< T >::resize(), casacore::Array< T >::resize(), casacore::LatticeExprNode::shape(), casacore::MArrayBase::shape(), casacore::ArrayBase::size(), and casacore::True.
TableExprNodeRep* casacore::TableExprNodeSet::toConstArray | ( | ) | const [private] |
Convert the const set to an array.
Definition at line 472 of file ExprNodeSet.h.
Bool casacore::TableExprNodeSet::itsBounded [private] |
Definition at line 470 of file ExprNodeSet.h.
Referenced by isBounded(), and toArray().
Definition at line 471 of file ExprNodeSet.h.
Bool casacore::TableExprNodeSet::itsDiscrete [private] |
Definition at line 469 of file ExprNodeSet.h.
Referenced by isDiscrete().
Definition at line 467 of file ExprNodeSet.h.
Referenced by nelements(), operator[](), and toArray().
Block<Double> casacore::TableExprNodeSet::itsEnd [private] |
Definition at line 474 of file ExprNodeSet.h.
Definition at line 475 of file ExprNodeSet.h.
Bool casacore::TableExprNodeSet::itsSingle [private] |
Definition at line 468 of file ExprNodeSet.h.
Referenced by isSingle().
Block<Double> casacore::TableExprNodeSet::itsStart [private] |
Definition at line 473 of file ExprNodeSet.h.