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

Class to hold the table expression nodes for an element in a set. More...

#include <ExprNodeSet.h>

Inheritance diagram for casa::TableExprNodeSetElem:
casa::TableExprNodeRep

List of all members.

Public Member Functions

 TableExprNodeSetElem (const TableExprNode &node)
 Create the object for a single expression node.
 TableExprNodeSetElem (const TableExprNode *start, const TableExprNode *end, const TableExprNode *incr, Bool isEndExcl=False)
 Create the object for a discrete interval.
 TableExprNodeSetElem (Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
 Create the object for a continuous bounded interval.
 TableExprNodeSetElem (Bool isLeftClosed, const TableExprNode &start)
 Create the object for a continuous left-bounded interval.
 TableExprNodeSetElem (const TableExprNode &end, Bool isRightClosed)
 Create the object for a continuous right-bounded interval.
 TableExprNodeSetElem (const TableExprNodeSetElem &)
 Copy constructor (copy semantics).
 ~TableExprNodeSetElem ()
void show (ostream &os, uInt indent) const
 Show the node.
Bool isDiscrete () const
 Is it a discrete set element.
Bool isSingle () const
 Is a single value given?
Bool isLeftClosed () const
 Is the interval left or right closed?
Bool isRightClosed () const
TableExprNodeRepstart () const
 Get the start, end or increment expression.
TableExprNodeRepend () const
TableExprNodeRepincrement () const
void fillVector (Vector< Bool > &vec, uInt &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 is given by argument cnt which gets incremented with the number of values appended.
void fillVector (Vector< Int64 > &vec, uInt &cnt, const TableExprId &id) const
void fillVector (Vector< Double > &vec, uInt &cnt, const TableExprId &id) const
void fillVector (Vector< DComplex > &vec, uInt &cnt, const TableExprId &id) const
void fillVector (Vector< String > &vec, uInt &cnt, const TableExprId &id) const
void fillVector (Vector< MVTime > &vec, uInt &cnt, const TableExprId &id) const
void matchBool (Bool *match, const Bool *value, uInt nval, const TableExprId &id) const
 Set a flag in the match output array if the corresponding element in the value array is included in this set element.
void matchInt (Bool *match, const Int64 *value, uInt nval, const TableExprId &id) const
void matchDouble (Bool *match, const Double *value, uInt nval, const TableExprId &id) const
void matchDComplex (Bool *match, const DComplex *value, uInt nval, const TableExprId &id) const
void matchString (Bool *match, const String *value, uInt nval, const TableExprId &id) const
void matchDate (Bool *match, const MVTime *value, uInt nval, const TableExprId &id) const
TableExprNodeSetElemevaluate (const TableExprId &id) const
 Evaluate the element for the given row and construct a new (constant) element from it.
void checkTable ()
 Get the table of a node and check if the children use the same table.
virtual void adaptSetUnits (const Unit &)
 Let a set node convert itself to the given unit.

Private Member Functions

TableExprNodeSetElemoperator= (const TableExprNodeSetElem &)
 A copy of a TableExprNodeSetElem cannot be made.
 TableExprNodeSetElem (const TableExprNodeSetElem &that, TableExprNodeRep *start, TableExprNodeRep *end, TableExprNodeRep *incr)
 Construct an element from the given parts and take over their pointers.
void setup (Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
 Setup the object for a continuous interval.

Private Attributes

TableExprNodeRepitsStart
TableExprNodeRepitsEnd
TableExprNodeRepitsIncr
Bool itsEndExcl
Bool itsLeftClosed
Bool itsRightClosed
Bool itsDiscrete
Bool itsSingle

Detailed Description

Class to hold the table expression nodes for an element in a set.

Intended use:

Public interface

Review Status

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

Prerequisite

Synopsis

This class is used to assemble the table expression nodes representing an element in a set. A set element can be of 3 types:

  1. A single discrete value, which can be of any type. It can be used for 3 purposes:
    - A function argument.
    - A single index in an array indexing operation.
    - A single value in a set (used with the IN operator). This is in fact a bounded discrete interval (see below).
  2. A discrete interval consisting of start, end and increment. Each of those has to be an int scalar. Increment defaults to 1. It can be used for 2 purposes:
    - A slice in an array indexing operation. In that case start defaults to the beginning of the dimension and end defaults to the end.
    - A discrete interval in a set. Start has to be given. When end is not given, the result is an unbounded discrete interval. For a discrete interval, the type of start and end can also be a datetime scalar.
  3. A continuous interval, which can only be used in a set. It consists of a start and/or an end scalar value of type int, double, datetime, or string. The interval can be open or closed on one or both sides.

Note the difference between a discrete and a continuous interval. E.g. the discrete interval 2,6 consists of the five values 2,3,4,5,6. The continuous interval 2,6 consists of all values between them.
Further note that a bounded discrete interval is automatically converted to a vector, which makes it possible to apply array functions to it.

Definition at line 92 of file ExprNodeSet.h.


Constructor & Destructor Documentation

Create the object for a single expression node.

casa::TableExprNodeSetElem::TableExprNodeSetElem ( const TableExprNode start,
const TableExprNode end,
const TableExprNode incr,
Bool  isEndExcl = False 
)

Create the object for a discrete interval.

Each of the start, end, and incr pointers can be zero meaning that they are not given (see the synopsis for an explanation). Optionally the end is inclusive (C++ and Glish style) or exclusive (Python style).

casa::TableExprNodeSetElem::TableExprNodeSetElem ( Bool  isLeftClosed,
const TableExprNode start,
const TableExprNode end,
Bool  isRightClosed 
)

Create the object for a continuous bounded interval.

It can be open or closed on either side.

Create the object for a continuous left-bounded interval.

Create the object for a continuous right-bounded interval.

Copy constructor (copy semantics).

Construct an element from the given parts and take over their pointers.

It is used by evaluate to construct an element in a rather cheap way.


Member Function Documentation

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

Let a set node convert itself to the given unit.

Reimplemented from casa::TableExprNodeRep.

Get the table of a node and check if the children use the same table.

Definition at line 245 of file ExprNodeSet.h.

References itsEnd.

Evaluate the element for the given row and construct a new (constant) element from it.

This is used by the system to implement a set in a GIVING clause.

void casa::TableExprNodeSetElem::fillVector ( Vector< Bool > &  vec,
uInt 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 is given by argument cnt which gets incremented with the number of values appended.

This is used by the system to convert a set to a vector.

void casa::TableExprNodeSetElem::fillVector ( Vector< Int64 > &  vec,
uInt cnt,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::fillVector ( Vector< Double > &  vec,
uInt cnt,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::fillVector ( Vector< DComplex > &  vec,
uInt cnt,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::fillVector ( Vector< String > &  vec,
uInt cnt,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::fillVector ( Vector< MVTime > &  vec,
uInt cnt,
const TableExprId id 
) const

Definition at line 249 of file ExprNodeSet.h.

References itsIncr.

Is it a discrete set element.

Definition at line 225 of file ExprNodeSet.h.

References itsDiscrete.

Is the interval left or right closed?

Definition at line 233 of file ExprNodeSet.h.

References itsLeftClosed.

Definition at line 237 of file ExprNodeSet.h.

References itsRightClosed.

Is a single value given?

Definition at line 229 of file ExprNodeSet.h.

References itsSingle.

void casa::TableExprNodeSetElem::matchBool ( Bool match,
const Bool value,
uInt  nval,
const TableExprId id 
) const

Set a flag in the match output array if the corresponding element in the value array is included in this set element.

This is used by the system to implement the IN operator.
Note that it does NOT set match values to False; it is assumed they are initialized that way.

void casa::TableExprNodeSetElem::matchDate ( Bool match,
const MVTime value,
uInt  nval,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::matchDComplex ( Bool match,
const DComplex *  value,
uInt  nval,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::matchDouble ( Bool match,
const Double value,
uInt  nval,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::matchInt ( Bool match,
const Int64 value,
uInt  nval,
const TableExprId id 
) const
void casa::TableExprNodeSetElem::matchString ( Bool match,
const String value,
uInt  nval,
const TableExprId id 
) const
TableExprNodeSetElem& casa::TableExprNodeSetElem::operator= ( const TableExprNodeSetElem ) [private]

A copy of a TableExprNodeSetElem cannot be made.

void casa::TableExprNodeSetElem::setup ( Bool  isLeftClosed,
const TableExprNode start,
const TableExprNode end,
Bool  isRightClosed 
) [private]

Setup the object for a continuous interval.

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

Show the node.

Reimplemented from casa::TableExprNodeRep.

Get the start, end or increment expression.

Note that the pointer returned can be zero indicating that that value was not given.

Definition at line 241 of file ExprNodeSet.h.

References itsStart.


Member Data Documentation

Definition at line 219 of file ExprNodeSet.h.

Referenced by isDiscrete().

Definition at line 214 of file ExprNodeSet.h.

Referenced by end().

Definition at line 216 of file ExprNodeSet.h.

Definition at line 215 of file ExprNodeSet.h.

Referenced by increment().

Definition at line 217 of file ExprNodeSet.h.

Referenced by isLeftClosed().

Definition at line 218 of file ExprNodeSet.h.

Referenced by isRightClosed().

Definition at line 220 of file ExprNodeSet.h.

Referenced by isSingle().

Definition at line 213 of file ExprNodeSet.h.

Referenced by start().


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