45#ifndef DOXYGEN_SHOULD_SKIP_THIS
62 GUM_CONSTRUCTOR(DiscreteVariable)
66 INLINE DiscreteVariable::DiscreteVariable(
const DiscreteVariable& aDRV) : Variable(aDRV) {
67 GUM_CONSTRUCTOR(DiscreteVariable)
71 INLINE DiscreteVariable::~DiscreteVariable() { GUM_DESTRUCTOR(DiscreteVariable) }
74 INLINE DiscreteVariable& DiscreteVariable::operator=(
const DiscreteVariable& aRV) {
75 if (&aRV !=
this) { Variable::operator=(aRV); }
81 INLINE
bool DiscreteVariable::empty()
const {
return domainSize() < 2; }
83 INLINE
bool DiscreteVariable::isNumerical()
const {
return varType() != VarType::LABELIZED; }
85 INLINE std::string DiscreteVariable::closestLabel(
double val)
const {
86 return label(closestIndex(val));
90 INLINE std::vector< std::string > DiscreteVariable::labels()
const {
91 std::vector< std::string > v;
92 for (Idx i = 0; i < domainSize(); i++)
93 v.push_back(label(i));
97 INLINE
bool DiscreteVariable::isEmpirical()
const {
return false; }
99 INLINE Idx DiscreteVariable::operator[](std::string_view label)
const {
return index(label); }
101 INLINE DiscreteVariable::DiscreteVariable() { GUM_CONSTRUCTOR(DiscreteVariable) }
DiscreteVariable()
(protected) Default constructor
Base class for every random variable.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities