47#ifndef GUM_LABELIZED_DISCRETE_VARIABLE_H
48#define GUM_LABELIZED_DISCRETE_VARIABLE_H
85 const std::string& aDesc =
"",
86 const Size nbrLabel = 2);
95 const std::string& aDesc,
96 const std::vector< std::string >&
labels);
192 std::
string stype() const final {
return "Labelized"; };
DiscreteVariable(const std::string &aName, const std::string &aDesc)
Default constructor.
std::vector< std::string > labels() const
vector of labels
Idx closestIndex(double val) const final
returns the closest index of the value
std::string domain() const final
Returns the domain.
void eraseLabels()
erase all the labels
LabelizedVariable * clone() const final
a virtual clone ...
Idx posLabel(const std::string &label) const
return the pos from label
bool isLabel(const std::string &aLabel) const
indicates whether the variable already has the label passed in argument
LabelizedVariable(const std::string &aName, const std::string &aDesc="", const Size nbrLabel=2)
constructor
void copy_(const LabelizedVariable &aLDRV)
copies the content of aLDRV
LabelizedVariable(const LabelizedVariable &aLDRV)
Copy constructor.
LabelizedVariable & addLabel(const std::string &aLabel)
add a label with a new index (we assume that we will NEVER remove a label)
Idx index(const std::string &label) const final
returns the index of a given label
double numerical(Idx index) const final
get a numerical representation of the index-the value.
Size domainSize() const final
returns the size of the random discrete variable domain
VarType varType() const final
returns the type of variable
~LabelizedVariable() final
destructor
bool _checkSameDomain_(const Variable &aRV) const final
check the domain
void changeLabel(Idx pos, const std::string &aLabel) const
change a label for this index
Sequence< std::string > _labels_
the set of labels contained in the variable
std::string label(Idx i) const final
returns the ith label
LabelizedVariable(const std::string &aName, const std::string &aDesc, const std::vector< std::string > &labels)
constructor
std::string toFast() const final
indicates whether the variable already has the label passed in argument
std::string stype() const final
string represent the type of the variable
Base class for every random variable.
Base class for discrete random variable.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Base class for labelized discrete random variables.
gum is the global namespace for all aGrUM entities
Header file of gum::Sequence, a class for storing (ordered) sequences of objects.