BinaryLogicOp.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/BinaryLogicOp.h
22 
23  \brief A logical operator can be used to combine two or more conditional expressions.
24  */
25 
26 #ifndef __TERRALIB_FE_INTERNAL_BINARYLOGICOP_H
27 #define __TERRALIB_FE_INTERNAL_BINARYLOGICOP_H
28 
29 // TerraLib
30 #include "LogicOp.h"
31 
32 // STL
33 #include <vector>
34 
35 namespace te
36 {
37  namespace fe
38  {
39 // Forward decloarations
40  class AbstractOp;
41 
42  /*!
43  \class BinaryLogicOp
44 
45  \brief A logical operator can be used to combine two or more conditional expressions.
46 
47  The following operators are defined in the Filter
48  Encoding specification:
49  <ul>
50  <li>And</li>
51  <li>Or</li>
52  </ul>
53 
54  \ingroup fe
55 
56  \sa LogicOp, UnaryLogicOp
57  */
59  {
60  public:
61 
63 
64  /** @name Initializer Methods
65  * Methods related to instantiation and destruction.
66  */
67  //@{
68 
69  /*!
70  \brief It initializes a new BinaryLogicOp.
71 
72  \param opName The BinaryLogicOp operator name.
73 
74  \note The BinaryLogicOp will not take the ownership of the given name.
75  */
76  BinaryLogicOp(const char* opName = 0);
77 
78  /*!
79  \brief It initializes a new BinaryLogicOp.
80 
81  \param opName The BinaryLogicOp operator name.
82  \param first The first operand.
83  \param second The second operand.
84 
85  \note The BinaryLogicOp will not take the ownership of the given name.
86 
87  \note The BinaryLogicOp object will take the ownership of the operands.
88  */
89  BinaryLogicOp(const char* opName,
90  AbstractOp* first,
91  AbstractOp* second);
92 
93  /*! \brief Virtual destructor. */
94  virtual ~BinaryLogicOp();
95 
96  //@}
97 
98  /** @name Accessor methods
99  * Methods used to get or set properties.
100  */
101  //@{
102 
103  /*!
104  \brief It returns the number of operands.
105 
106  \return The number of operands.
107  */
108  std::size_t size() const;
109 
110  /*!
111  \brief It adds the operand to the operand list.
112 
113  \param o The operand to be added.
114 
115  \note The BinaryLogicOp object will take the ownership of the operand.
116  */
117  void add(AbstractOp* o);
118 
119  /*!
120  \brief It returns a specified operand.
121 
122  \param i The index of desired operand.
123 
124  \return A specified operand.
125 
126  \note The method will not check the index range.
127  */
128  AbstractOp* operator[](std::size_t i) const;
129 
130  /*!
131  \brief It returns a specified operand.
132 
133  \param i The index of desired operand.
134 
135  \return A specified operand.
136 
137  \note The method will not check the index range.
138  */
139  AbstractOp* getOp(std::size_t i) const;
140 
141  //@}
142 
143  protected:
144 
145  std::vector<AbstractOp*> m_ops; //!< Mandatory at least two.
146  };
147 
148  } // end namespace fe
149 } // end namespace te
150 
151 #endif // __TERRALIB_FE_INTERNAL_BINARYLOGICOP_H
#define TEFEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59
A logical operator can be used to combine one or more conditional expressions.
URI C++ Library.
std::vector< AbstractOp * > m_ops
Mandatory at least two.
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
An abstract interface for operators.
Definition: AbstractOp.h:47
A logical operator can be used to combine one or more conditional expressions.
Definition: LogicOp.h:52
A logical operator can be used to combine two or more conditional expressions.
Definition: BinaryLogicOp.h:58