casacore::TableExprNodeSet Class Reference

Class to hold multiple table expression nodes. More...

#include <ExprNodeSet.h>

Inheritance diagram for casacore::TableExprNodeSet:
casacore::TableExprNodeRep

List of all members.

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 TableExprNodeSetElemoperator[] (uInt index) const
 Get the i-th element.
Bool hasArrays () const
 Contains the set array values?
TableExprNodeRepsetOrArray () const
 Try to convert the set to an array.
template<typename T >
MArray< T > toArray (const TableExprId &id) const
virtual MArray< BoolgetArrayBool (const TableExprId &id)
 Get an array value for this bounded set in the given row.
virtual MArray< Int64getArrayInt (const TableExprId &id)
virtual MArray< DoublegetArrayDouble (const TableExprId &id)
virtual MArray< DComplex > getArrayDComplex (const TableExprId &id)
virtual MArray< StringgetArrayString (const TableExprId &id)
virtual MArray< MVTimegetArrayDate (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< BoolhasArrayBool (const TableExprId &id, const MArray< Bool > &value)
virtual MArray< BoolhasArrayInt (const TableExprId &id, const MArray< Int64 > &value)
virtual MArray< BoolhasArrayDouble (const TableExprId &id, const MArray< Double > &value)
virtual MArray< BoolhasArrayDComplex (const TableExprId &id, const MArray< DComplex > &value)
virtual MArray< BoolhasArrayString (const TableExprId &id, const MArray< String > &value)
virtual MArray< BoolhasArrayDate (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

TableExprNodeSetoperator= (const TableExprNodeSet &)
 A copy of a TableExprNodeSet cannot be made.
void deleteElems ()
 Delete all set elements in itsElems.
TableExprNodeReptoConstArray () 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< DoubleitsStart
Block< DoubleitsEnd
FindFuncPtr itsFindFunc

Detailed Description

Class to hold multiple table expression nodes.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Synopsis

This class is used to assemble several table expression nodes. It is used for 3 purposes:

  1. To hold the arguments of a function. All set elements must be single.
  2. To hold the variables of an index for an array slice. All set elements must be of type int scalar and they must represent a discrete interval (which includes single).
  3. To hold the elements of a set used with the IN operator. All set elements must be scalars of any type.

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

casacore::TableExprNodeSet::TableExprNodeSet (  ) 

Construct an empty set.

casacore::TableExprNodeSet::TableExprNodeSet ( const IPosition  ) 

Construct from an IPosition.

The number of elements in the set is the number of elements in the IPosition. All set elements are single values.

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 (  ) 

Member Function Documentation

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.

Bool casacore::TableExprNodeSet::findClosedClosed ( Double  value  )  [private]
Bool casacore::TableExprNodeSet::findClosedOpen ( Double  value  )  [private]
Bool casacore::TableExprNodeSet::findOpenClosed ( Double  value  )  [private]
Bool casacore::TableExprNodeSet::findOpenOpen ( Double  value  )  [private]
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]
void casacore::TableExprNodeSet::getArray ( MArray< String > &  marr,
TableExprNodeRep node,
const TableExprId id 
) const [inline, private]
void casacore::TableExprNodeSet::getArray ( MArray< DComplex > &  marr,
TableExprNodeRep node,
const TableExprId id 
) const [inline, private]
void casacore::TableExprNodeSet::getArray ( MArray< Double > &  marr,
TableExprNodeRep node,
const TableExprId id 
) const [inline, private]
void casacore::TableExprNodeSet::getArray ( MArray< Int64 > &  marr,
TableExprNodeRep node,
const TableExprId id 
) const [inline, private]
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]

Get the i-th element.

Definition at line 496 of file ExprNodeSet.h.

References itsElems.

void casacore::TableExprNodeSet::setFindFunc ( Bool  isLeftClosed,
Bool  isRightClosed 
) [private]
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.

template<typename T >
MArray< T > casacore::TableExprNodeSet::toArray ( const TableExprId id  )  const [inline]
TableExprNodeRep* casacore::TableExprNodeSet::toConstArray (  )  const [private]

Convert the const set to an array.


Member Data Documentation

Definition at line 472 of file ExprNodeSet.h.

Definition at line 470 of file ExprNodeSet.h.

Referenced by isBounded(), and toArray().

Definition at line 471 of file ExprNodeSet.h.

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().

Definition at line 474 of file ExprNodeSet.h.

Definition at line 475 of file ExprNodeSet.h.

Definition at line 468 of file ExprNodeSet.h.

Referenced by isSingle().

Definition at line 473 of file ExprNodeSet.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1