2 #ifndef OPENGM_MESSAGE_PASSING_BUFFER_HXX
3 #define OPENGM_MESSAGE_PASSING_BUFFER_HXX
12 typedef ARRAY ArrayType;
13 typedef typename ARRAY::ValueType ValueType;
17 template<
class SHAPE_ITERATOR>
18 MessageBuffer(SHAPE_ITERATOR, SHAPE_ITERATOR,
const ValueType& = ValueType());
19 template<
class SHAPE_ITERATOR>
20 void assign(SHAPE_ITERATOR, SHAPE_ITERATOR,
const ValueType& = ValueType());
22 void assign(SHAPE,
const ValueType& = ValueType());
30 const ARRAY& current()
const;
31 const ARRAY& old()
const;
33 ValueType dist()
const;
53 inline MessageBuffer<ARRAY>::MessageBuffer()
57 template<
class SHAPE_ITERATOR>
58 inline MessageBuffer<ARRAY>::MessageBuffer
62 const typename ARRAY::ValueType& constant
64 assign(begin, end, constant);
81 template<
class SHAPE_ITERATOR>
82 inline void MessageBuffer<ARRAY>::assign
86 const typename ARRAY::ValueType& constant
94 buffer1_.assign(begin, end, constant);
95 buffer2_.assign(begin, end, constant);
100 template<
class ARRAY>
101 template<
class SHAPE>
102 inline void MessageBuffer<ARRAY>::assign
105 const typename ARRAY::ValueType& constant
113 buffer1_.resize(&shape, &shape+1, constant);
114 buffer2_.resize(&shape, &shape+1, constant);
141 template<
class ARRAY>
142 inline ARRAY& MessageBuffer<ARRAY>::current() {
143 return flag_ ? buffer1_ : buffer2_;
146 template<
class ARRAY>
147 inline const ARRAY& MessageBuffer<ARRAY>::current()
const {
148 return flag_ ? buffer1_ : buffer2_;
151 template<
class ARRAY>
152 inline ARRAY& MessageBuffer<ARRAY>::old() {
153 return flag_ ? buffer2_ : buffer1_;
156 template<
class ARRAY>
157 inline const ARRAY& MessageBuffer<ARRAY>::old()
const {
158 return flag_ ? buffer2_ : buffer1_;
161 template<
class ARRAY>
162 inline void MessageBuffer<ARRAY>::toggle() {
163 flag_ = flag_ ?
false :
true;
166 template<
class ARRAY>
168 inline typename ARRAY::ValueType MessageBuffer<ARRAY>::dist()
const {
169 return DIST::op(buffer1_, buffer2_);
175 #endif // #ifndef OPENGM_MESSAGE_PASSING_BUFFER_HXX