/usr/include/opengm/functions/view.hxx is in libopengm-dev 2.3.6+20160905-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #pragma once
#ifndef OPENGM_VIEW_FUNCTION_HXX
#define OPENGM_VIEW_FUNCTION_HXX
#include "opengm/functions/function_properties_base.hxx"
namespace opengm {
/// reference to a Factor of a GraphicalModel
///
/// \ingroup functions
template<class GM>
class ViewFunction
: public FunctionBase<ViewFunction<GM>,
typename GM::ValueType,typename GM::IndexType, typename GM::LabelType>
{
public:
typedef typename GM::ValueType ValueType;
typedef ValueType value_type;
typedef typename GM::FactorType FactorType;
typedef typename GM::OperatorType OperatorType;
typedef typename GM::IndexType IndexType;
typedef typename GM::LabelType LabelType;
ViewFunction();
ViewFunction(const FactorType &);
template<class Iterator>
ValueType operator()(Iterator begin)const;
LabelType shape(const IndexType)const;
IndexType dimension()const;
IndexType size()const;
private:
FactorType const* factor_;
};
template<class GM>
inline
ViewFunction<GM>::ViewFunction()
: factor_(NULL)
{}
template<class GM>
inline
ViewFunction<GM>::ViewFunction
(
const typename ViewFunction<GM>::FactorType & factor
)
: factor_(&factor)
{}
template<class GM>
template<class Iterator>
inline typename ViewFunction<GM>::ValueType
ViewFunction<GM>::operator()
(
Iterator begin
) const {
return factor_->operator()(begin);
}
template<class GM>
inline typename ViewFunction<GM>::LabelType
ViewFunction<GM>::shape
(
const typename ViewFunction<GM>::IndexType index
) const{
return factor_->numberOfLabels(index);
}
template<class GM>
inline typename ViewFunction<GM>::IndexType
ViewFunction<GM>::dimension() const {
return factor_->numberOfVariables();
}
template<class GM>
inline typename ViewFunction<GM>::IndexType
ViewFunction<GM>::size() const {
return factor_->size( );
}
} // namespace opengm
#endif // #ifndef OPENGM_VIEW_FUNCTION_HXX
|