rasdaman complete source
qtoperation.hh
Go to the documentation of this file.
1 #ifndef _QTOPERATION_
2 #define _QTOPERATION_
3 
4 #ifndef CPPSTDLIB
5 #include <ospace/string.h> // STL<ToolKit>
6 #else
7 #include <string>
8 #endif
9 
10 #include "qlparser/qtnode.hh"
11 
12 class QtData; // forward declaration of a subclass of QtOperation
13 
14 #include <iostream>
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 //@ManMemo: Module: {\bf qlparser}
46 
47 /*@Doc:
48 
49 QtOperation defines a method {\tt evaluate()} getting a tupel of {\tt QtData} and returning
50 a {\tt QtData} element. Every subclass has to redefine this method to compute its specific
51 operation. Therefore, it takes its inputs which are also of type {\tt QtOperation}, and
52 invokes the {\tt evaluate()} method again. The results are used as operands and the
53 computed value is returned.
54 
55 */
56 
57 class QtOperation : public QtNode
58 {
59 public:
61  QtOperation();
62 
64  QtOperation( QtNode* parent );
65 
67  virtual QtOperation* getUniqueOrder( const QtNode::QtNodeType ID );
68 
74  virtual QtData* evaluate( QtDataList* inputList );
76 
83  virtual void optimizeLoad( QtTrimList* trimList );
85 
87  virtual const QtTypeElement& checkType( QtTypeTuple* typeTuple = NULL );
93  //@Man: Read/Write methods
95  inline void setDataStreamType( const QtTypeElement& type );
99  inline const QtTypeElement& getDataStreamType() const;
101 
102 
103  void printTree( int tab, std::ostream& s, QtChildType mode=QT_ALL_NODES );
104 
105  void printAlgebraicExpression( std::ostream& s );
106 
107 protected:
110 
111 private:
113  static const QtNodeType nodeType;
114 };
115 
116 #include "qlparser/qtoperation.icc"
117 
118 #endif
119 
120 
void printAlgebraicExpression(std::ostream &s)
prints the algebraic expression
std::vector< QtData * > QtDataList
list of QtData pointers
Definition: qtnode.hh:77
std::vector< QtTrimElement * > QtTrimList
list of QtTrimData structures
Definition: qtnode.hh:88
Definition: qtnode.hh:463
QtTypeElement dataStreamType
result type of the node
Definition: qtoperation.hh:109
Definition: qtdata.hh:83
const QtTypeElement & getDataStreamType() const
virtual void optimizeLoad(QtTrimList *trimList)
optimizing load access
QtChildType
Definition: qtnode.hh:186
QtNodeType
Definition: qtnode.hh:93
Definition: qtnode.hh:394
QtOperation()
default constructor
virtual const QtTypeElement & checkType(QtTypeTuple *typeTuple=NULL)
type checking of the subtree
virtual QtOperation * getUniqueOrder(const QtNode::QtNodeType ID)
for associative law
Definition: qtnode.hh:73
void setDataStreamType(const QtTypeElement &type)
virtual QtData * evaluate(QtDataList *inputList)
method for evaluating the node
Definition: qtoperation.hh:57
void printTree(int tab, std::ostream &s, QtChildType mode=QT_ALL_NODES)
prints the tree
Definition: qtnode.hh:190