QueryCapabilities.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/dataaccess/query/QueryCapabilities.h
22 
23  \brief A class that informs the query support of a given data source.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_QUERYCAPABILITIES_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_QUERYCAPABILITIES_H
28 
29 // TerraLib
30 #include "../../geometry/Enums.h"
31 #include "../Config.h"
32 
33 // STL
34 #include <set>
35 #include <string>
36 
37 namespace te
38 {
39  namespace da
40  {
41  /*!
42  \class QueryCapabilities
43 
44  \brief A class that informs the query support of a given data source.
45 
46  \ingroup dataaccess
47  */
49  {
50  public:
51 
52  /*! \brief Constructor. */
54 
55  /*! \brief Destructor. */
57 
58  public:
59 
60  bool supportsSQLDialect() const;
61 
62  void setSupportSQLDialect(const bool& support);
63 
64  bool supportsSpatialSQLDialect() const;
65 
66  void setSupportSpatialSQLDialect(const bool& support);
67 
68  bool supportsInsert() const;
69 
70  void setSupportInsert(const bool& support);
71 
72  bool supportsUpdate() const;
73 
74  void setSupportUpdate(const bool& support);
75 
76  bool supportsDelete() const;
77 
78  void setSupportDelete(const bool& support);
79 
80  bool supportsCreate() const;
81 
82  void setSupportCreate(const bool& support);
83 
84  bool supportsDrop() const;
85 
86  void setSupportDrop(const bool& support);
87 
88  bool supportsAlter() const;
89 
90  void setSupportAlter(const bool& support);
91 
92  bool supportsSelect() const;
93 
94  void setSupportSelect(const bool& support);
95 
96  bool supportsSelectInto() const;
97 
98  void setSupportSelectInto(const bool& support);
99 
100  void setSupportAll();
101 
102  const std::set<std::string>& getSpatialOperators() const;
103 
104  void addSpatialOperator(const std::string& op);
105 
106  const std::set<std::string>& getSpatialTopologicOperators() const;
107 
108  void addSpatialTopologicOperator(const std::string& op);
109 
110  const std::set<std::string>& getSpatialMetricOperators() const;
111 
112  void addSpatialMetricOperator(const std::string& op);
113 
114  const std::set<std::string>& getSpatialNewGeomOperators() const;
115 
116  void addSpatialNewGeomOperator(const std::string& op);
117 
118  const std::set<std::string>& getLogicalOperators() const;
119 
120  void addLogicalOperator(const std::string& op);
121 
122  const std::set<std::string>& getComparsionOperators() const;
123 
124  void addComparsionOperator(const std::string& op);
125 
126  const std::set<std::string>& getArithmeticOperators() const;
127 
128  void addArithmeticOperator(const std::string& op);
129 
130  const std::set<std::string>& getFunctions() const;
131 
132  void addFunction(const std::string& op);
133 
134  const std::set<te::gm::GeomType>& getGeometryOperands() const;
135 
136  void addGeometryOperand(const te::gm::GeomType& type);
137 
138  private:
139 
140  bool m_sqlDialect; //!< A flag that indicates if the data source supports Query API.
141  bool m_spatialSQLDialect; //!< A flag that indicates if the data source supports spatial Query API.
142  bool m_insert; //!< A flag that indicates if the data source supports the INSERT command.
143  bool m_update; //!< A flag that indicates if the data source supports the UPDATE command.
144  bool m_delete; //!< A flag that indicates if the data source supports the DELETE command.
145  bool m_create; //!< A flag that indicates if the data source supports the CREATE command.
146  bool m_drop; //!< A flag that indicates if the data source supports the DROP command.
147  bool m_alter; //!< A flag that indicates if the data source supports the ALTER command.
148  bool m_select; //!< A flag that indicates if the data source supports the SELECT command.
149  bool m_selectInto; //!< A flag that indicates if the data source supports the SELECT INTO command.
150 
151  std::set<std::string> m_spatialTopologicOperators; //!< The names of topological supported operators (touches, crosses, etc).
152  std::set<std::string> m_spatialMetricOperators; //!< The names of spatial metric supported operators (area, lenght, etc).
153  std::set<std::string> m_spatialNewGeomOperators; //!< The names of spatial supported operators that generate new geometries (centroid, buffer, union, intersection,etc).
154  std::set<std::string> m_spatialOperators; //!< The names of other spatial supported operators.
155 
156  std::set<std::string> m_logicalOperators; //!< The names of logical supported operators.
157  std::set<std::string> m_comparsionOperators; //!< The names of comparsion supported operators.
158  std::set<std::string> m_arithmeticOperators; //!< The names of arithmetic supported operators.
159  std::set<std::string> m_functions; //!< The names of supported functions.
160  std::set<te::gm::GeomType> m_geomOperands; //!< The types of geometry supported operands.
161  };
162 
163  } // end namespace da
164 } // end namespace te
165 
166 #endif // __TERRALIB_DATAACCESS_INTERNAL_QUERYCAPABILITIES_H
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
bool m_alter
A flag that indicates if the data source supports the ALTER command.
bool m_create
A flag that indicates if the data source supports the CREATE command.
queryCapabilities addLogicalOperator("and")
std::set< std::string > m_spatialMetricOperators
The names of spatial metric supported operators (area, lenght, etc).
std::set< te::gm::GeomType > m_geomOperands
The types of geometry supported operands.
bool m_drop
A flag that indicates if the data source supports the DROP command.
queryCapabilities addComparsionOperator("=")
bool m_update
A flag that indicates if the data source supports the UPDATE command.
bool m_delete
A flag that indicates if the data source supports the DELETE command.
queryCapabilities addSpatialOperator("st_boundary")
queryCapabilities addSpatialTopologicOperator("st_contains")
A class that informs the query support of a given data source.
bool m_selectInto
A flag that indicates if the data source supports the SELECT INTO command.
std::set< std::string > m_comparsionOperators
The names of comparsion supported operators.
URI C++ Library.
std::set< std::string > m_functions
The names of supported functions.
queryCapabilities addFunction("upper")
std::set< std::string > m_spatialOperators
The names of other spatial supported operators.
dataTypeCapabilities setSupportAll()
bool m_insert
A flag that indicates if the data source supports the INSERT command.
bool m_spatialSQLDialect
A flag that indicates if the data source supports spatial Query API.
bool m_select
A flag that indicates if the data source supports the SELECT command.
std::set< std::string > m_spatialTopologicOperators
The names of topological supported operators (touches, crosses, etc).
bool m_sqlDialect
A flag that indicates if the data source supports Query API.
std::set< std::string > m_arithmeticOperators
The names of arithmetic supported operators.
std::set< std::string > m_logicalOperators
The names of logical supported operators.
std::set< std::string > m_spatialNewGeomOperators
The names of spatial supported operators that generate new geometries (centroid, buffer, union, intersection,etc).
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97
queryCapabilities addSpatialNewGeomOperator("st_centroid")
queryCapabilities addArithmeticOperator("+")
queryCapabilities addSpatialMetricOperator("st_area")