rasdaman complete source
qtbinaryoperation.hh
Go to the documentation of this file.
1 #ifndef _QTBINARYOPERATION_
2 #define _QTBINARYOPERATION_
3 
4 #ifndef CPPSTDLIB
5 #include <ospace/string.h> // STL<ToolKit>
6 #else
7 #include <string>
8 #endif
9 
10 #include <stdio.h>
11 
12 #include "qlparser/qtoperation.hh"
13 
14 /*
15 * This file is part of rasdaman community.
16 *
17 * Rasdaman community is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * Rasdaman community is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
29 *
30 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
31 rasdaman GmbH.
32 *
33 * For more information please see <http://www.rasdaman.org>
34 * or contact Peter Baumann via <baumann@rasdaman.com>.
35 */
36 /**************************************************************
37  *
38  *
39  * COMMENTS:
40  *
41  ************************************************************/
42 
43 //@ManMemo: Module: {\bf qlparser}
44 
45 /*@Doc:
46 
47 The class serves as superclass for all operation classes taking two
48 arguments.
49 
50 */
51 
53 {
54 public:
57 
59  QtBinaryOperation( QtNode* node );
60 
63 
65  virtual ~QtBinaryOperation();
66 
68  virtual void simplify();
69 
71  virtual bool equalMeaning( QtNode* node );
78  virtual QtNodeList* getChilds( QtChildType flag );
80 
82  virtual std::string getSpelling();
83 
85  virtual QtAreaType getAreaType();
86 
88  inline virtual void setInput( QtOperation* inputOld, QtOperation* inputNew );
89 
91  virtual void optimizeLoad( QtTrimList* trimList );
98  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
100 
101  //@Man: read/write methods for the operands
103  inline void setInput1( QtOperation* input );
107  inline void setInput2( QtOperation* input );
109  inline QtOperation* getInput1();
111  inline QtOperation* getInput2();
113 
114 
116  virtual bool isCommutative() const;
117 
118 protected:
120  bool getOperands( QtDataList* inputList, QtData* &operand1, QtData* &operand2 );
128  bool getOperand( QtDataList* inputList, QtData* &operand1, int number);
141 };
142 
143 #include "qlparser/qtbinaryoperation.icc"
144 
145 #endif
146 
147 
std::list< QtNode * > QtNodeList
list of QtNode pointers
Definition: qtnode.hh:91
QtBinaryOperation()
default constructor
std::vector< QtData * > QtDataList
list of QtData pointers
Definition: qtnode.hh:77
std::vector< QtTrimElement * > QtTrimList
list of QtTrimData structures
Definition: qtnode.hh:88
virtual std::string getSpelling()
creates a unique name for a subexpression
QtAreaType
Definition: qtnode.hh:180
virtual void simplify()
simplifies the tree
virtual void printTree(int tab, std::ostream &s=std::cout, QtChildType mode=QT_ALL_NODES)
debugging method
Definition: qtdata.hh:83
virtual void setInput(QtOperation *inputOld, QtOperation *inputNew)
method for query rewrite
QtChildType
Definition: qtnode.hh:186
QtOperation * input2
second operation operand
Definition: qtbinaryoperation.hh:140
virtual bool isCommutative() const
returns commutativity information (by default, an operation IS commutative)
virtual QtAreaType getAreaType()
test if the edge to the parent node is of type mdd or atomic
Definition: qtbinaryoperation.hh:52
void setInput2(QtOperation *input)
void setInput1(QtOperation *input)
QtOperation * getInput1()
bool getOperand(QtDataList *inputList, QtData *&operand1, int number)
method for testing and evaluating the input branches
Definition: qtnode.hh:73
QtOperation * input1
first operation operand
Definition: qtbinaryoperation.hh:138
virtual QtNodeList * getChilds(QtChildType flag)
return childs of the node
Definition: qtoperation.hh:57
QtOperation * getInput2()
bool getOperands(QtDataList *inputList, QtData *&operand1, QtData *&operand2)
method for testing and evaluating the input branches
virtual ~QtBinaryOperation()
virtual destructor
Definition: qtnode.hh:190
virtual bool equalMeaning(QtNode *node)
test if the two nodes have an equal meaning in the query tree
virtual void optimizeLoad(QtTrimList *trimList)
optimizing load access