AggregateFunctCountExpression Class Reference

Represents XQuery standard function fn:count. More...

#include <aggregatefunctcountexpression.h>

Inheritance diagram for AggregateFunctCountExpression:

Inheritance graph
[legend]
Collaboration diagram for AggregateFunctCountExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AggregateFunctCountExpression (VarExpression *_var)
 Constructor.
 AggregateFunctCountExpression (VarStepExpression *_varstep)
 Constructor.
virtual ~AggregateFunctCountExpression ()
virtual void eval (OutputStream &eos, Environment *env, unsigned modus)

Private Member Functions

virtual long double calculateValue (OutputStream &eos, Environment *env, unsigned modus, bool &empty_sequence)


Detailed Description

Represents XQuery standard function fn:count.

Represents XQuery standard function fn:count, which takes either a VarExpression, e.g. fn:count($x), or a VarStepExpression, e.g. fn:count($x/bib/book) or fn:count(/bib//book) respectively, as argument and returns the number of items of the sequence located through the entered VarExpression or the entered VarStepExpression respectively.

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 60 of file aggregatefunctcountexpression.h.


Constructor & Destructor Documentation

AggregateFunctCountExpression::AggregateFunctCountExpression ( VarExpression _var  ) 

Constructor.

Constructor - creating object for a VarExpression.

Parameters:
[in] _var Pointer to a VarExpression object.

Definition at line 37 of file aggregatefunctcountexpression.cpp.

AggregateFunctCountExpression::AggregateFunctCountExpression ( VarStepExpression _varstep  ) 

Constructor.

Constructor - creating object for a VarStepExpression.

Parameters:
[in] _varstep Pointer to a VarStepExpression object.

Definition at line 41 of file aggregatefunctcountexpression.cpp.

AggregateFunctCountExpression::~AggregateFunctCountExpression (  )  [virtual]

Destructor.

Definition at line 45 of file aggregatefunctcountexpression.cpp.


Member Function Documentation

long double AggregateFunctCountExpression::calculateValue ( OutputStream eos,
Environment env,
unsigned  modus,
bool &  empty_sequence 
) [private, virtual]

Result calculation of the corresponding aggregate function.

Result calculation of the corresponding aggregate function.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to a Environment object.
[in] modus Evaluation modus.
[in] empty_sequence Indicator if aggreagte function is called on an empty sequence.
Return values:
long double Result of the corresponding aggregate function.

Implements AggregateFunctExpression.

Definition at line 99 of file aggregatefunctcountexpression.cpp.

References AggregateFunctExpression::bit, BufferIterator::clear(), ForExpression::evalSignOffForBinding(), AggregateFunctExpression::forexp, VarExpression::getId(), BufferIterator::getNext(), Environment::getNodeBinding(), MiscFunctions::getRoundFrom(), BufferIterator::init(), LOCK_CONTEXT_ALWAYS_CLEAR, READ_UP_TO_CLOSE_NONE, AggregateFunctExpression::var, and AggregateFunctExpression::varstep.

Referenced by eval().

void AggregateFunctCountExpression::eval ( OutputStream eos,
Environment env,
unsigned  modus 
) [virtual]

Evaluates the expression in the given environment.

Evaluates the expression in the given environment. The evaluation takes place in the environment that is passed to this method. In addition, the parameter modus is one of the following: EVAL_QUERY, EVAL_QUERY_SILENT or EVAL_SIGNOFF (see also the corresponding defines for more information). This method implements the XQuery semantics for the standard expression types, but also the GCX specific extensions like signOff-statements.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to an Environment object.
[in] modus The query evaluation mode.
Exceptions:
RuntimeException If illegal evaluation mode.

Implements AggregateFunctExpression.

Definition at line 48 of file aggregatefunctcountexpression.cpp.

References calculateValue(), OperandExpression::cur_val, ForExpression::eval(), EVAL_QUERY, EVAL_QUERY_SILENT, EVAL_SIGNOFF, AggregateFunctExpression::forexp, MiscFunctions::getStringFromNumerical(), OUTPUT_COUNT_ON_EMPTY_SEQUENCE, and Value::setNumVal().


Generated on Sun May 24 20:20:20 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9