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