#include <roundingexpression.h>
Public Member Functions | |
RoundingExpression (EXP_TYPE _type, AggregateFunctExpression *_aggfunct) | |
Constructor. | |
virtual | ~RoundingExpression () |
virtual void | scopeCheck (vector< unsigned > &def_vars, vector< unsigned > &introduced_vars, vector< unsigned > &violating_vars) |
virtual void | replaceVarId (unsigned old_id, unsigned new_id) |
virtual void | extractFSAMap (FSAMap *fsamap, unsigned parent_var) |
virtual void | extractParVarMap (ParVarMap *parvarmap) |
virtual void | extractDependencies (vector< DependencySet * > *depset) |
virtual Expression * | placeSignOffs (vector< SignOffExpression * > &signoffs) |
virtual void | rewriteAggregateFuncts () |
virtual void | print (OutputStream &dos) const |
virtual void | init (BufferNode *root) |
virtual void | eval (OutputStream &eos, Environment *env, unsigned modus)=0 |
bool | isSingleValued () |
virtual void | prepareOperand (OutputStream &eos, Environment *env, unsigned modus) |
void | unprepareOperand () |
virtual Value * | getNextValue () |
Protected Attributes | |
AggregateFunctExpression * | aggfunct |
The entered AggregateFunctExpression. | |
Private Member Functions | |
virtual long double | calculateValue (OutputStream &eos, Environment *env, unsigned modus, bool &non_value)=0 |
Result calculation of the corresponding rounding function. |
Represents base class of all rounding function expressions.
Definition at line 51 of file roundingexpression.h.
RoundingExpression::RoundingExpression | ( | EXP_TYPE | _type, | |
AggregateFunctExpression * | _aggfunct | |||
) |
Constructor.
Constructor - creating object for an EXP_TYPE and a AggregateFunctExpression.
[in] | _type | EXP_TYPE. |
[in] | _aggfunct | Pointer to a AggregateFunctExpression object. |
Definition at line 37 of file roundingexpression.cpp.
RoundingExpression::~RoundingExpression | ( | ) | [virtual] |
long double RoundingExpression::calculateValue | ( | OutputStream & | eos, | |
Environment * | env, | |||
unsigned | modus, | |||
bool & | non_value | |||
) | [private, pure virtual] |
Result calculation of the corresponding rounding function.
Result calculation of the corresponding rounding function.
[in] | eos | Pointer to a OutputStream object. |
[in] | env | Pointer to a Environment object. |
[in] | modus | Evaluation modus. |
[in] | non_value | Indicator if rounding function is called on an non value, i.e. is called on an empty sequence of the corresponding aggregate function. |
long | double Result of the corresponding rounding function. |
Implemented in FunctAbsExpression, FunctCeilingExpression, FunctCoverExpression, FunctFloorExpression, FunctRoundExpression, FunctRoundHalfToEvenExpression, and FunctTruncateExpression.
void RoundingExpression::eval | ( | OutputStream & | eos, | |
Environment * | env, | |||
unsigned | modus | |||
) | [pure 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.
[in] | eos | Pointer to a OutputStream object. |
[in] | env | Pointer to an Environment object. |
[in] | modus | The query evaluation mode. |
RuntimeException | If illegal evaluation mode. |
Reimplemented from Expression.
Implemented in FunctAbsExpression, FunctCeilingExpression, FunctCoverExpression, FunctFloorExpression, FunctRoundExpression, FunctRoundHalfToEvenExpression, and FunctTruncateExpression.
Referenced by prepareOperand().
void RoundingExpression::extractDependencies | ( | vector< DependencySet * > * | depset | ) | [virtual] |
Extracts the needed dependencies of a query.
Extracts the needed dependencies of a query, which are needed for constructing the ProjectionTree.
[in,out] | depset | Pointer to a vector containing Pointer to DependencySet objects. |
void |
Reimplemented from Expression.
Definition at line 66 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::extractDependencies().
void RoundingExpression::extractFSAMap | ( | FSAMap * | fsamap, | |
unsigned | parent_var | |||
) | [virtual] |
Extracts the needed first straight ancestor (FSA) variables map.
Extracts the needed first straight ancestor (FSA) variables map, which is needed for correct insertion of SignOffExpression.
[in,out] | fsamap | Pointer to a FSAMap object. |
[in] | parent_var | Parent variable. |
void |
Reimplemented from Expression.
Definition at line 58 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::extractFSAMap().
void RoundingExpression::extractParVarMap | ( | ParVarMap * | parvarmap | ) | [virtual] |
Extracts the needed parent variable (ParVar) map.
Extracts the needed parent variable (ParVar) map, which is needed for constructing the VariableTree.
[in,out] | parvarmap | Pointer to a ParVarMap object. |
void |
Reimplemented from Expression.
Definition at line 62 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::extractParVarMap().
Value * RoundingExpression::getNextValue | ( | ) | [virtual] |
Returns the next value of the operand.
Returns the next value of the operand for iteration.
Value* | Pointer to a Value object. |
Implements OperandExpression.
Definition at line 118 of file roundingexpression.cpp.
References OperandExpression::cur_val, and OperandExpression::initial.
void RoundingExpression::init | ( | BufferNode * | root | ) | [virtual] |
Initializes the query for evaluation.
Initializes the query for evaluation. Up to now only all required BufferIterator objects are created to speed up query evaluation.
[in] | root | Pointer to a BufferNode object. |
void |
Reimplemented from Expression.
Definition at line 109 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::init().
bool RoundingExpression::isSingleValued | ( | ) | [inline, virtual] |
Returns if the result/iteration of the operand is a single value.
Returns if the result/iteration of the operand is a single value, e.g a AggregateFunctExpression returns a single value whereas a VarStepExpression may return more than one value.
bool | if the result/iteration is a single value, false otherwise. |
Implements OperandExpression.
Definition at line 122 of file roundingexpression.h.
Expression * RoundingExpression::placeSignOffs | ( | vector< SignOffExpression * > & | signoffs | ) | [virtual] |
Places all signOff-statements in the corresponding query.
Places all signOff-statements in the corresponding query, which are needed for active garbage collection by removing Role from the BufferNode.
[in] | signoffs | Pointer to a vector containing Pointer to SignOffExpression objects. |
Expression* | Pointer to a Expression object (following expression in the corresponding query). |
Reimplemented from Expression.
Definition at line 70 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::placeSignOffs().
void RoundingExpression::prepareOperand | ( | OutputStream & | eos, | |
Environment * | env, | |||
unsigned | modus | |||
) | [virtual] |
Initializes the operand if necessary.
Initializes the operand if necessary.
[in] | eos | Pointer to a OutputStream object. |
[in] | env | Pointer to a Environment object. |
[in] | modus | Evaluation modus. |
void |
Implements OperandExpression.
Definition at line 113 of file roundingexpression.cpp.
References eval(), and EVAL_QUERY_SILENT.
void RoundingExpression::print | ( | OutputStream & | dos | ) | const [virtual] |
Prints the expression.
Prints the expression.
[in] | dos | Pointer to a OutputStream object. |
void |
Implements Expression.
Definition at line 81 of file roundingexpression.cpp.
References Expression::type.
void RoundingExpression::replaceVarId | ( | unsigned | old_id, | |
unsigned | new_id | |||
) | [virtual] |
Replaces all matching variable IDs by a new one.
Replaces all matching variable IDs by a new one, which is needed in case of calling method rewriteVarsteps().
[in] | old_id | Old variable ID. |
[in] | new_id | New variable ID, which should be introduced instead. |
void |
Reimplemented from Expression.
Definition at line 54 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::replaceVarId().
void RoundingExpression::rewriteAggregateFuncts | ( | ) | [virtual] |
Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).
Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).
void |
Reimplemented from Expression.
Definition at line 77 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::rewriteAggregateFuncts().
void RoundingExpression::scopeCheck | ( | vector< unsigned > & | def_vars, | |
vector< unsigned > & | introduced_vars, | |||
vector< unsigned > & | violating_vars | |||
) | [virtual] |
Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.
Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.
[in] | def_vars | Vector containing all previously defined variables. |
[in] | introduced_vars | Vector containing all up to this expression defined variables. |
[in] | violating_vars | Vector containing all variables which violates the scope condition. |
void |
Reimplemented from Expression.
Definition at line 48 of file roundingexpression.cpp.
References aggfunct, and AggregateFunctExpression::scopeCheck().
void RoundingExpression::unprepareOperand | ( | ) | [inline, virtual] |
Resets the operand if necessary.
Resets the operand if necessary.
void |
Implements OperandExpression.
Definition at line 133 of file roundingexpression.h.
References OperandExpression::initial.
AggregateFunctExpression * RoundingExpression::aggfunct [protected] |
The entered AggregateFunctExpression.
The entered AggregateFunctExpression, which is the argument of the constructor.
Definition at line 161 of file roundingexpression.h.
Referenced by FunctTruncateExpression::calculateValue(), FunctRoundHalfToEvenExpression::calculateValue(), FunctRoundExpression::calculateValue(), FunctFloorExpression::calculateValue(), FunctCoverExpression::calculateValue(), FunctCeilingExpression::calculateValue(), FunctAbsExpression::calculateValue(), extractDependencies(), extractFSAMap(), extractParVarMap(), init(), placeSignOffs(), replaceVarId(), rewriteAggregateFuncts(), scopeCheck(), and ~RoundingExpression().