/usr/include/opengm/graphicalmodel/space/vector_view_space.hxx is in libopengm-dev 2.3.6-2.
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 | #pragma once
#ifndef OPENGM_VECTOR_VIEW_SPACE_HXX
#define OPENGM_VECTOR_VIEW_SPACE_HXX
/// \cond HIDDEN_SYMBOLS
#include <vector>
#include <limits>
#include "opengm/opengm.hxx"
#include "opengm/graphicalmodel/space/space_base.hxx"
namespace opengm {
/// Label space in which variables can have different numbers of labels
///
/// \ingroup spaces
template<class I = std::size_t, class L = std::size_t>
class VectorViewSpace
: public SpaceBase<VectorViewSpace<I,L>,I,L>
{
public:
typedef I IndexType;
typedef L LabelType;
VectorViewSpace();
VectorViewSpace(const std::vector<LabelType>&);
IndexType addVariable(const LabelType);
IndexType numberOfVariables() const;
LabelType numberOfLabels(const IndexType) const;
private:
std::vector<LabelType> const* numbersOfLabels_;
};
template<class I, class L>
inline
VectorViewSpace<I, L>::VectorViewSpace()
: numbersOfLabels_(NULL)
{}
template<class I, class L>
inline
VectorViewSpace<I, L>::VectorViewSpace
(
const std::vector<LabelType>& spaceVector
)
: numbersOfLabels_(&spaceVector)
{
OPENGM_ASSERT(numbersOfLabels_->size()>0);
}
template<class I, class L>
inline typename VectorViewSpace<I, L>::IndexType
VectorViewSpace<I, L>::addVariable(
const LabelType numberOfLabels
) {
throw opengm::RuntimeError("attempt to add a variable to VectorViewSpace");
}
template<class I, class L>
inline typename VectorViewSpace<I, L>::IndexType
VectorViewSpace<I, L>::numberOfVariables() const
{
return static_cast<IndexType>(numbersOfLabels_->size());
}
template<class I, class L>
inline typename VectorViewSpace<I, L>::LabelType
VectorViewSpace<I, L>::numberOfLabels(
const IndexType dimension
) const
{
OPENGM_ASSERT(dimension<numbersOfLabels_->size());
return numbersOfLabels_->operator[](dimension);
}
} // namespace opengm
/// \endcond
#endif // #ifndef OPENGM_VECTOR_VIEW_SPACE_HXX
|