![]() |
aGrUM
0.21.0
a C++ library for (probabilistic) graphical models
|
Base class for discrete random variable. More...
#include <discreteVariable.h>
Public Member Functions | |
Idx | operator[] (const std::string &label) const |
from the label to its index in var. More... | |
virtual Idx | index (const std::string &label) const =0 |
virtual std::string | label (Idx i) const =0 |
get the indice-th label. This method is pure virtual. 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... | |
virtual const std::string | domain () const =0 |
string represent the domain of the variable More... | |
Constructors / Destructors | |
DiscreteVariable (const std::string &aName, const std::string &aDesc) | |
Default constructor. More... | |
DiscreteVariable (const DiscreteVariable &aDRV) | |
Copy constructor. More... | |
virtual | ~DiscreteVariable () |
destructor More... | |
virtual DiscreteVariable * | clone () const =0 |
Copy Factory. More... | |
Accessors / Modifiers | |
bool | empty () const |
virtual Size | domainSize () const =0 |
std::vector< std::string > | labels () const |
vector of labels More... | |
virtual double | numerical (Idx indice) const =0 |
get a numerical representation of the indice-th value. More... | |
virtual VarType | varType () const =0 |
returns the varType of variable More... | |
Operators | |
DiscreteVariable & | operator= (const DiscreteVariable &aRV) |
Copy operator. More... | |
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 | |
DiscreteVariable () | |
(protected) Default constructor More... | |
void | copy_ (const Variable &aRV) |
protected copy More... | |
Base class for discrete random variable.
This class is used as an interface.
Definition at line 59 of file discreteVariable.h.
gum::DiscreteVariable::DiscreteVariable | ( | const std::string & | aName, |
const std::string & | aDesc | ||
) |
Default constructor.
gum::DiscreteVariable::DiscreteVariable | ( | const DiscreteVariable & | aDRV | ) |
Copy constructor.
Copy Constructor.
If aDRV haves any listener, it will not be copied.
aDRV | the variable we copy |
|
virtual |
destructor
|
inlineprotected |
(protected) Default constructor
Definition at line 159 of file discreteVariable.h.
|
pure virtual |
Copy Factory.
Implements gum::Variable.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, gum::IntegerVariable, gum::RangeVariable, and gum::IDiscretizedVariable.
|
protectedinherited |
protected copy
aRV | to be copied |
|
inherited |
returns the description of the variable
|
pure virtual |
string represent the domain of the variable
Implements gum::Variable.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, gum::RangeVariable, and gum::IntegerVariable.
|
pure virtual |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, gum::IntegerVariable, and gum::RangeVariable.
bool gum::DiscreteVariable::empty | ( | ) | const |
|
pure virtual |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::RangeVariable, gum::IntegerVariable, and gum::LabelizedVariable.
|
pure virtual |
get the indice-th label. This method is pure virtual.
indice | the index of the label we wish to return |
OutOfBound |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, gum::IntegerVariable, and gum::RangeVariable.
std::vector< std::string > gum::DiscreteVariable::labels | ( | ) | const |
vector of labels
|
inherited |
returns the name of the variable
get a numerical representation of the indice-th value.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, gum::IntegerVariable, and gum::RangeVariable.
inequality operator
Reimplemented in gum::IntegerVariable.
|
virtual |
inequality operator
DiscreteVariable& gum::DiscreteVariable::operator= | ( | const DiscreteVariable & | aRV | ) |
Copy operator.
aRV | to be copied |
equality operator
Reimplemented in gum::IntegerVariable.
|
virtual |
equality operator
|
inline |
from the label to its index in var.
NotFound |
Definition at line 139 of file discreteVariable.h.
|
inherited |
sets the description of the variable
theValue |
|
inherited |
sets the name of the variable
theValue |
std::string gum::DiscreteVariable::toString | ( | ) | const |
string version of *this
std::string gum::DiscreteVariable::toStringWithDescription | ( | ) | const |
string version of *this using description attribute instead of name.
|
pure virtual |
returns the varType of variable
Implements gum::Variable.
Implemented in gum::LabelizedVariable, gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, and gum::RangeVariable.