casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Types | Private Member Functions | Private Attributes
casa::TableExprNodeSet Class Reference

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

#include <ExprNodeSet.h>

Inheritance diagram for casa::TableExprNodeSet:
casa::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 &)
 Add an element to the set.
void show (ostream &os, uInt indent) const
 Show the node.
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 no 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.
TableExprNodeReptoArray () const
 Convert the const set to an array.
virtual Array< BoolgetArrayBool (const TableExprId &id)
 Get an array value for this bounded set in the given row.
virtual Array< Int64getArrayInt (const TableExprId &id)
virtual Array< DoublegetArrayDouble (const TableExprId &id)
virtual Array< DComplex > getArrayDComplex (const TableExprId &id)
virtual Array< StringgetArrayString (const TableExprId &id)
virtual Array< 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 Array< BoolhasArrayBool (const TableExprId &id, const Array< Bool > &value)
virtual Array< BoolhasArrayInt (const TableExprId &id, const Array< Int64 > &value)
virtual Array< BoolhasArrayDouble (const TableExprId &id, const Array< Double > &value)
virtual Array< BoolhasArrayDComplex (const TableExprId &id, const Array< DComplex > &value)
virtual Array< BoolhasArrayString (const TableExprId &id, const Array< String > &value)
virtual Array< BoolhasArrayDate (const TableExprId &id, const Array< 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.
Array< BooltoArrayBool (const TableExprId &id) const
 Convert a bounded set to an Array.
Array< Int64toArrayInt (const TableExprId &id) const
Array< DoubletoArrayDouble (const TableExprId &id) const
Array< DComplex > toArrayDComplex (const TableExprId &id) const
Array< StringtoArrayString (const TableExprId &id) const
Array< MVTimetoArrayDate (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 298 of file ExprNodeSet.h.


Member Typedef Documentation

typedef Bool(TableExprNodeSet::* casa::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 428 of file ExprNodeSet.h.


Constructor & Destructor Documentation

Construct an empty set.

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.

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.

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].


Member Function Documentation

virtual void casa::TableExprNodeSet::adaptSetUnits ( const Unit ) [virtual]

Let a set node convert itself to the given unit.

Reimplemented from casa::TableExprNodeRep.

Add an element to the set.

Check if the data type of the set elements are the same.

If not, an exception is thrown.

Sort and combine intervals.

Delete all set elements in itsElems.

virtual Array<Bool> casa::TableExprNodeSet::getArrayBool ( const TableExprId id) [virtual]

Get an array value for this bounded set in the given row.

Reimplemented from casa::TableExprNodeRep.

virtual Array<MVTime> casa::TableExprNodeSet::getArrayDate ( const TableExprId id) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<DComplex> casa::TableExprNodeSet::getArrayDComplex ( const TableExprId id) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Double> casa::TableExprNodeSet::getArrayDouble ( const TableExprId id) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Int64> casa::TableExprNodeSet::getArrayInt ( const TableExprId id) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<String> casa::TableExprNodeSet::getArrayString ( const TableExprId id) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Bool> casa::TableExprNodeSet::hasArrayBool ( const TableExprId id,
const Array< Bool > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Bool> casa::TableExprNodeSet::hasArrayDate ( const TableExprId id,
const Array< MVTime > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Bool> casa::TableExprNodeSet::hasArrayDComplex ( const TableExprId id,
const Array< DComplex > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Bool> casa::TableExprNodeSet::hasArrayDouble ( const TableExprId id,
const Array< Double > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Array<Bool> casa::TableExprNodeSet::hasArrayInt ( const TableExprId id,
const Array< Int64 > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

Contains the set array values?

virtual Array<Bool> casa::TableExprNodeSet::hasArrayString ( const TableExprId id,
const Array< String > &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasBool ( const TableExprId id,
Bool  value 
) [virtual]

Does a value occur in the set?

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasDate ( const TableExprId id,
const MVTime value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasDComplex ( const TableExprId id,
const DComplex &  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasDouble ( const TableExprId id,
Double  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasInt ( const TableExprId id,
Int64  value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

virtual Bool casa::TableExprNodeSet::hasString ( const TableExprId id,
const String value 
) [virtual]

Reimplemented from casa::TableExprNodeRep.

Is the set fully bounded (discrete and no undefined end values)?

Definition at line 456 of file ExprNodeSet.h.

References itsBounded.

Contains the set only discrete elements? Discrete means that no continuous ranges are given, but discrete ranges (using :) are possible.

Definition at line 452 of file ExprNodeSet.h.

References itsDiscrete.

Contains the set only single elements? Single means that only single values are given (thus no end nor incr).

Definition at line 448 of file ExprNodeSet.h.

References itsSingle.

Get the number of elements.

Definition at line 460 of file ExprNodeSet.h.

References itsElems, and casa::PtrBlock< T >::nelements().

TableExprNodeSet& casa::TableExprNodeSet::operator= ( const TableExprNodeSet ) [private]

A copy of a TableExprNodeSet cannot be made.

const TableExprNodeSetElem & casa::TableExprNodeSet::operator[] ( uInt  index) const [inline]

Get the i-th element.

Definition at line 465 of file ExprNodeSet.h.

References itsElems.

void casa::TableExprNodeSet::setFindFunc ( Bool  isLeftClosed,
Bool  isRightClosed 
) [private]

Try to convert the set to an array.

If not possible, a copy of the set is returned.

void casa::TableExprNodeSet::show ( ostream &  os,
uInt  indent 
) const [virtual]

Show the node.

Reimplemented from casa::TableExprNodeRep.

Convert the const set to an array.

Array<Bool> casa::TableExprNodeSet::toArrayBool ( const TableExprId id) const [private]

Convert a bounded set to an Array.

Array<MVTime> casa::TableExprNodeSet::toArrayDate ( const TableExprId id) const [private]
Array<DComplex> casa::TableExprNodeSet::toArrayDComplex ( const TableExprId id) const [private]
Array<Int64> casa::TableExprNodeSet::toArrayInt ( const TableExprId id) const [private]

Member Data Documentation

Definition at line 441 of file ExprNodeSet.h.

Definition at line 439 of file ExprNodeSet.h.

Referenced by isBounded().

Definition at line 440 of file ExprNodeSet.h.

Definition at line 438 of file ExprNodeSet.h.

Referenced by isDiscrete().

     

Definition at line 436 of file ExprNodeSet.h.

Referenced by nelements(), and operator[]().

Definition at line 443 of file ExprNodeSet.h.

Definition at line 444 of file ExprNodeSet.h.

Definition at line 437 of file ExprNodeSet.h.

Referenced by isSingle().

Definition at line 442 of file ExprNodeSet.h.


The documentation for this class was generated from the following file: