![]() |
aGrUM
0.21.0
a C++ library for (probabilistic) graphical models
|
class IntegerVariable More...
#include <integerVariable.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 | |
IntegerVariable (const std::string &aName, const std::string &aDesc="") | |
constructor More... | |
IntegerVariable (const std::string &aName, const std::string &aDesc, const std::vector< int > &domain) | |
constructor assigning a domain to the variable More... | |
IntegerVariable (const IntegerVariable &from) | |
Copy constructor. More... | |
IntegerVariable (IntegerVariable &&from) | |
move constructor More... | |
virtual IntegerVariable * | clone () const |
virtual copy constructor More... | |
virtual | ~IntegerVariable () |
destructor More... | |
Operators | |
IntegerVariable & | operator= (const IntegerVariable &from) |
copy operator More... | |
IntegerVariable & | operator= (IntegerVariable &&from) |
move operator More... | |
virtual bool | operator== (const Variable &var) const |
equality operator More... | |
virtual bool | operator!= (const Variable &var) const |
inequality operator More... | |
Accessors / Modifiers | |
virtual Size | domainSize () const |
returns the domain size of the discrete random variable More... | |
virtual VarType | varType () const |
returns the type of variable More... | |
virtual Idx | index (const std::string &label) const |
returns the index of a given label More... | |
virtual std::string | label (Idx index) const |
returns a string corresponding to the ith value of the domain More... | |
virtual double | numerical (Idx index) const |
get a integer representation of the value at a given index More... | |
virtual const std::string | domain () const |
Returns the domain as a string. More... | |
const Sequence< int > & | integerDomain () const |
returns the domain as a sequence of values More... | |
IntegerVariable & | addValue (int value) |
add a new value to the domain size More... | |
void | changeValue (int old_value, int new_value) |
substitute a value by another one More... | |
void | eraseValue (int value) |
erase a value from the domain of the variable More... | |
void | eraseValues () |
clear the domain of the variable 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... | |
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 | |
void | copy_ (const Variable &aRV) |
protected copy More... | |
class IntegerVariable
The class representing discrete integer random variables
Definition at line 47 of file integerVariable.h.
gum::IntegerVariable::IntegerVariable | ( | const std::string & | aName, |
const std::string & | aDesc = "" |
||
) |
constructor
aName | the name of the variable |
aDesc | the Description of the variable, if any |
gum::IntegerVariable::IntegerVariable | ( | const std::string & | aName, |
const std::string & | aDesc, | ||
const std::vector< int > & | domain | ||
) |
constructor assigning a domain to the variable
aName | the name of the variable |
aDesc | the Description of the variable, if any |
domain | the domain (set of values) of the variable |
Definition at line 31 of file integerVariable.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::IntegerVariable::IntegerVariable | ( | const IntegerVariable & | from | ) |
Copy constructor.
from | the variable we copy |
gum::IntegerVariable::IntegerVariable | ( | IntegerVariable && | from | ) |
move constructor
|
virtual |
destructor
IntegerVariable & gum::IntegerVariable::addValue | ( | int | value | ) |
add a new value to the domain size
DuplicateElement | is raised if the variable already contains the value |
Definition at line 82 of file integerVariable.cpp.
References gum::Set< Key, Alloc >::emplace().
void gum::IntegerVariable::changeValue | ( | int | old_value, |
int | new_value | ||
) |
substitute a value by another one
|
virtual |
virtual copy constructor
Implements gum::DiscreteVariable.
|
protectedinherited |
protected copy
aRV | to be copied |
|
inherited |
returns the description of the variable
|
virtual |
Returns the domain as a string.
Implements gum::DiscreteVariable.
Definition at line 62 of file integerVariable.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
returns the domain size of the discrete random variable
Implements gum::DiscreteVariable.
|
inherited |
void gum::IntegerVariable::eraseValue | ( | int | value | ) |
erase a value from the domain of the variable
void gum::IntegerVariable::eraseValues | ( | ) |
clear the domain of the variable
|
virtual |
returns the index of a given label
label | searched label |
NotFound |
Implements gum::DiscreteVariable.
const Sequence< int >& gum::IntegerVariable::integerDomain | ( | ) | const |
returns the domain as a sequence of values
|
virtual |
returns a string corresponding to the ith value of the domain
Implements gum::DiscreteVariable.
|
inherited |
vector of labels
|
inherited |
returns the name of the variable
get a integer representation of the value at a given index
Implements gum::DiscreteVariable.
inequality operator
Reimplemented from gum::Variable.
|
virtualinherited |
inequality operator
IntegerVariable& gum::IntegerVariable::operator= | ( | const IntegerVariable & | from | ) |
copy operator
from | the integer discrete random variable we copy |
IntegerVariable& gum::IntegerVariable::operator= | ( | IntegerVariable && | from | ) |
move operator
from | the integer discrete random variable we copy |
equality operator
Reimplemented from gum::Variable.
Definition at line 51 of file integerVariable.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
equality operator
|
inlineinherited |
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 |
|
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.
|
private |
the domain of the variable
Definition at line 158 of file integerVariable.h.