HOPS
HOPS class reference
MHO_BinaryOperator.hh
Go to the documentation of this file.
1 #ifndef MHO_BinaryOperator_HH__
2 #define MHO_BinaryOperator_HH__
3 
4 #include "MHO_Operator.hh"
5 
6 #include <tuple>
7 
8 namespace hops
9 {
10 
22 template< class XArgType1, class XArgType2 = XArgType1, class XArgType3 = XArgType2 >
24 {
25  public:
27  {
28  std::get< 0 >(fArgs) = nullptr;
29  std::get< 1 >(fArgs) = nullptr;
30  std::get< 2 >(fArgs) = nullptr;
31  };
32 
33  virtual ~MHO_BinaryOperator(){};
34 
43  virtual void SetArgs(const XArgType1* in1, const XArgType2* in2, XArgType3* out)
44  {
45  fArgs = std::make_tuple(in1, in2, out);
46  };
47 
54  virtual bool Initialize() override
55  {
56  return InitializeImpl(std::get< 0 >(fArgs), std::get< 1 >(fArgs), std::get< 2 >(fArgs));
57  }
58 
65  virtual bool Execute() override
66  {
67  return ExecuteImpl(std::get< 0 >(fArgs), std::get< 1 >(fArgs), std::get< 2 >(fArgs));
68  }
69 
70  protected:
71  // using type1 = XArgType1;
72  // using type2 = XArgType2;
73  // using type3 = XArgType3;
74 
84  virtual bool InitializeImpl(const XArgType1* , const XArgType2* , XArgType3* ) = 0;
94  virtual bool ExecuteImpl(const XArgType1* , const XArgType2* , XArgType3* ) = 0;
95 
96  protected:
97  //place for args to be store for the derived class to pick them up/modify
98  std::tuple< const XArgType1*, const XArgType2*, XArgType3* > fArgs;
99 };
100 
101 } // namespace hops
102 
103 #endif
Class MHO_BinaryOperator.
Definition: MHO_BinaryOperator.hh:24
virtual bool ExecuteImpl(const XArgType1 *, const XArgType2 *, XArgType3 *)=0
Function ExecuteImpl.
virtual bool InitializeImpl(const XArgType1 *, const XArgType2 *, XArgType3 *)=0
Function InitializeImpl.
std::tuple< const XArgType1 *, const XArgType2 *, XArgType3 * > fArgs
Definition: MHO_BinaryOperator.hh:98
virtual bool Initialize() override
Initializes the object using arguments from fArgs tuple.
Definition: MHO_BinaryOperator.hh:54
virtual void SetArgs(const XArgType1 *in1, const XArgType2 *in2, XArgType3 *out)
Setter for args, out-of-place operation, in1/in2 unmodified, result stored in out.
Definition: MHO_BinaryOperator.hh:43
MHO_BinaryOperator()
Definition: MHO_BinaryOperator.hh:26
virtual ~MHO_BinaryOperator()
Definition: MHO_BinaryOperator.hh:33
virtual bool Execute() override
Executes operation using provided arguments and returns result.
Definition: MHO_BinaryOperator.hh:65
Class MHO_Operator.
Definition: MHO_Operator.hh:21
Definition: MHO_ChannelLabeler.hh:17