stromx  0.7.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Compare.h
1 /*
2 * Copyright 2015 Matthias Fuchs
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef STROMX_RUNTIME_COMPARE_H
18 #define STROMX_RUNTIME_COMPARE_H
19 
20 #include "stromx/runtime/Config.h"
21 #include "stromx/runtime/OperatorKernel.h"
22 #include "stromx/runtime/Primitive.h"
23 
24 namespace stromx
25 {
26  namespace runtime
27  {
29  class STROMX_RUNTIME_API Compare : public OperatorKernel
30  {
31  public:
32  enum OutputId
33  {
34  NUMBER_1,
35  NUMBER_2
36  };
37 
38  enum InputId
39  {
40  RESULT
41  };
42 
43  enum ParameterId
44  {
45  COMPARE_TO_INPUT,
46  COMPARISON_TYPE,
47  EPSILON,
48  PARAMETER_VALUE
49  };
50 
51  enum CompareType
52  {
53  LESS,
54  LESS_OR_EQUAL,
55  GREATER,
56  GREATER_OR_EQUAL,
57  EQUAL,
58  NOT_EQUAL
59  };
60 
61  Compare();
62 
63  virtual OperatorKernel* clone() const { return new Compare; }
64  virtual void setParameter(const unsigned int id, const runtime::Data& value);
65  virtual const DataRef getParameter(const unsigned int id) const;
66  virtual void execute(runtime::DataProvider& provider);
67  virtual void initialize();
68 
69  private:
70  static const std::vector<const runtime::Description*> setupOutputs();
71  static const std::vector<const runtime::Parameter*> setupInitParameters();
72 
73  static const std::string TYPE;
74  static const std::string PACKAGE;
75  static const runtime::Version VERSION;
76 
77  const std::vector<const runtime::Description*> setupInputs();
78  const std::vector<const runtime::Parameter*> setupParameters();
79 
80  Bool m_compareToInput;
81  Enum m_comparisonType;
82  Float64 m_value;
83  Float64 m_epsilon;
84  };
85  }
86 }
87 
88 #endif // STROMX_RUNTIME_COMPARE_H
A version of an operator or data type.
Definition: Version.h:46
Abstract data object.
Definition: Data.h:53
virtual OperatorKernel * clone() const
Definition: Compare.h:63
Reference to a data object.
Definition: DataRef.h:48
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
Compare operation of floating point values.
Definition: Compare.h:29
Abstract operator kernel.
Definition: OperatorKernel.h:46
Provider of functions to receive and send data.
Definition: DataProvider.h:35
Value of an enumeration.
Definition: Enum.h:27