aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::IDiscretizedVariable Class Referenceabstract

A base class for discretized variables, independent of the ticks type. More...

#include <agrum/tools/variables/IDiscretizedVariable.h>

+ Inheritance diagram for gum::IDiscretizedVariable:
+ Collaboration diagram for gum::IDiscretizedVariable:

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
 IDiscretizedVariable (const std::string &aName, const std::string &aDesc)
 Default constructor. More...
 
 IDiscretizedVariable (const IDiscretizedVariable &from)
 Copy Constructor. More...
 
virtual ~IDiscretizedVariable ()
 destructor More...
 
virtual IDiscretizedVariableclone () const =0
 Copy Factory. More...
 
Accessors / Modifiers
virtual std::vector< doubleticksAsDoubles () const =0
 return the list of ticks as a vector of doubles 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
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

IDiscretizedVariableoperator= (const IDiscretizedVariable &from)
 copy operator More...
 
void copy_ (const Variable &aRV)
 protected copy More...
 

Detailed Description

A base class for discretized variables, independent of the ticks type.

Definition at line 39 of file IDiscretizedVariable.h.

Constructor & Destructor Documentation

◆ IDiscretizedVariable() [1/2]

gum::IDiscretizedVariable::IDiscretizedVariable ( const std::string &  aName,
const std::string &  aDesc 
)

Default constructor.

◆ IDiscretizedVariable() [2/2]

gum::IDiscretizedVariable::IDiscretizedVariable ( const IDiscretizedVariable from)

Copy Constructor.

If from has any listener, it will not be copied.

Parameters
fromthe variable we copy

◆ ~IDiscretizedVariable()

virtual gum::IDiscretizedVariable::~IDiscretizedVariable ( )
virtual

destructor

Member Function Documentation

◆ clone()

virtual IDiscretizedVariable* gum::IDiscretizedVariable::clone ( ) const
pure virtual

Copy Factory.

Implements gum::DiscreteVariable.

Implemented in gum::DiscretizedVariable< T_TICKS >.

◆ copy_()

void gum::Variable::copy_ ( const Variable aRV)
protectedinherited

protected copy

Parameters
aRVto be copied

◆ description()

const std::string& gum::Variable::description ( ) const
inherited

returns the description of the variable

◆ domain()

virtual const std::string gum::DiscreteVariable::domain ( ) const
pure virtualinherited

string represent the domain of the variable

Implements gum::Variable.

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

◆ domainSize()

virtual Size gum::DiscreteVariable::domainSize ( ) const
pure virtualinherited
Returns
the number of modalities of the random discrete

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

◆ empty()

bool gum::DiscreteVariable::empty ( ) const
inherited
Returns
true if the domainSize() < 2;

◆ index()

virtual Idx gum::DiscreteVariable::index ( const std::string &  label) const
pure virtualinherited

◆ label()

virtual std::string gum::DiscreteVariable::label ( Idx  i) const
pure virtualinherited

get the indice-th label. This method is pure virtual.

Parameters
indicethe index of the label we wish to return
Exceptions
OutOfBound

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

◆ labels()

std::vector< std::string > gum::DiscreteVariable::labels ( ) const
inherited

vector of labels

◆ name()

const std::string& gum::Variable::name ( ) const
inherited

returns the name of the variable

◆ numerical()

virtual double gum::DiscreteVariable::numerical ( Idx  indice) const
pure virtualinherited

get a numerical representation of the indice-th value.

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

◆ operator!=() [1/2]

virtual bool gum::Variable::operator!= ( const Variable aRV) const
virtualinherited

inequality operator

◆ operator!=() [2/2]

virtual bool gum::DiscreteVariable::operator!= ( const DiscreteVariable aRV) const
virtualinherited

inequality operator

◆ operator=()

IDiscretizedVariable& gum::IDiscretizedVariable::operator= ( const IDiscretizedVariable from)
protected

copy operator

◆ operator==() [1/2]

virtual bool gum::Variable::operator== ( const Variable aRV) const
virtualinherited

equality operator

◆ operator==() [2/2]

virtual bool gum::DiscreteVariable::operator== ( const DiscreteVariable aRV) const
virtualinherited

equality operator

◆ operator[]()

Idx gum::DiscreteVariable::operator[] ( const std::string &  label) const
inlineinherited

from the label to its index in var.

Warning
This operation may have different complexity in different subclasses.
Exceptions
NotFound

Definition at line 139 of file discreteVariable.h.

139 { return index(label); };
virtual std::string label(Idx i) const =0
get the indice-th label. This method is pure virtual.
virtual Idx index(const std::string &label) const =0

◆ setDescription()

void gum::Variable::setDescription ( const std::string &  theValue) const
inherited

sets the description of the variable

Warning
since description is mutable, setDescription() is const
Parameters
theValue

◆ setName()

void gum::Variable::setName ( const std::string &  theValue)
inherited

sets the name of the variable

Parameters
theValue

◆ ticksAsDoubles()

virtual std::vector< double > gum::IDiscretizedVariable::ticksAsDoubles ( ) const
pure virtual

return the list of ticks as a vector of doubles

Implemented in gum::DiscretizedVariable< T_TICKS >.

◆ toString()

std::string gum::DiscreteVariable::toString ( ) const
inherited

string version of *this

◆ toStringWithDescription()

std::string gum::DiscreteVariable::toStringWithDescription ( ) const
inherited

string version of *this using description attribute instead of name.

◆ varType()

virtual VarType gum::DiscreteVariable::varType ( ) const
pure virtualinherited

returns the varType of variable

Implements gum::Variable.

Implemented in gum::LabelizedVariable, gum::DiscretizedVariable< T_TICKS >, and gum::RangeVariable.


The documentation for this class was generated from the following file: