![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
class LabelizedVariable More...
#include <labelizedVariable.h>
Public Member Functions | |
Idx | operator[] (const std::string &label) const |
from the label to its index in var. More... | |
std::string | toString () const |
string version of *this More... | |
std::string | toStringWithDescription () const |
string version of *this using description attribute instead of name. More... | |
Constructors / Destructors | |
LabelizedVariable (const std::string &aName, const std::string &aDesc="", const Size nbrLabel=2) | |
constructor More... | |
LabelizedVariable (const std::string &aName, const std::string &aDesc, const std::vector< std::string > &labels) | |
constructor More... | |
LabelizedVariable (const LabelizedVariable &aLDRV) | |
Copy constructor. More... | |
virtual | ~LabelizedVariable () |
destructor More... | |
virtual LabelizedVariable * | clone () const |
a virtual clone ... More... | |
Operators | |
LabelizedVariable & | operator= (const LabelizedVariable &aLDRV) |
copy operator More... | |
virtual Idx | index (const std::string &label) const |
returns the index of a given label More... | |
Accessors / Modifiers | |
bool | isLabel (const std::string &aLabel) const |
indicates whether the variable already has the label passed in argument More... | |
LabelizedVariable & | addLabel (const std::string &aLabel) |
add a label with a new index (we assume that we will NEVER remove a label) More... | |
void | changeLabel (Idx pos, const std::string &aLabel) const |
change a label for this index More... | |
void | eraseLabels () |
erase all the labels More... | |
virtual std::string | label (Idx i) const |
returns the ith label More... | |
Idx | posLabel (const std::string &label) const |
return the pos from label More... | |
virtual double | numerical (Idx indice) const |
get a numerical representation of he indice-the value. More... | |
virtual Size | domainSize () const |
returns the size of the random discrete variable domain More... | |
virtual VarType | varType () const |
returns the type of variable More... | |
virtual const std::string | domain () const |
Returns the domain. More... | |
Accessors / Modifiers | |
bool | empty () const |
std::vector< std::string > | labels () const |
vector of labels More... | |
Operators | |
virtual bool | operator== (const DiscreteVariable &aRV) const |
equality operator More... | |
virtual bool | operator!= (const DiscreteVariable &aRV) const |
inequality operator More... | |
Operators | |
virtual bool | operator== (const Variable &aRV) const |
equality operator More... | |
virtual bool | operator!= (const Variable &aRV) const |
inequality operator More... | |
Accessors / Modifiers | |
void | setName (const std::string &theValue) |
sets the name of the variable More... | |
const std::string & | name () const |
returns the name of the variable More... | |
void | setDescription (const std::string &theValue) const |
sets the description of the variable More... | |
const std::string & | description () const |
returns the description of the variable More... | |
Protected Member Functions | |
LabelizedVariable () | |
(protected) Default constructor More... | |
void | copy_ (const LabelizedVariable &aLDRV) |
copies the content of aLDRV More... | |
void | copy_ (const Variable &aRV) |
protected copy More... | |
class LabelizedVariable
Base class for labelized discrete random variables
Definition at line 51 of file labelizedVariable.h.
gum::LabelizedVariable::LabelizedVariable | ( | const std::string & | aName, |
const std::string & | aDesc = "" , |
||
const Size | nbrLabel = 2 |
||
) |
constructor
aName | the name |
aDesc | the Description |
nbrLabel | the domainSize (2 by default) |
gum::LabelizedVariable::LabelizedVariable | ( | const std::string & | aName, |
const std::string & | aDesc, | ||
const std::vector< std::string > & | labels | ||
) |
constructor
aName | the name |
aDesc | the Description |
labels | the labels |
gum::LabelizedVariable::LabelizedVariable | ( | const LabelizedVariable & | aLDRV | ) |
Copy constructor.
aLDRV | the variable we copy |
|
virtual |
destructor
|
inlineprotected |
(protected) Default constructor
Definition at line 172 of file labelizedVariable.h.
LabelizedVariable& gum::LabelizedVariable::addLabel | ( | const std::string & | aLabel | ) |
add a label with a new index (we assume that we will NEVER remove a label)
aLabel | the label to be added to the labelized variable |
DuplicateElement | is raised if the variable already contains the label |
void gum::LabelizedVariable::changeLabel | ( | Idx | pos, |
const std::string & | aLabel | ||
) | const |
change a label for this index
pos | the index of the label to be changed |
aLabel | the label to be added to the labelized variable |
DuplicateElement | is raised if the variable already contains |
OutOfBounds |
|
virtual |
a virtual clone ...
Implements gum::DiscreteVariable.
|
protectedinherited |
protected copy
aRV | to be copied |
|
protected |
copies the content of aLDRV
|
inherited |
returns the description of the variable
|
virtual |
Returns the domain.
Implements gum::DiscreteVariable.
Definition at line 29 of file labelizedVariable.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
returns the size of the random discrete variable domain
Implements gum::DiscreteVariable.
|
inherited |
void gum::LabelizedVariable::eraseLabels | ( | ) |
erase all the labels
|
virtual |
returns the index of a given label
label | searched label |
NotFound |
Implements gum::DiscreteVariable.
bool gum::LabelizedVariable::isLabel | ( | const std::string & | aLabel | ) | const |
indicates whether the variable already has the label passed in argument
aLabel | The label |
|
virtual |
|
inherited |
vector of labels
|
inherited |
returns the name of the variable
get a numerical representation of he indice-the value.
Implements gum::DiscreteVariable.
inequality operator
|
virtualinherited |
inequality operator
LabelizedVariable& gum::LabelizedVariable::operator= | ( | const LabelizedVariable & | aLDRV | ) |
copy operator
aLDRV | the labelized discrete random variable we copy |
equality operator
|
virtualinherited |
equality operator
|
inlineinherited |
from the label to its index in var.
NotFound |
Definition at line 139 of file discreteVariable.h.
Idx gum::LabelizedVariable::posLabel | ( | const std::string & | label | ) | const |
return the pos from label
|
inherited |
sets the description of the variable
theValue |
|
inherited |
sets the name of the variable
theValue |
|
inherited |
string version of *this
|
inherited |
string version of *this using description attribute instead of name.
|
virtual |
returns the type of variable
Implements gum::DiscreteVariable.
|
mutableprivate |
the set of labels contained in the variable
Definition at line 183 of file labelizedVariable.h.