rasdaman complete source
qtcommand.hh
Go to the documentation of this file.
1 #ifndef __QTCOMMAND_HH__
2 #define __QTCOMMAND_HH___
3 
4 #include "qlparser/qtexecute.hh"
6 #include "qlparser/querytree.hh"
7 
8 #ifndef CPPSTDLIB
9 #include <ospace/string.h> // STL<ToolKit>
10 #else
11 #include <string>
12 #endif
13 #include <iostream>
14 
15 /*
16 * This file is part of rasdaman community.
17 *
18 * Rasdaman community is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
22 *
23 * Rasdaman community is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
30 *
31 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
32 rasdaman GmbH.
33 *
34 * For more information please see <http://www.rasdaman.org>
35 * or contact Peter Baumann via <baumann@rasdaman.com>.
36 */
37 /*************************************************************
38  *
39  *
40  * COMMENTS:
41  *
42  ************************************************************/
43 
44 //@ManMemo: Module: {\bf qlparser}
45 
50 class QtCommand : public QtExecute
51 {
52 public:
54  {
58  };
59 
61  QtCommand( QtCommandType initCommand, const std::string& initCollection, const std::string& initType );
62 
64  QtCommand( QtCommandType initCommand, const std::string& initCollection );
65 
67  QtCommand( QtCommandType initCommand, const std::string& initCollection, QtOperationIterator* collection);
68 
70  virtual int evaluate();
71 
73  virtual void printTree( int tab, std::ostream& s = std::cout, QtChildType mode = QT_ALL_NODES );
74 
76  virtual void printAlgebraicExpression( std::ostream& s = std::cout );
77 
79  inline virtual const QtNodeType getNodeType() const;
80 
82  virtual void checkType();
83 
84 private:
85 
87  void createCollection(std::string collectionName, std::string typeName);
88 
90  void dropCollection(std::string collectionName);
91 
93  std::string getSelectedDataType(std::vector<QtData*>* data);
94 
96  void insertIntoCollection(std::vector<QtData*>* data, std::string collectionName);
97 
99  bool collectionExists(std::string collectionName);
100 
102  QtCommandType command;
103 
105  static const QtNodeType nodeType;
106 
108  std::string collectionName;
109 
111  std::string typeName;
112 
114  QtOperationIterator *childNode;
115 
117  static const std::string tmpSetTypePrefix;
118  static const std::string tmpMddTypePrefix;
119 };
120 
121 #include "qlparser/qtcommand.icc"
122 
123 #endif
124 
125 
126 
Definition: qtcommand.hh:55
Definition: qtcommand.hh:50
Definition: qtcommand.hh:56
QtCommand(QtCommandType initCommand, const std::string &initCollection, const std::string &initType)
constructor getting command, collection and type name (create collection)
QtChildType
Definition: qtnode.hh:186
QtNodeType
Definition: qtnode.hh:93
virtual void checkType()
type checking
virtual int evaluate()
method for evaluating the node
Definition: qtoperationiterator.hh:56
virtual const QtNodeType getNodeType() const
method for identification of nodes
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
Definition: qtexecute.hh:41
Definition: qtnode.hh:190
QtCommandType
Definition: qtcommand.hh:53