adder.hxx

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef OPENGM_OPERATION_ADDER_HXX
00003 #define OPENGM_OPERATION_ADDER_HXX
00004 
00005 namespace opengm {
00006 
00010 struct Adder
00011 {
00013    template<class T>
00014       static T neutral()
00015          { return static_cast<T>(0); }
00016 
00018    template<class T>
00019       static void neutral(T& out)
00020          { out = static_cast<T>(0); }
00021 
00023    template<class T>
00024       static T ineutral()
00025          { return static_cast<T>(0); }
00026    
00028    template<class T>
00029       static void ineutral(T& out)
00030          { out = static_cast<T>(0); }
00031 
00033    template<class T1, class T2>
00034       static void op(const T1& in, T2& out)
00035          { out += in; }
00036    
00038    template<class T1,class T2,class T3>
00039       static void op(const T1& in1, const T2& in2, T3& out)
00040          { out = in1 + in2; }
00041 
00043    template<class T1, class T2>
00044       static void iop(const T1& in, T2& out)
00045          { out -= in; }
00046    
00048    template<class T1,class T2,class T3>
00049       static void iop(const T1& in1, const T2& in2, T3& out)
00050          { out = in1 - in2; }
00051 
00053    static bool hasbop()
00054       { return false; }
00055 
00057    template<class T1, class T2>
00058       static void hop(const T1& in, T2& out)
00059          { out *= in; }
00060 
00062    template<class T1,class T2, class T3>
00063       static void hop(const T1& in1, const T2& in2, T3& out)
00064          { out = in1 * in2; }
00065 
00067    template<class T1,class T2>
00068       static void ihop(const T1& in, T2& out)
00069          { out /= in; }
00070 
00072    template<class T1, class T2, class T3>
00073       static void ihop(const T1& in1, const T2& in2, T3& out)
00074          { out = in1 / in2; }
00075 };
00076 
00077 } // namespace opengm
00078 
00079 #endif // #ifndef OPENGM_OPERATION_ADDER_HXX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:01 2013 for OpenGM by  doxygen 1.6.3