aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::Variable Class Referenceabstract

Base class for every random variable. More...

#include <variable.h>

Inheritance diagram for gum::Variable:

Public Member Functions

Constructors / Destructors
virtual ~Variable ()
 destructor
virtual Variableclone () const =0
 Copy Factory.
Operators
Variableoperator= (const Variable &aRV)
 Copy operator.
bool operator== (const Variable &aRV) const
 equality operator
Accessors / Modifiers
void setName (const std::string &theValue)
 sets the name of the variable
const std::string & name () const
 returns the name of the variable
void setDescription (const std::string &theValue) const
 sets the description of the variable
const std::string & description () const
 returns the description of the variable
virtual VarType varType () const =0
 returns the type of variable
virtual std::string domain () const =0
 string represent the domain of the variable

Protected Member Functions

 Variable ()
 (protected) Default constructor
void copy_ (const Variable &aRV)
 protected copy
 Variable (const std::string &aName, const std::string &aDesc)
 constructor
 Variable (const Variable &aRV)
 copy constructor

Private Member Functions

virtual bool _checkSameDomain_ (const Variable &aRV) const =0
 check the domain

Private Attributes

std::string _name_
 the name of the variable
std::string _description_
 the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference.

Detailed Description

Base class for every random variable.

Definition at line 79 of file variable.h.

Constructor & Destructor Documentation

◆ ~Variable()

virtual gum::Variable::~Variable ( )
virtual

destructor

◆ Variable() [1/3]

gum::Variable::Variable ( )
inlineprotected

(protected) Default constructor

Definition at line 143 of file variable.h.

143{ GUM_CONSTRUCTOR(Variable); }
Variable()
(protected) Default constructor
Definition variable.h:143

References Variable().

Referenced by Variable(), Variable(), _checkSameDomain_(), clone(), copy_(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Variable() [2/3]

gum::Variable::Variable ( const std::string & aName,
const std::string & aDesc )
protected

constructor

Parameters
aNamename of the variable
aDescdescription of the variable

◆ Variable() [3/3]

gum::Variable::Variable ( const Variable & aRV)
protected

copy constructor

Parameters
aRVthe variable we copy

References Variable().

Here is the call graph for this function:

Member Function Documentation

◆ _checkSameDomain_()

virtual bool gum::Variable::_checkSameDomain_ ( const Variable & aRV) const
privatepure virtual

check the domain

this function use the assumption that the concrete type of the variable is the same as *this

Implemented in gum::ContinuousVariable< GUM_SCALAR >, gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.

References Variable().

Here is the call graph for this function:

◆ clone()

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

Copy Factory.

Returns
Returns a pointer on a new copy of this.

Implemented in gum::ContinuousVariable< GUM_SCALAR >, gum::DiscreteVariable, gum::DiscretizedVariable< T_TICKS >, gum::IContinuousVariable, gum::IDiscretizedVariable, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.

References Variable().

Here is the call graph for this function:

◆ copy_()

void gum::Variable::copy_ ( const Variable & aRV)
protected

protected copy

Parameters
aRVto be copied

References Variable().

Here is the call graph for this function:

◆ description()

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

returns the description of the variable

◆ domain()

virtual std::string gum::Variable::domain ( ) const
pure virtual

◆ name()

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

returns the name of the variable

Referenced by gum::learning::IBNLearner::Database::Database(), gum::Estimator< GUM_SCALAR >::Estimator(), gum::MultiDimImplementation< double >::MultiDimImplementation(), gum::NumericalDiscreteVariable::NumericalDiscreteVariable(), gum::BNdistance< GUM_SCALAR >::_checkCompatibility_(), gum::BayesNet< double >::_copyTensors_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveCommonType_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveInputs_(), gum::BayesNetFactory< GUM_SCALAR >::_setCPTAndParents_(), gum::Instantiation::add(), gum::FMDP< double >::addCostForAction(), gum::FMDP< GUM_SCALAR >::addVariable(), gum::MultiDimICIModel< GUM_SCALAR >::causalWeight(), gum::Instantiation::chgVal(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::InfluenceDiagram< GUM_SCALAR >::copyStructureAndTables_(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::BayesNetFactory< GUM_SCALAR >::endVariableDeclaration(), gum::FMDPFactory< GUM_SCALAR >::endVariableDeclaration(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::Estimator< GUM_SCALAR >::posterior(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::Instantiation::setValsFrom(), gum::BayesNetFactory< GUM_SCALAR >::setVariable(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValuesUnchecked(), gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::toDot(), gum::RangeVariable::toFast(), gum::Estimator< GUM_SCALAR >::update(), and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::varNodeListe().

◆ operator=()

Variable & gum::Variable::operator= ( const Variable & aRV)

Copy operator.

Parameters
aRVto be copied
Returns
a const ref to *this

References Variable().

Here is the call graph for this function:

◆ operator==()

bool gum::Variable::operator== ( const Variable & aRV) const

equality operator

References Variable().

Here is the call graph for this function:

◆ setDescription()

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

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)

sets the name of the variable

Parameters
theValue

◆ varType()

Member Data Documentation

◆ _description_

std::string gum::Variable::_description_
mutableprivate

the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference.

Definition at line 165 of file variable.h.

◆ _name_

std::string gum::Variable::_name_
private

the name of the variable

Definition at line 160 of file variable.h.


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