rasdaman complete source
qtbinaryinduce.hh
Go to the documentation of this file.
1 #ifndef _QTBINARYINDUCE_
2 #define _QTBINARYINDUCE_
3 
4 #ifndef CPPSTDLIB
5 #include <ospace/string.h> // STL<ToolKit>
6 #else
7 #include <string>
8 #endif
9 
11 #include "qlparser/qtdata.hh"
12 #include "qlparser/qtmdd.hh"
13 #include "qlparser/qtscalardata.hh"
14 
15 #include "catalogmgr/ops.hh"
16 
17 /*
18 * This file is part of rasdaman community.
19 *
20 * Rasdaman community is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
24 *
25 * Rasdaman community is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
32 *
33 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
34 rasdaman GmbH.
35 *
36 * For more information please see <http://www.rasdaman.org>
37 * or contact Peter Baumann via <baumann@rasdaman.com>.
38 */
39 /*************************************************************
40  *
41  *
42  * COMMENTS:
43  *
44  ************************************************************/
45 
46 //@ManMemo: Module: {\bf qlparser}
47 
48 /*@Doc:
49 The class hierarchy guarantees no type safety. Type checking is done at
50 execution time.
51 
52 The operations greater and greater equal are mapped to QtLess and QtLessEqual.
53 */
54 
56 {
57 public:
59  QtBinaryInduce( QtOperation* input1, QtOperation* input2, Ops::OpType initOpType );
60 
62  QtData* evaluate( QtDataList* inputList );
63 
65  virtual const QtTypeElement& checkType( QtTypeTuple* typeTuple = NULL );
66 
67 protected:
69  QtData* computeOp( QtData* operand1, QtData* operand2 );
70 
72  QtData* computeUnaryMDDOp( QtMDD* operand1, QtScalarData* operand2, const BaseType* resultBaseType, int scalarPos=1 );
80  QtData* computeBinaryMDDOp( QtMDD* operand1, QtMDD* operand2, const BaseType* resultBaseType );
88  QtData* computeBinaryOp( QtScalarData* operand1, QtScalarData* operand2, const BaseType* resultBaseType );
94 // private:
95  // type of operation
96  Ops::OpType opType;
97 
98 private:
100  static const QtNodeType nodeType;
101 
102 };
103 
104 
105 //@ManMemo: Module: {\bf qlparser}
106 
107 /*@Doc:
108 
109 */
110 
111 class QtPlus : public QtBinaryInduce
112 {
113 public:
116 
118  virtual QtOperation* getUniqueOrder( const QtNode::QtNodeType ID );
119 
121  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
122 
124  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
125 
127  inline virtual const QtNodeType getNodeType() const;
128 
129 private:
131  static const QtNodeType nodeType;
132 };
133 
134 
135 //@ManMemo: Module: {\bf qlparser}
136 
137 /*@Doc:
138 
139 */
140 
141 class QtMinus : public QtBinaryInduce
142 {
143 public:
146 
148  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
149 
151  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
152 
154  inline virtual const QtNodeType getNodeType() const;
155 
157  virtual bool isCommutative() const;
158 
159 private:
161  static const QtNodeType nodeType;
162 };
163 
164 
165 //@ManMemo: Module: {\bf qlparser}
166 
167 /*@Doc:
168 
169 */
170 
171 class QtMult : public QtBinaryInduce
172 {
173 public:
176 
178  virtual QtOperation* getUniqueOrder( const QtNode::QtNodeType ID );
179 
181  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
182 
184  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
185 
187  inline virtual const QtNodeType getNodeType() const;
188 
189 private:
191  static const QtNodeType nodeType;
192 };
193 
194 
195 //@ManMemo: Module: {\bf qlparser}
196 
197 /*@Doc:
198 
199 */
200 
201 class QtDiv : public QtBinaryInduce
202 {
203 public:
206 
208  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
209 
211  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
212 
214  inline virtual const QtNodeType getNodeType() const;
215 
217  virtual bool isCommutative() const;
218 
219 private:
221  static const QtNodeType nodeType;
222 };
223 
224 
225 #include "qlparser/qtbinaryinduce.icc"
226 
227 #endif
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
QtDiv(QtOperation *input1, QtOperation *input2)
constructor getting the two operands
std::vector< QtData * > QtDataList
list of QtData pointers
Definition: qtnode.hh:77
Definition: qtnode.hh:463
virtual bool isCommutative() const
returns FALSE saying that the operation IS NOT commutative
QtData * computeBinaryOp(QtScalarData *operand1, QtScalarData *operand2, const BaseType *resultBaseType)
computes a binary operation on two scalar objects
QtBinaryInduce(QtOperation *input1, QtOperation *input2, Ops::OpType initOpType)
constructor getting the two operands
Definition: qtdata.hh:83
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
virtual const QtNodeType getNodeType() const
method for identification of nodes
Ops::OpType opType
Definition: qtbinaryinduce.hh:96
QtMult(QtOperation *input1, QtOperation *input2)
constructor getting the two operands
QtChildType
Definition: qtnode.hh:186
QtNodeType
Definition: qtnode.hh:93
QtOperation * input2
second operation operand
Definition: qtbinaryoperation.hh:140
Definition: qtnode.hh:394
QtData * evaluate(QtDataList *inputList)
method for evaluating the node
virtual const QtNodeType getNodeType() const
method for identification of nodes
virtual const QtTypeElement & checkType(QtTypeTuple *typeTuple=NULL)
type checking of the subtree
Definition: qtbinaryinduce.hh:111
Definition: qtscalardata.hh:53
QtData * computeUnaryMDDOp(QtMDD *operand1, QtScalarData *operand2, const BaseType *resultBaseType, int scalarPos=1)
computes an unary induce operation with one MDD object and a scalar value either being atomic or comp...
Definition: qtbinaryoperation.hh:52
QtPlus(QtOperation *input1, QtOperation *input2)
constructor getting the two operands
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
virtual const QtNodeType getNodeType() const
method for identification of nodes
Definition: qtbinaryinduce.hh:55
Definition: relcatalogif/basetype.hh:66
QtData * computeBinaryMDDOp(QtMDD *operand1, QtMDD *operand2, const BaseType *resultBaseType)
computes a binary induce operation on two MDD objects
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
QtMinus(QtOperation *input1, QtOperation *input2)
constructor getting the two operands
QtOperation * input1
first operation operand
Definition: qtbinaryoperation.hh:138
Definition: qtbinaryinduce.hh:201
Definition: qtbinaryinduce.hh:171
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
virtual QtOperation * getUniqueOrder(const QtNode::QtNodeType ID)
for associative law
Definition: qtbinaryinduce.hh:141
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
virtual const QtNodeType getNodeType() const
method for identification of nodes
Definition: qtoperation.hh:57
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
QtData * computeOp(QtData *operand1, QtData *operand2)
computes the binary operation
virtual QtOperation * getUniqueOrder(const QtNode::QtNodeType ID)
optimizes the tree
Definition: qtnode.hh:190
virtual bool isCommutative() const
returns FALSE saying that the operation IS NOT commutative
Definition: qtmdd.hh:58