OpenGM  2.3.x
Discrete Graphical Model Library
or.hxx
Go to the documentation of this file.
1 #pragma once
2 #ifndef OPENGM_OPERATION_OR_HXX
3 #define OPENGM_OPERATION_OR_HXX
4 
5 namespace opengm {
6 
10 struct Or
11 {
13  template<class T>
14  static T neutral()
15  { return static_cast<T>(false); }
16 
18  template<class T>
19  static void neutral(T& out)
20  { out = static_cast<T>(false); }
21 
23  template<class T>
24  static T ineutral()
25  { return static_cast<T>(true); }
26 
28  template<class T>
29  static void ineutral(T& out)
30  { out = static_cast<T>(true); }
31 
33  template<class T1, class T2>
34  static void op(const T1& in, T2& out)
35  { out |= in; }
36 
38  template<class T1,class T2,class T3>
39  static void op(const T1& in1, const T2& in2, T3& out)
40  { out = in1 | in2; }
41  static void op(const bool& in1, const bool& in2, bool& out)
42  { out = in1 || in2; }
43 
45  static bool hasbop()
46  { return true; }
47 
49  template<class T>
50  static bool bop(const T& in1, const T& in2)
51  { return (in1 | in2); }
52  static bool bop(const bool& in1, const bool& in2)
53  { return (in1 || in2); }
54 
56  template<class T>
57  static bool ibop(const T& in1, const T& in2)
58  { return !(in1 | in2); }
59  static bool ibop(const bool& in1, const bool& in2)
60  { return !(in1 || in2); }
61 };
62 
63 } // namespace opengm
64 
65 #endif // #ifndef OPENGM_OPERATION_OR_HXX
The OpenGM namespace.
Definition: config.hxx:43
static bool hasbop()
bool operation flag
Definition: or.hxx:45
static void op(const bool &in1, const bool &in2, bool &out)
Definition: or.hxx:41
static bool bop(const T &in1, const T &in2)
boolean operation
Definition: or.hxx:50
static T ineutral()
inverse neutral element (with return)
Definition: or.hxx:24
static bool ibop(const bool &in1, const bool &in2)
Definition: or.hxx:59
static T neutral()
neutral element (with return)
Definition: or.hxx:14
static bool bop(const bool &in1, const bool &in2)
Definition: or.hxx:52
static void op(const T1 &in, T2 &out)
operation (in-place)
Definition: or.hxx:34
static void op(const T1 &in1, const T2 &in2, T3 &out)
operation (not in-place)
Definition: or.hxx:39
static bool ibop(const T &in1, const T &in2)
inverse boolean operation
Definition: or.hxx:57
static void ineutral(T &out)
inverse neutral element (call by reference)
Definition: or.hxx:29
Disjunction as a binary operation.
Definition: or.hxx:10
static void neutral(T &out)
neutral element (call by reference)
Definition: or.hxx:19