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