Loading...
Searching...
No Matches
FilterEncoder.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/maptools/FilterEncoder.h
22
23 \brief A visitor that converts a TerraLib Expression to OGC Filter Expression.
24 */
25
26#ifndef __TERRALIB_MAPTOOLS_INTERNAL_FILTERENCODER_H
27#define __TERRALIB_MAPTOOLS_INTERNAL_FILTERENCODER_H
28
29// TerraLib
30#include "Config.h"
31#include "../dataaccess/query/QueryVisitor.h"
32
33// STL
34#include <map>
35#include <string>
36
37namespace te
38{
39// Forward declarations
40 namespace fe
41 {
42 class AbstractOp;
43 class Expression;
44 class Filter;
45 }
46
47 namespace map
48 {
49 /*!
50 \class FilterEncoder
51
52 \brief A visitor that converts a TerraLib Expression to OGC Filter Expression.
53
54 \sa Visitor
55 */
57 {
58 public:
59
60 /** @name Initializer Methods
61 * Methods related to instantiation and destruction of a Filter visitor.
62 */
63 //@{
64
65 /*! \brief Default constructor. */
67
68 /*! \brief Virtual destructor. */
70
71 //@}
72
73 /** @name Conversion Methods
74 * Methods that can be used to convert a OGC Filter Expression to a TerraLib Expression.
75 */
76 //@{
77
78 /*!
79 \brief It converts the TerraLib Expression to a OGC Filter Expression.
80
81 \param exp A valid Terralib expression.
82
83 \return An ogc filter for the given expression.
84
85 \note The caller of this method will take the ownership of the returned expression.
86 */
88
89 //@}
90
91 /** @name Visitor Methods
92 * All concrete visitors must implement these methods.
93 */
94 //@{
95
96 void visit(const te::da::Expression& visited);
97 void visit(const te::da::DataSetName& visited);
98 void visit(const te::da::FromItem& visited);
99 void visit(const te::da::Function& visited);
100 void visit(const te::da::Insert& visited);
101 void visit(const te::da::Join& visited);
102 void visit(const te::da::JoinCondition& visited);
103 void visit(const te::da::JoinConditionOn& visited);
104 void visit(const te::da::JoinConditionUsing& visited);
105 void visit(const te::da::Like& visited) override;
106 void visit(const te::da::Literal& visited);
107 void visit(const te::da::LiteralBool& visited);
108 void visit(const te::da::LiteralByteArray& visited);
109 void visit(const te::da::LiteralDateTime& visited);
110 void visit(const te::da::LiteralDouble& visited);
111 void visit(const te::da::LiteralEnvelope& visited);
112 void visit(const te::da::LiteralGeom& visited);
113 void visit(const te::da::LiteralInt16& visited);
114 void visit(const te::da::LiteralInt32& visited);
115 void visit(const te::da::LiteralInt64& visited);
116 void visit(const te::da::LiteralString& visited);
117 void visit(const te::da::PropertyName& visited);
118 void visit(const te::da::Query& visited);
119 void visit(const te::da::Select& visited);
120 void visit(const te::da::SelectExpression& visited);
121 void visit(const te::da::SubSelect& visited);
122 void visit(const te::da::In& visited);
123 void visit(const te::da::Cast& visited);
124
125 //@}
126
127 private:
128
129 /*! \brief Static method to initialize the FilterEncoder. */
130 static void initialize();
131
132 private:
133
134 /** @name Not Allowed Methods
135 * No copy allowed.
136 */
137 //@{
138
139 /*!
140 \brief No copy constructor allowed.
141
142 \param rhs The other object.
143 */
145
146 /*!
147 \brief No assignment operator allowed.
148
149 \param rhs The other object.
150
151 \return A reference for this.
152 */
154
155 //@}
156
157 private:
158
159 te::fe::Expression* m_expression; //!< Expression used during conversion.
160 te::fe::AbstractOp* m_op; //!< Operation used during conversion.
161
162 static std::map<std::string, std::string> sm_fnameMap; //!< A map that associates Filter Operator names to Query Functions names.
163
164 friend class Module;
165 };
166
167 } // end namespace map
168} // end namespace te
169
170#endif // __TERRALIB_MAPTOOLS_INTERNAL_FILTERENCODER_H
Cast a expression function.
Definition: Cast.h:47
A class that models the name of a dataset used in a From clause.
Definition: DataSetName.h:44
This is an abstract class that models a query expression.
Definition: Expression.h:48
An abstract class that models a source of data in a query.
Definition: FromItem.h:51
A class that models a Function expression.
Definition: Function.h:48
A class that represents the IN operator.
Definition: In.h:53
The Insert object can add the return of a select object.
Definition: Insert.h:51
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
JoinConditionUsing class can be used to model a USING clause in a Join.
A condition to be used in a Join clause.
Definition: JoinCondition.h:45
A Join clause combines two FromItems.
Definition: Join.h:51
It is intended to encode a character string comparison operator with pattern matching.
Definition: Like.h:44
This class models a bool Literal value.
Definition: LiteralBool.h:44
A class that models a literal for ByteArray values.
A class that models a literal for Date and Time values.
A class that models a literal for double values.
Definition: LiteralDouble.h:44
A class that models a literal for Envelope values.
A class that models a literal for Geometry values.
Definition: LiteralGeom.h:47
This class models a string Literal value.
Definition: LiteralString.h:47
This class models a literal value.
Definition: Literal.h:54
A class that models the name of any property of an object.
Definition: PropertyName.h:51
A visitor interface for the Query hierarchy.
Definition: QueryVisitor.h:48
A Query is independent from the data source language/dialect.
Definition: Query.h:47
A Select can be used as a source of information in another query.
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:67
A Select can be used as a source of information in another query.
Definition: SubSelect.h:50
An abstract interface for operators.
Definition: AbstractOp.h:48
This is an abstract class that models a Filter Encoding expression.
Definition: Expression.h:51
A filter is any valid predicate expression.
Definition: Filter.h:56
A visitor that converts a TerraLib Expression to OGC Filter Expression.
Definition: FilterEncoder.h:57
te::fe::AbstractOp * m_op
Operation used during conversion.
void visit(const te::da::Like &visited) override
void visit(const te::da::LiteralInt32 &visited)
void visit(const te::da::Literal &visited)
void visit(const te::da::LiteralByteArray &visited)
void visit(const te::da::DataSetName &visited)
void visit(const te::da::PropertyName &visited)
void visit(const te::da::Insert &visited)
FilterEncoder()
Default constructor.
te::fe::Filter * getFilter(const te::da::Expression *exp)
It converts the TerraLib Expression to a OGC Filter Expression.
te::fe::Expression * m_expression
Expression used during conversion.
void visit(const te::da::JoinConditionUsing &visited)
~FilterEncoder()
Virtual destructor.
void visit(const te::da::FromItem &visited)
void visit(const te::da::LiteralDouble &visited)
void visit(const te::da::SubSelect &visited)
void visit(const te::da::LiteralBool &visited)
void visit(const te::da::LiteralEnvelope &visited)
FilterEncoder & operator=(const FilterEncoder &rhs)
No assignment operator allowed.
static void initialize()
Static method to initialize the FilterEncoder.
FilterEncoder(const FilterEncoder &rhs)
No copy constructor allowed.
void visit(const te::da::JoinCondition &visited)
void visit(const te::da::LiteralInt16 &visited)
void visit(const te::da::Expression &visited)
void visit(const te::da::LiteralString &visited)
void visit(const te::da::In &visited)
void visit(const te::da::Query &visited)
void visit(const te::da::Cast &visited)
void visit(const te::da::LiteralInt64 &visited)
void visit(const te::da::LiteralDateTime &visited)
void visit(const te::da::Join &visited)
void visit(const te::da::Function &visited)
void visit(const te::da::LiteralGeom &visited)
void visit(const te::da::SelectExpression &visited)
void visit(const te::da::JoinConditionOn &visited)
static std::map< std::string, std::string > sm_fnameMap
A map that associates Filter Operator names to Query Functions names.
void visit(const te::da::Select &visited)
This singleton defines the TerraLib Map Tools module entry.
Definition: Module.h:46
TerraLib.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
Proxy configuration file for TerraView (see terraview_config.h).