Expression.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/fe/serialization/xml/Expression.h
22 
23  \brief Auxiliary classes and functions to serialize filter expressions from a XML document.
24 */
25 
26 #ifndef __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_EXPRESSION_H
27 #define __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_EXPRESSION_H
28 
29 // TerraLib
30 #include "../../../common/Singleton.h"
31 #include "../../../fe/Visitor.h"
32 #include "../../Config.h"
33 
34 // STL
35 #include <map>
36 #include <string>
37 
38 // Boost
39 #include <boost/function.hpp>
40 
41 namespace te
42 {
43  namespace xml
44  {
45  class AbstractWriter;
46  class Reader;
47  }
48 
49  namespace fe
50  {
51  class Expression;
52 
53  namespace serialize
54  {
55  class TEFEEXPORT Expression : public te::common::Singleton<Expression>, public te::fe::Visitor
56  {
57  friend class te::common::Singleton<Expression>;
58 
59  public:
60 
62  typedef std::map<std::string, ExpressionReadFnctType> ExpressionFnctIdxType;
63 
64  void reg(const std::string& expName, const ExpressionReadFnctType& fnct);
65 
67 
69 
70  /** @name Visitor Methods
71  * All concrete visitors must implement these methods.
72  */
73  //@{
74 
75  void visit(const te::fe::BinaryOperator& visited);
76  void visit(const te::fe::Function& visited);
77  void visit(const te::fe::Literal& visited);
78  void visit(const te::fe::PropertyName& visited);
79 
80  void visit(const te::fe::AbstractOp& visited) { /* no need */ }
81  void visit(const te::fe::SpatialOp& visited) { /* no need */ }
82  void visit(const te::fe::ComparisonOp& visited) { /* no need */ }
83  void visit(const te::fe::LogicOp& visited) { /* no need */ }
84  void visit(const te::fe::BBOXOp& visited) { /* no need */ }
85  void visit(const te::fe::BinaryComparisonOp& visited) { /* no need */ }
86  void visit(const te::fe::BinaryLogicOp& visited) { /* no need */ }
87  void visit(const te::fe::BinarySpatialOp& visited) { /* no need */ }
88  void visit(const te::fe::DistanceBuffer& visited) { /* no need */ }
89  void visit(const te::fe::PropertyIsBetween& visited) { /* no need */ }
90  void visit(const te::fe::PropertyIsLike& visited) { /* no need */ }
91  void visit(const te::fe::PropertyIsNull& visited) { /* no need */ }
92  void visit(const te::fe::UnaryLogicOp& visited) { /* no need */ }
93  void visit(const te::fe::Expression& visited) { /* no need */ }
94 
95  //@}
96 
98 
99  protected:
100 
102 
103  private:
104 
107  };
108 
109  } // end namespace serialize
110  } // end namespace fe
111 } // end namespace te
112 
113 #endif // __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_EXPRESSION_H
te::fe::serialize::Expression::visit
void visit(const te::fe::BinaryOperator &visited)
te::fe::SpatialOp
A spatial operator determines whether its geometric arguments satisfy the stated spatial relationship...
Definition: SpatialOp.h:53
te::fe::ComparisonOp
A comparison operator is used to form expressions that evaluate the mathematical comparison between t...
Definition: ComparisonOp.h:50
te::fe::serialize::Expression::ExpressionFnctIdxType
std::map< std::string, ExpressionReadFnctType > ExpressionFnctIdxType
Definition: Expression.h:62
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::fe::BinarySpatialOp
A class for binary spatial operators.
Definition: BinarySpatialOp.h:69
te::fe::BBOXOp
A convenient and more compact way of encoding the very common bounding box constraint based on an env...
Definition: BBOXOp.h:72
te::fe::serialize::Expression::visit
void visit(const te::fe::PropertyName &visited)
te::fe::Visitor
A visitor interface for a Filter expression.
Definition: Visitor.h:48
te::fe::AbstractOp
An abstract interface for operators.
Definition: AbstractOp.h:48
te::fe::serialize::Expression::read
te::fe::Expression * read(te::xml::Reader &reader) const
te::fe::serialize::Expression::visit
void visit(const te::fe::Function &visited)
te::fe::serialize::Expression::visit
void visit(const te::fe::BBOXOp &visited)
Definition: Expression.h:84
te::fe::serialize::Expression::ExpressionReadFnctType
boost::function< te::fe::Expression *(te::xml::Reader &)> ExpressionReadFnctType
Definition: Expression.h:61
te::fe::serialize::Expression::visit
void visit(const te::fe::AbstractOp &visited)
Definition: Expression.h:80
te::fe::PropertyIsNull
The PropertyIsNull class encodes an operator that checks to see if the value of its content is NULL.
Definition: PropertyIsNull.h:52
te::fe::serialize::Expression::~Expression
~Expression()
TEFEEXPORT
#define TEFEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59
te::fe::serialize::Expression::visit
void visit(const te::fe::UnaryLogicOp &visited)
Definition: Expression.h:92
te::fe::serialize::Expression::Expression
Expression()
te::fe::serialize::Expression::m_fncts
ExpressionFnctIdxType m_fncts
Definition: Expression.h:105
te::fe::serialize::Expression::visit
void visit(const te::fe::BinaryLogicOp &visited)
Definition: Expression.h:86
te::fe::DistanceBuffer
Distance buffer operator.
Definition: DistanceBuffer.h:60
te::xml::AbstractWriter
This class models a XML writer object.
Definition: AbstractWriter.h:50
te::xml::Reader
This class models a XML reader object.
Definition: Reader.h:56
te::fe::serialize::Expression::m_writer
te::xml::AbstractWriter * m_writer
Definition: Expression.h:106
te::fe::serialize::Expression::visit
void visit(const te::fe::Expression &visited)
Definition: Expression.h:93
AbstractWriter
A class that models a XML writer object built on top of Xerces-C++.
te::fe::serialize::Expression::visit
void visit(const te::fe::BinarySpatialOp &visited)
Definition: Expression.h:87
te::fe::BinaryComparisonOp
A class for binary comparison operators.
Definition: BinaryComparisonOp.h:70
te::fe::UnaryLogicOp
A logical operator that can be used to combine one conditional expressions.
Definition: UnaryLogicOp.h:47
te::fe::serialize::Expression::reg
void reg(const std::string &expName, const ExpressionReadFnctType &fnct)
te::fe::LogicOp
A logical operator can be used to combine one or more conditional expressions.
Definition: LogicOp.h:53
te::fe::serialize::Expression::visit
void visit(const te::fe::LogicOp &visited)
Definition: Expression.h:83
te::common::Singleton
Template support for singleton pattern.
Definition: Singleton.h:101
te::fe::serialize::Expression::visit
void visit(const te::fe::PropertyIsNull &visited)
Definition: Expression.h:91
te::fe::serialize::Expression::visit
void visit(const te::fe::BinaryComparisonOp &visited)
Definition: Expression.h:85
te::fe::PropertyName
This class is used to encode the name of any property of an object.
Definition: PropertyName.h:55
te::fe::Expression
This is an abstract class that models a Filter Encoding expression.
Definition: Expression.h:51
te::fe::serialize::Expression
Definition: Expression.h:56
te::fe::serialize::Expression::visit
void visit(const te::fe::ComparisonOp &visited)
Definition: Expression.h:82
te::fe::serialize::Expression::visit
void visit(const te::fe::Literal &visited)
te::fe::PropertyIsBetween
The PropertyIsBetween element is defined as a compact way of encoding a range check.
Definition: PropertyIsBetween.h:48
te::fe::serialize::Expression::visit
void visit(const te::fe::DistanceBuffer &visited)
Definition: Expression.h:88
te::fe::Literal
This class can be used to represent literal values.
Definition: Literal.h:57
te::fe::serialize::Expression::visit
void visit(const te::fe::SpatialOp &visited)
Definition: Expression.h:81
te::fe::PropertyIsLike
It is intended to encode a character string comparison operator with pattern matching.
Definition: PropertyIsLike.h:59
te::fe::serialize::Expression::visit
void visit(const te::fe::PropertyIsLike &visited)
Definition: Expression.h:90
te::fe::serialize::Expression::write
void write(const te::fe::Expression *exp, te::xml::AbstractWriter &writer)
te::fe::serialize::Expression::visit
void visit(const te::fe::PropertyIsBetween &visited)
Definition: Expression.h:89
te::fe::Function
A function is a named procedure that performs a distinct computation.
Definition: Function.h:55
te::fe::BinaryLogicOp
A logical operator can be used to combine two or more conditional expressions.
Definition: BinaryLogicOp.h:59
te::fe::BinaryOperator
This class can be used to represent binary operation expressions.
Definition: BinaryOperator.h:67