rasdaman complete source
qtunaryinduce.hh
Go to the documentation of this file.
1 #ifndef _QTUNARYINDUCE_HH_
2 #define _QTUNARYINDUCE_HH_
3 
4 #ifndef CPPSTDLIB
5 #include <ospace/string.h> // STL<ToolKit>
6 #else
7 #include <string>
8 #endif
9 
11 #include "qlparser/qtmdd.hh"
12 #include "qlparser/qtatomicdata.hh"
13 
14 #include "catalogmgr/ops.hh"
15 
16 /*
17 * This file is part of rasdaman community.
18 *
19 * Rasdaman community is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation, either version 3 of the License, or
22 * (at your option) any later version.
23 *
24 * Rasdaman community is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
31 *
32 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
33 rasdaman GmbH.
34 *
35 * For more information please see <http://www.rasdaman.org>
36 * or contact Peter Baumann via <baumann@rasdaman.com>.
37 */
38 /*************************************************************
39  *
40  *
41  * COMMENTS:
42  *
43  ************************************************************/
44 
45 
46 //@ManMemo: Module: {\bf qlparser}
47 
48 /*@Doc:
49 
50 This class has just QtNot as subclass which represents the not operations
51 {\tt MDD<Bool> -> MDD<Bool>} and {\tt MDD<Int> -> MDD<Int>}.
52 
53 */
54 
56 {
57 public:
60 
61 protected:
63  QtData* computeOp( QtData* operand, Ops::OpType operation );
64 
66  bool getOperand( QtDataList* inputList, QtData* &operand );
74  QtData* computeUnaryMDDOp( QtMDD* operand, const BaseType* resultBaseType, Ops::OpType operation, unsigned int operandOffset = 0 );
82  QtData* computeUnaryOp( QtScalarData* operand, const BaseType* resultBaseType, Ops::OpType operation, unsigned int operandOffset = 0 );
88 private:
90  static const QtNodeType nodeType;
91 };
92 
93 
94 
95 //@ManMemo: Module: {\bf qlparser}
96 
97 /*@Doc:
98 
99 */
100 
101 class QtNot : public QtUnaryInduce
102 {
103 public:
105  QtNot( QtOperation* input );
106 
108  QtData* evaluate( QtDataList* inputList );
109 
115  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
117 
119  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
120 
122  inline virtual const QtNodeType getNodeType() const;
123 
125  virtual const QtTypeElement& checkType( QtTypeTuple* typeTuple = NULL );
126 
127 private:
129  static const QtNodeType nodeType;
130 };
131 
132 
133 
134 //@ManMemo: Module: {\bf qlparser}
135 
136 /*@Doc:
137 
138 */
139 
140 class QtDot : public QtUnaryInduce
141 {
142 public:
144  QtDot( const std::string& elementName );
145 
147  QtDot( unsigned int elementNo );
148 
150  virtual std::string getSpelling();
151 
153  virtual bool equalMeaning( QtNode* node );
154 
156  QtData* evaluate( QtDataList* inputList );
162  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
164 
166  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
167 
169  inline virtual const QtNodeType getNodeType() const;
170 
172  virtual const QtTypeElement& checkType( QtTypeTuple* typeTuple = NULL );
173 
174 private:
176  static const QtNodeType nodeType;
177 
179  std::string elementName;
180 
182  int elementNo;
188 };
189 
190 
191 //--------------------------------------------
192 // QtCast
193 //--------------------------------------------
194 //@ManMemo: Module: {\bf qlparser}
195 
196 /*@Doc:
197 QtCast provides type conversions
198 */
199 
200 class QtCast : public QtUnaryInduce
201 {
202 public:
204  {
207  };
208 
213  virtual void printTree(int, std::ostream& = std::cout, QtChildType = QT_ALL_NODES);
215  virtual void printAlgebraicExpression(std::ostream& = std::cout);
217  inline virtual const QtNodeType getNodeType() const;
219  virtual const QtTypeElement& checkType(QtTypeTuple* = NULL );
220 
221 private:
222  Ops::OpType getOp(cast_types);
223 
224  static const QtNodeType nodeType;
225  cast_types castType;
226 };
227 
228 
229 //--------------------------------------------
230 // QtRealPartOp
231 //--------------------------------------------
232 
234 {
235 public:
238  virtual void printTree(int, std::ostream& = std::cout, QtChildType = QT_ALL_NODES);
239  virtual void printAlgebraicExpression(std::ostream& = std::cout);
240  inline virtual const QtNodeType getNodeType() const;
241  virtual const QtTypeElement& checkType(QtTypeTuple* = NULL);
242 
243 private:
244  static const QtNodeType nodeType;
245 };
246 
247 //--------------------------------------------
248 // QtImaginarPartOp
249 //--------------------------------------------
250 
252 {
253 public:
256  virtual void printTree(int, std::ostream& = std::cout, QtChildType = QT_ALL_NODES);
257  virtual void printAlgebraicExpression(std::ostream& = std::cout);
258  inline virtual const QtNodeType getNodeType() const;
259  virtual const QtTypeElement& checkType(QtTypeTuple* = NULL);
260 
261 private:
262  static const QtNodeType nodeType;
263 };
264 
265 #include "autogen_qtui.hh"
266 #include "qlparser/qtunaryinduce.icc"
267 #include "autogen_qtui.icc"
268 
269 
270 #endif
271 
Definition: qtunaryinduce.hh:206
virtual std::string getSpelling()
creates a unique name for a common subexpression
std::vector< QtData * > QtDataList
list of QtData pointers
Definition: qtnode.hh:77
Definition: qtnode.hh:463
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
cast_types
Definition: qtunaryinduce.hh:203
QtData * computeUnaryOp(QtScalarData *operand, const BaseType *resultBaseType, Ops::OpType operation, unsigned int operandOffset=0)
computes an unary induce operation with one MDD object
QtData * evaluate(QtDataList *)
method for evaluating the node
virtual const QtTypeElement & checkType(QtTypeTuple *=NULL)
type checking of the subtree
virtual void printTree(int, std::ostream &=std::cout, QtChildType=QT_ALL_NODES)
prints the tree
OpType
Definition: ops.hh:121
virtual const QtNodeType getNodeType() const
method for identification of nodes
Definition: qtdata.hh:83
QtOperation * input
operation operand
Definition: qtunaryoperation.hh:105
QtData * evaluate(QtDataList *inputList)
method for evaluating the node
QtUnaryInduce(QtOperation *input)
constructor getting the operand
virtual void printAlgebraicExpression(std::ostream &s=std::cout)
prints the algebraic expression
QtChildType
Definition: qtnode.hh:186
virtual const QtNodeType getNodeType() const
method for identification of nodes
QtNodeType
Definition: qtnode.hh:93
Definition: qtnode.hh:394
QtCast(QtOperation *, cast_types)
QtData * computeOp(QtData *operand, Ops::OpType operation)
computes the unary operation
QtImaginarPartOp(QtOperation *)
Definition: qtunaryinduce.hh:55
Definition: qtunaryinduce.hh:251
virtual const QtTypeElement & checkType(QtTypeTuple *=NULL)
semantics check
QtNot(QtOperation *input)
constructor getting the operand
QtDot(const std::string &elementName)
constructor getting operand and element name
Definition: qtunaryinduce.hh:205
Definition: qtunaryoperation.hh:52
Definition: qtscalardata.hh:53
Definition: qtunaryinduce.hh:206
Definition: qtunaryinduce.hh:205
virtual void printTree(int, std::ostream &=std::cout, QtChildType=QT_ALL_NODES)
debugging method
virtual const QtNodeType getNodeType() const
methods for identification of nodes
virtual const QtTypeElement & checkType(QtTypeTuple *typeTuple=NULL)
type checking of the subtree
QtData * computeUnaryMDDOp(QtMDD *operand, const BaseType *resultBaseType, Ops::OpType operation, unsigned int operandOffset=0)
computes an unary induce operation with one MDD object
virtual void printAlgebraicExpression(std::ostream &=std::cout)
prints the algebraic expression
virtual const QtTypeElement & checkType(QtTypeTuple *typeTuple=NULL)
type checking of the subtree
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
Definition: qtunaryinduce.hh:140
Definition: qtunaryinduce.hh:101
Definition: qtunaryinduce.hh:205
QtData * evaluate(QtDataList *)
method for evaluating the node
virtual const QtTypeElement & checkType(QtTypeTuple *=NULL)
type checking of the subtree
Definition: qtunaryinduce.hh:233
Definition: qtunaryinduce.hh:206
bool getOperand(QtDataList *inputList, QtData *&operand)
method for testing and evaluating the input branch
Definition: qtnode.hh:73
Definition: relcatalogif/basetype.hh:66
virtual const QtNodeType getNodeType() const
methods for identification of nodes
virtual bool equalMeaning(QtNode *node)
tests if the two nodes have an equal meaning in the query tree
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
prints the tree
QtData * evaluate(QtDataList *)
method for evaluating the node
Definition: qtunaryinduce.hh:205
QtData * evaluate(QtDataList *inputList)
method for evaluating the node
virtual void printTree(int, std::ostream &=std::cout, QtChildType=QT_ALL_NODES)
debugging method
Definition: qtunaryinduce.hh:205
Definition: qtoperation.hh:57
QtRealPartOp(QtOperation *)
virtual void printAlgebraicExpression(std::ostream &=std::cout)
prints the algebraic expression
virtual void printAlgebraicExpression(std::ostream &=std::cout)
prints the algebraic expression
Definition: qtnode.hh:190
Definition: qtmdd.hh:58
Definition: qtunaryinduce.hh:206
virtual const QtNodeType getNodeType() const
retrives node type
Definition: qtunaryinduce.hh:200