DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Friends | List of all members
Diades::Sdmdl::Experimental::Assignment Class Reference

#include <Assignment.hh>

Public Types

using Variable = Diades::Sdmdl::Variable
 
using Value = Diades::Sdmdl::Value
 
using Exception = Diades::Utils::Exception< Assignment >
 

Public Member Functions

 Assignment ()
 
bool valid () const
 
 Assignment (const Variable &var, const Value &val)
 
 Assignment (const Assignment &assignment)
 
 Assignment (const Assignment &&assignment)
 
virtual ~Assignment ()
 
void setVariable (const Variable &var)
 
void setValue (const Value &val)
 
const Variablevariable () const
 
const Valuevalue () const
 
Assignmentoperator= (const Assignment &assign)
 
bool operator== (const Assignment &assignment) const
 
void unvalidate ()
 

Static Public Member Functions

static string typeName ()
 

Private Types

using ConstVarReference = std::reference_wrapper< Variable const >
 
using ConstValReference = std::reference_wrapper< Value const >
 
using VarVector = std::vector< ConstVarReference >
 
using ValVector = std::vector< ConstValReference >
 

Private Attributes

VarVector _variable
 
ValVector _value
 

Friends

ostream & operator<< (ostream &os, const Assignment &assign)
 

Detailed Description

An Assignment is the association of a Variable and a Value of its domains. An Assignment just contains reference and aims at being a temporary container for interfacing between Bdds and their interpretation

See also
FormulaUtils.hh

Definition at line 30 of file Assignment.hh.

Member Typedef Documentation

◆ ConstValReference

_value this vector contains at most one Diades::Sdmdl::Experimental::Assignment::ConstValReference
private

associated with the Value of the Assignement

Definition at line 65 of file Assignment.hh.

◆ ConstVarReference

associated with the Variable of the Assignement

Definition at line 61 of file Assignment.hh.

◆ Exception

Definition at line 46 of file Assignment.hh.

◆ Value

Definition at line 41 of file Assignment.hh.

◆ ValVector

Definition at line 73 of file Assignment.hh.

◆ Variable

Definition at line 36 of file Assignment.hh.

◆ VarVector

Definition at line 69 of file Assignment.hh.

Constructor & Destructor Documentation

◆ Assignment() [1/4]

Exception exception that is raised by Diades::Sdmdl::Experimental::Assignment::Assignment ( )
inline

Default contructor

Postcondition
!valid()

Definition at line 92 of file Assignment.hh.

◆ Assignment() [2/4]

Diades::Sdmdl::Experimental::Assignment::Assignment ( const Variable var,
const Value val 
)
inline

Constructor of an Assignment.

Create an assignment (var = val) if both parameters are valid and var.containsValue(val), the created assignement is invalid otherwise.

Parameters
vara Variable
vala Value

Definition at line 121 of file Assignment.hh.

◆ Assignment() [3/4]

Diades::Sdmdl::Experimental::Assignment::Assignment ( const Assignment assignment)
inline

Copy constructor

Parameters
assignmentan Assignment

Definition at line 132 of file Assignment.hh.

References _value, _variable, value(), and variable().

◆ Assignment() [4/4]

Diades::Sdmdl::Experimental::Assignment::Assignment ( const Assignment &&  assignment)
inline

Move constructor

Parameters
assignmentan Assignment

Definition at line 149 of file Assignment.hh.

◆ ~Assignment()

virtual Diades::Sdmdl::Experimental::Assignment::~Assignment ( )
inlinevirtual

Destructor

Definition at line 168 of file Assignment.hh.

Member Function Documentation

◆ operator=()

Assignment& Diades::Sdmdl::Experimental::Assignment::operator= ( const Assignment assign)
inline
Parameters
assignthe Assignment to be assigned
Returns
the current Assignment

Definition at line 246 of file Assignment.hh.

References _value, _variable, value(), and variable().

◆ operator==()

bool Diades::Sdmdl::Experimental::Assignment::operator== ( const Assignment assignment) const
inline
Parameters
assignmentthe Assignment to compare
Returns
true if both Assignment are equal. It means that they both refer to the same Variable and the same Value

Definition at line 272 of file Assignment.hh.

References valid(), value(), and variable().

◆ setValue()

void Diades::Sdmdl::Experimental::Assignment::setValue ( const Value val)
inline

Set the Value of the current Assignment. If the Value is valid and is a possible Value of the variable(), set the Assignment to (variable() = val). The Assignment is invalid otherwise

Parameters
valthe Value to assign

Definition at line 202 of file Assignment.hh.

References Diades::Sdmdl::Value::isNull().

◆ setVariable()

void Diades::Sdmdl::Experimental::Assignment::setVariable ( const Variable var)
inline

Set the Variable of the current Assignment. If the Variable is valid, and a default Value is available for this Variable, set the Assignment to (var = var.defaultValue). The Assignment is invalid otherwise

Parameters
vara Variable

Definition at line 179 of file Assignment.hh.

References Diades::Sdmdl::Variable::defaultValue(), Diades::Sdmdl::Value::isNull(), and Diades::Sdmdl::Variable::isNull().

◆ typeName()

static string Diades::Sdmdl::Experimental::Assignment::typeName ( )
inlinestatic
Returns
the name of the class

Definition at line 52 of file Assignment.hh.

◆ unvalidate()

void Diades::Sdmdl::Experimental::Assignment::unvalidate ( )
inline

Mahe the Assignment invalid

Definition at line 283 of file Assignment.hh.

◆ valid()

bool Diades::Sdmdl::Experimental::Assignment::valid ( ) const
inline
Returns
true if the Assignment is valid which means that it owns a Variable and a Value that is part of the domain of the Variable

Definition at line 104 of file Assignment.hh.

Referenced by operator==(), value(), and variable().

◆ value()

const Value& Diades::Sdmdl::Experimental::Assignment::value ( ) const
inline
Returns
the underlying Value of the Assignment

Definition at line 233 of file Assignment.hh.

References require, and valid().

Referenced by Assignment(), Diades::Sdmdl::Experimental::StateInfoEncoder::getStateInfoId(), operator=(), and operator==().

◆ variable()

const Variable& Diades::Sdmdl::Experimental::Assignment::variable ( ) const
inline
Returns
the underlying Variable of the Assignment

Definition at line 221 of file Assignment.hh.

References require, and valid().

Referenced by Assignment(), Diades::Sdmdl::Experimental::StateInfoEncoder::getStateInfoId(), operator=(), and operator==().

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  os,
const Assignment assign 
)
friend

Stream operator

Parameters
osthe output stream
assignthe Assignment to print out
Returns
the updated stream also work with invalid Assignment

Definition at line 299 of file Assignment.hh.

Member Data Documentation

◆ _value

ValVector Diades::Sdmdl::Experimental::Assignment::_value
private

Definition at line 83 of file Assignment.hh.

Referenced by Assignment(), and operator=().

◆ _variable

VarVector Diades::Sdmdl::Experimental::Assignment::_variable
private

Definition at line 78 of file Assignment.hh.

Referenced by Assignment(), and operator=().


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