Public Member Functions
ibis::qDiscreteRange Class Reference

A discrete range expression. More...

#include <qExpr.h>

Inheritance diagram for ibis::qDiscreteRange:
ibis::qRange ibis::qExpr

List of all members.

Public Member Functions

virtual const char * colName () const
 Name of the column.
ibis::qExprconvert () const
 Convert to a sequence of qContinuousRange.
virtual qDiscreteRangedup () const
 Duplicate thy self.
virtual bool empty () const
 Is the current range empty?
const ibis::array_t< double > & getValues () const
 Reference to the values.
ibis::array_t< double > & getValues ()
 Reference to the values.
virtual bool inRange (double val) const
 Is the argument val one of the values stored ? Return true or false.
virtual double leftBound () const
 The lower bound of the range.
virtual uint32_t nItems () const
 Count the number of items in the query expression.
virtual void print (std::ostream &) const
 Print out the node in the string form.
virtual void printFull (std::ostream &out) const
 Print out the full expression.
 qDiscreteRange ()
 Construct an empty dicrete range expression.
 qDiscreteRange (const char *col, const std::vector< uint32_t > &val)
 Construct a qDiscreteRange object from a vector of unsigned 32-bit integers.
 qDiscreteRange (const qDiscreteRange &dr)
 Copy constructor.
 qDiscreteRange (const char *col, const char *nums)
 Construct a discrete range from two strings. Used by the parser.
 qDiscreteRange (const char *col, ibis::array_t< uint32_t > &val)
 Construct a qDiscreteRange from an array of 32-bit integers.
 qDiscreteRange (const char *col, const std::vector< double > &val)
 Construct a qDiscreteRange object from a vector of double values.
 qDiscreteRange (const char *col, ibis::array_t< double > &val)
 Construct a qDiscreteRange object from an array of double values.
virtual void restrictRange (double left, double right)
 Reduce the range to be no more than [left, right].
virtual double rightBound () const
 The upper bound of the range.

Detailed Description

A discrete range expression.

It is used to capture expression of the form "A in (aaa, bbb, ccc, ...)."


Constructor & Destructor Documentation

ibis::qDiscreteRange::qDiscreteRange ( const char *  col,
const std::vector< uint32_t > &  val 
)

Construct a qDiscreteRange object from a vector of unsigned 32-bit integers.

Initially used to convert qMultiString to qDiscreteRange, but made visible to public upon user request.

References ibis::util::copy(), ibis::gVerbose, ibis::array_t< T >::push_back(), ibis::array_t< T >::reserve(), ibis::array_t< T >::resize(), and ibis::array_t< T >::size().

ibis::qDiscreteRange::qDiscreteRange ( const char *  col,
ibis::array_t< uint32_t > &  val 
)

Construct a qDiscreteRange from an array of 32-bit integers.

Note:
The incoming array is modified by this funciton. On return, it will be sorted and contains only unique values.

References ibis::util::copy(), ibis::gVerbose, ibis::array_t< T >::resize(), and ibis::array_t< T >::size().

ibis::qDiscreteRange::qDiscreteRange ( const char *  col,
ibis::array_t< double > &  val 
)

Construct a qDiscreteRange object from an array of double values.

Note:
The incoming values are sorted and only the unique ones are kept on returning from this function.

References ibis::array_t< T >::copy(), and ibis::array_t< T >::deduplicate().


Member Function Documentation

bool ibis::qDiscreteRange::inRange ( double  val) const [inline, virtual]

Is the argument val one of the values stored ? Return true or false.

It uses a binary search if there are more than 32 elements and uses linear search otherwise.

Implements ibis::qRange.

void ibis::qDiscreteRange::print ( std::ostream &  out) const [virtual]

Print out the node in the string form.

The short-form of the print function.

It only prints information about the current node of the query expression tree.

Reimplemented from ibis::qExpr.

References ibis::gVerbose.

Referenced by printFull().

virtual void ibis::qDiscreteRange::printFull ( std::ostream &  out) const [inline, virtual]

Print out the full expression.

The long form of the print function.

It recursively prints out the whole query expression tree, which can be quite long.

Reimplemented from ibis::qExpr.

References print().


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive