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
A class that models a XML writer object built on top of Xerces-C++.
Template support for singleton pattern.
Definition: Singleton.h:101
An abstract interface for operators.
Definition: AbstractOp.h:48
A convenient and more compact way of encoding the very common bounding box constraint based on an env...
Definition: BBOXOp.h:72
A class for binary comparison operators.
A logical operator can be used to combine two or more conditional expressions.
Definition: BinaryLogicOp.h:59
This class can be used to represent binary operation expressions.
A class for binary spatial operators.
A comparison operator is used to form expressions that evaluate the mathematical comparison between t...
Definition: ComparisonOp.h:50
Distance buffer operator.
This is an abstract class that models a Filter Encoding expression.
Definition: Expression.h:51
A function is a named procedure that performs a distinct computation.
Definition: Function.h:55
This class can be used to represent literal values.
Definition: Literal.h:57
A logical operator can be used to combine one or more conditional expressions.
Definition: LogicOp.h:53
The PropertyIsBetween element is defined as a compact way of encoding a range check.
It is intended to encode a character string comparison operator with pattern matching.
The PropertyIsNull class encodes an operator that checks to see if the value of its content is NULL.
This class is used to encode the name of any property of an object.
Definition: PropertyName.h:55
A spatial operator determines whether its geometric arguments satisfy the stated spatial relationship...
Definition: SpatialOp.h:53
A logical operator that can be used to combine one conditional expressions.
Definition: UnaryLogicOp.h:47
A visitor interface for a Filter expression.
Definition: Visitor.h:48
void reg(const std::string &expName, const ExpressionReadFnctType &fnct)
void visit(const te::fe::BinaryOperator &visited)
void visit(const te::fe::BinaryLogicOp &visited)
Definition: Expression.h:86
void visit(const te::fe::Literal &visited)
boost::function< te::fe::Expression *(te::xml::Reader &)> ExpressionReadFnctType
Definition: Expression.h:61
void visit(const te::fe::PropertyIsBetween &visited)
Definition: Expression.h:89
void visit(const te::fe::SpatialOp &visited)
Definition: Expression.h:81
void visit(const te::fe::Expression &visited)
Definition: Expression.h:93
te::xml::AbstractWriter * m_writer
Definition: Expression.h:106
ExpressionFnctIdxType m_fncts
Definition: Expression.h:105
void visit(const te::fe::AbstractOp &visited)
Definition: Expression.h:80
void visit(const te::fe::BBOXOp &visited)
Definition: Expression.h:84
void visit(const te::fe::LogicOp &visited)
Definition: Expression.h:83
void visit(const te::fe::PropertyName &visited)
void visit(const te::fe::PropertyIsNull &visited)
Definition: Expression.h:91
void write(const te::fe::Expression *exp, te::xml::AbstractWriter &writer)
std::map< std::string, ExpressionReadFnctType > ExpressionFnctIdxType
Definition: Expression.h:62
te::fe::Expression * read(te::xml::Reader &reader) const
void visit(const te::fe::PropertyIsLike &visited)
Definition: Expression.h:90
void visit(const te::fe::UnaryLogicOp &visited)
Definition: Expression.h:92
void visit(const te::fe::ComparisonOp &visited)
Definition: Expression.h:82
void visit(const te::fe::Function &visited)
void visit(const te::fe::BinarySpatialOp &visited)
Definition: Expression.h:87
void visit(const te::fe::BinaryComparisonOp &visited)
Definition: Expression.h:85
void visit(const te::fe::DistanceBuffer &visited)
Definition: Expression.h:88
This class models a XML writer object.
This class models a XML reader object.
Definition: Reader.h:56
TerraLib.
#define TEFEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59