Operations.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::Core
19 * @author Kai Welke (welke _at_ kit _dot_ edu)
20 * @date 2012 Kai Welke
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
29 
30 namespace armarx
31 {
32  class Operation;
33 
34  /**
35  * Typedef of OperationPtr as IceInternal::Handle<Operation> for convenience.
36  */
38 
39  /**
40  * @class Operation
41  * @ingroup Conditions
42  *
43  * Operation is the superclass for all logical operators within an expression tree.
44  * This superclass provides a getter for the type of operation and implements
45  * the slice OperationBase interface. Further it inherits the TermImpl superclass
46  * in order to be usable in an expression tree.
47  */
48  class ARMARXCORE_IMPORT_EXPORT Operation : virtual public TermImpl, virtual public OperationBase
49  {
50  public:
51  /**
52  * Retrieve the type of the operation. Either eOperationAnd, eOperationOr, eOperationNot, or eUndefinedOperation.
53  *
54  * @return type of the operation
55  */
56  OperationType getOperationType(const Ice::Current& c = Ice::emptyCurrent) const override;
57 
58  protected:
59  // required for Ice::ObjectFactory
60  Operation();
61  };
62 
63  /**
64  * @class OperationAnd
65  * @ingroup Conditions
66  *
67  * OperationAnd implements a logical AND operation within the expression tree.
68  */
70  virtual public Operation,
71  virtual public OperationAndBase
72  {
73  template <class BaseClass, class VariantClass>
74  friend class GenericFactory;
75 
76  public:
77  /**
78  * Constructs a logical AND operation on the two terms a and b
79  *
80  * @param a first term
81  * @param b second term
82  */
84 
85  /**
86  * Implementation for updating this term from its children in the expression tree. Inherited from TermImpl.
87  */
88  void update(const Ice::Current& c = Ice::emptyCurrent) override;
89  void updateWithData(const Ice::Current&) override;
90 
91  /**
92  * output operation to stream
93  *
94  * @param out output stream
95  */
96  void output(std::ostream& out) const override;
97 
98  /**
99  * Retrieve string identifying the operation.
100  *
101  * @return string identifier
102  */
103  std::string getOperationString(const Ice::Current& c = Ice::emptyCurrent) override;
104 
105  /**
106  * Reimplementation of the ice_clone method.
107  *
108  * @return clone of the object
109  */
110  Ice::ObjectPtr ice_clone() const override;
111 
112  protected:
113  OperationAnd();
114  };
115 
116  /**
117  * @class OperationOr
118  * @ingroup Conditions
119  *
120  * OperationOr implements a logical OR operation within the expression tree.
121  */
123  virtual public Operation,
124  virtual public OperationOrBase
125  {
126  template <class BaseClass, class VariantClass>
127  friend class GenericFactory;
128 
129  public:
130  /**
131  * Constructs a logical OR operation on the two terms a and b
132  *
133  * @param a first term
134  * @param b second term
135  */
137 
138  /**
139  * Implementation for updating this term from its children in the expression tree. Inherited from TermImpl.
140  */
141  void update(const Ice::Current& c = Ice::emptyCurrent) override;
142  void updateWithData(const Ice::Current&) override;
143 
144  /**
145  * output operation to stream
146  *
147  * @param out output stream
148  */
149  void output(std::ostream& out) const override;
150 
151  /**
152  * Retrieve string identifying the operation.
153  *
154  * @return string identifier
155  */
156  std::string getOperationString(const Ice::Current& c = Ice::emptyCurrent) override;
157 
158  /**
159  * Reimplementation of the ice_clone method.
160  *
161  * @return clone of the object
162  */
163  Ice::ObjectPtr ice_clone() const override;
164 
165  protected:
166  OperationOr();
167  };
168 
169  /**
170  * @class OperationNot
171  * @ingroup Conditions
172  *
173  * OperationNot implements a logical NOT operation within the expression tree.
174  */
176  virtual public Operation,
177  virtual public OperationNotBase
178  {
179  template <class BaseClass, class VariantClass>
180  friend class GenericFactory;
181 
182  public:
183  /**
184  * Constructs a logical NOT operation from the term
185  *
186  * @param a term
187  */
189 
190  /**
191  * Implementation for updating this term from its children in the expression tree. Inherited from TermImpl.
192  */
193  void update(const Ice::Current& c = Ice::emptyCurrent) override;
194  void updateWithData(const Ice::Current&) override;
195 
196  /**
197  * output operation to stream
198  *
199  * @param out output stream
200  */
201  void output(std::ostream& out) const override;
202 
203  /**
204  * Retrieve string identifying the operation.
205  *
206  * @return string identifier
207  */
208  std::string getOperationString(const Ice::Current& c = Ice::emptyCurrent) override;
209 
210  /**
211  * Reimplementation of the ice_clone method.
212  *
213  * @return clone of the object
214  */
215  Ice::ObjectPtr ice_clone() const override;
216 
217  protected:
218  OperationNot();
219  };
220 } // namespace armarx
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
TermImpl.h
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::ctrlutil::a
double a(double t, double a0, double j)
Definition: CtrlUtil.h:45
armarx::OperationOr
Definition: Operations.h:122
armarx::OperationAnd
Definition: Operations.h:69
armarx::OperationNot
Definition: Operations.h:175
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
armarx::Operation
Definition: Operations.h:48
ImportExport.h
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
armarx::TermImpl
Definition: TermImpl.h:53
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27