Filter.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/Filter.h
22 
23  \brief A Filter is any valid predicate expression.
24  */
25 
26 #ifndef __TERRALIB_FE_INTERNAL_FILTER_H
27 #define __TERRALIB_FE_INTERNAL_FILTER_H
28 
29 // TerraLib
30 #include "ObjectId.h"
31 #include "AbstractOp.h"
32 
33 // STL
34 #include <vector>
35 
36 namespace te
37 {
38  namespace fe
39  {
40  /*!
41  \class Filter
42 
43  \brief A filter is any valid predicate expression.
44 
45  A Filter contains a expression which is created
46  by combining other expressions.
47 
48  \ingroup fe
49 
50  \sa AbstractOp, ObjectId
51  */
53  {
54  public:
55 
56  /** @name Initializer Methods
57  * Methods related to instantiation and destruction.
58  */
59  //@{
60 
61  /*! \brief It initializes a new Filter. */
62  Filter();
63 
64  /*! \brief Destructor. */
65  ~Filter();
66 
67  //@}
68 
69  /** @name Accessor methods
70  * Methods used to get or set properties.
71  */
72  //@{
73 
74  /*!
75  \brief It sets the filter main operation (expression).
76 
77  \param o The main operation (also called an expression).
78 
79  \note The Filter object will take the ownership of the given operation.
80  */
81  void setOp(AbstractOp* o);
82 
83  /*!
84  \brief It returns main filter operation.
85 
86  \return The main filter operation.
87  */
88  AbstractOp* getOp() const;
89 
90  /*!
91  \brief It adds the object identifier to the list of identifiers.
92 
93  \param id The object identifier to be added to the list of identifiers.
94 
95  \note The Filter object will take the ownership of the object identifier. So, you must not free it.
96  */
97  void add(ObjectId* id);
98 
99  /*!
100  \brief It returns a specified object identifier.
101 
102  \param i The index of desired object identifier.
103 
104  \return A specified object identifier.
105 
106  \note You must not clear the returned object identifier.
107 
108  \note The method will not check the index range.
109  */
110  ObjectId* operator[](size_t i) const;
111 
112  /*!
113  \brief It returns a specified object identifier.
114 
115  \param i The index of desired object identifier.
116 
117  \return A specified object identifier.
118 
119  \note You must not clear the returned object identifier.
120 
121  \note The method will not check the index range.
122  */
123  ObjectId* getOid(size_t i) const;
124 
125  /*!
126  \brief It returns the size of the list of object identifiers.
127 
128  \return The size of the list of object identifiers.
129  */
130  size_t getNumberOfOids() const;
131 
132  /*!
133  \brief It clears the object identifier list and drop it off.
134 
135  \note After calling this method it will be safe to set an operator.
136  */
137  void clear();
138 
139  //@}
140 
141  private:
142 
143  /** @name Not Allowed Methods
144  * No copy allowed.
145  */
146  //@{
147 
148  /*!
149  \brief No copy constructor allowed.
150 
151  \param rhs The other instance.
152  */
153  Filter(const Filter& rhs);
154 
155  /*!
156  \brief No assignment operator allowed.
157 
158  \param rhs The other instance.
159 
160  \return A reference for this.
161  */
162  Filter& operator=(const Filter& rhs);
163 
164  //@}
165 
166  private:
167 
168  AbstractOp* m_op; //!< May be: SpatialOp, ComparisonOp or LogicOp. (NULL if m_ids is informed)
169  std::vector<ObjectId*>* m_ids; //!< Object identifiers. (NULL if m_op is informed)
170  };
171 
172  } // end namespace fe
173 } // end namespace te
174 
175 #endif // __TERRALIB_FE_INTERNAL_FILTER_H
AbstractOp * m_op
May be: SpatialOp, ComparisonOp or LogicOp. (NULL if m_ids is informed)
Definition: Filter.h:168
An abstract interface for operators.
#define TEFEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59
std::vector< ObjectId * > * m_ids
Object identifiers. (NULL if m_op is informed)
Definition: Filter.h:169
URI C++ Library.
An object identifier is meant to represent a unique identifier for an object instance within the cont...
Definition: ObjectId.h:58
A filter is any valid predicate expression.
Definition: Filter.h:52
An abstract interface for operators.
Definition: AbstractOp.h:47