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