2 #ifndef OPENGM_SIMPLE_DISCRETE_SPACE_HXX 3 #define OPENGM_SIMPLE_DISCRETE_SPACE_HXX 13 template<
class I = std::
size_t,
class L = std::
size_t>
15 :
public SpaceBase<SimpleDiscreteSpace<I, L>, I, L> {
22 void assign(
const IndexType,
const LabelType);
23 template<
class Iterator>
void assignDense(Iterator, Iterator);
30 IndexType numberOfVariables_;
31 LabelType numberOfLabels_;
34 template<
class I,
class L>
37 : numberOfVariables_(),
41 template<
class I,
class L>
48 : numberOfVariables_(numberOfVariables),
49 numberOfLabels_(numberOfLabels)
52 template<
class I,
class L>
53 template<
class Iterator>
60 numberOfVariables_ = std::distance(begin, end);
61 numberOfLabels_ =
static_cast<L
>(*begin);
63 if(numberOfLabels_ != static_cast<LabelType>(*begin)) {
64 throw opengm::RuntimeError(
"*begin == SimpleDiscreteSpace.numberOfLabels_ is violated in SimpleDiscreteSpace::assignDense");
70 template<
class I,
class L>
81 template<
class I,
class L>
87 if(numberOfLabels != numberOfLabels_) {
88 throw opengm::RuntimeError(
"numberOfLabels == SimpleDiscreteSpace.numberOfLabels_ is violated in SimpleDiscreteSpace::addVariable");
91 return numberOfVariables_ - 1;
94 template<
class I,
class L>
97 return numberOfVariables_;
100 template<
class I,
class L>
106 return numberOfLabels_;
109 template<
class I,
class L>
117 #endif // #ifndef OPENGM_SIMPLE_DISCRETE_SPACE_HXX
IndexType numberOfVariables() const
LabelType numberOfLabels(const IndexType) const
Discrete space in which all variables have the same number of labels.
bool isSimpleSpace() const
IndexType addVariable(const LabelType)
void assignDense(Iterator, Iterator)
Interface of label spaces.
void assign(const IndexType, const LabelType)