DiaDes
0.1
DIAgnosisofDiscrete-EventSystem
|
#include <Expression.hh>
Inherited by Diades::Altarica::ArrayExpression, Diades::Altarica::ArrayMemberExpression, Diades::Altarica::BinaryExpression, Diades::Altarica::CaseExpression, Diades::Altarica::ExistExpression, Diades::Altarica::FalseExpression, Diades::Altarica::ForAllExpression, Diades::Altarica::FunctionCallExpression, Diades::Altarica::IdExpression, Diades::Altarica::IntegerExpression, Diades::Altarica::IteExpression, Diades::Altarica::MinMaxExpression, Diades::Altarica::NullExpression, Diades::Altarica::StructExpression, Diades::Altarica::StructMemberExpression, Diades::Altarica::TrueExpression, Diades::Altarica::UnaryExpression, and Diades::Altarica::VarExpression.
Public Types | |
enum | Category { IfThenElse =0, Case =1, Or =2, And =3, Eq =4, Neq =5, Imply =6, Lt =7, Gt =8, Leq =9, Geq =10, Add =11, Sub =12, Mul =13, Div =14, Mod =15, Neg =16, Not =17, Paren =18, StructMember =19, ArrayMember =20, Var =21, Id =22, Min =23, Max =24, True =25, False =26, Integer =27, ForAll =28, Exist =29, FunctionCall =30, Struct =31, Array =32 } |
typedef reference_wrapper< Expression const > | ConstReference |
typedef reference_wrapper< Expression > | Reference |
typedef std::vector< ConstReference > | ExprVector |
typedef Utils::Exception< Expression > | Exception |
typedef std::vector< VariableDecl::ConstReference >::const_iterator | VariableIterator |
typedef std::vector< VariableDecl::ConstReference >::size_type | SizeType |
typedef std::vector< VariableDecl::ConstReference > | Support |
Public Member Functions | |
virtual | ~Expression () |
const AltaricaModel & | model () const |
const NodeDecl & | owner () const |
bool | operator== (const Expression &e) const |
Expression (const NodeDecl &owner, unsigned id) | |
virtual Category | category () const =0 |
unsigned | id () const |
virtual bool | valid () const =0 |
VariableIterator | variableBegin () const |
VariableIterator | variableEnd () const |
SizeType | supportSize () const |
const Support & | support () const |
virtual const Type & | valueType () const =0 |
virtual bool | isConstant () const =0 |
Static Public Member Functions | |
static string | typeName () |
Protected Attributes | |
Support | _varSupport |
const NodeDecl & | _owner |
VariableDecls that are supporting the Expression. More... | |
unsigned | _id |
Friends | |
ostream & | operator<< (ostream &os, const Expression &expr) |
This class represents the internal structure of an Altarica expression This class is a virtual class.
Definition at line 26 of file Expression.hh.
typedef reference_wrapper<Expression const> Diades::Altarica::Expression::ConstReference |
ExprRef
copiable reference of an Expression Here we use a reference_wrapper to access any Expression available in a model The basic idea is that any Expression of a given AltaricaModel is created into the ExpressionFactory of the model. Once created, the factory returns a constant reference that is stored whereever it is required. Especially, if it is required to store such reference into an STL-vector, it is then required to a reference_wrapper. Hence the use of ExprRef for that purpose.
Definition at line 48 of file Expression.hh.
Definition at line 59 of file Expression.hh.
typedef std::vector<ConstReference> Diades::Altarica::Expression::ExprVector |
ExprVector
vector of expression references.
Definition at line 54 of file Expression.hh.
typedef reference_wrapper<Expression> Diades::Altarica::Expression::Reference |
Definition at line 49 of file Expression.hh.
typedef std::vector<VariableDecl::ConstReference>::size_type Diades::Altarica::Expression::SizeType |
Definition at line 64 of file Expression.hh.
typedef std::vector<VariableDecl::ConstReference> Diades::Altarica::Expression::Support |
Definition at line 65 of file Expression.hh.
typedef std::vector<VariableDecl::ConstReference>::const_iterator Diades::Altarica::Expression::VariableIterator |
Definition at line 63 of file Expression.hh.
Category
the category of an expression
Enumerator | |
---|---|
IfThenElse | |
Case | |
Or | |
And | |
Eq | |
Neq | |
Imply | |
Lt | |
Gt | |
Leq | |
Geq | |
Add | |
Sub | |
Mul | |
Div | |
Mod | |
Neg | |
Not | |
Paren | |
StructMember | |
ArrayMember | |
Var | |
Id | |
Min | |
Max | |
True | |
False | |
Integer | |
ForAll | |
Exist | |
FunctionCall | |
Struct | |
Array |
Definition at line 34 of file Expression.hh.
|
inlinevirtual |
Diades::Altarica::Expression::Expression | ( | const NodeDecl & | owner, |
unsigned | id | ||
) |
Parmetrised constructor
owner | the owner of the Expression |
id | the id of the Expression (provided by ExpressionFactory for internal use only) |
Referenced by operator==().
|
pure virtual |
Expression evaluation: this operation evaluates the expression with the current value associated to the variables that support the Expression. The evaluation is failing if there is a variable of the support that is still free (that is an unassigned variable).
value | the Value resulting from the evaluation of the current Expression. |
Implemented in Diades::Altarica::ArrayExpression, Diades::Altarica::StructExpression, Diades::Altarica::FunctionCallExpression, Diades::Altarica::ExistExpression, Diades::Altarica::ForAllExpression, Diades::Altarica::IntegerExpression, Diades::Altarica::FalseExpression, Diades::Altarica::TrueExpression, Diades::Altarica::MinMaxExpression, Diades::Altarica::IdExpression, Diades::Altarica::VarExpression, Diades::Altarica::ArrayMemberExpression, Diades::Altarica::StructMemberExpression, Diades::Altarica::UnaryExpression, Diades::Altarica::BinaryExpression, Diades::Altarica::CaseExpression, Diades::Altarica::IteExpression, and Diades::Altarica::NullExpression.
Referenced by Diades::Altarica::castExpr(), and operator==().
|
inline |
|
pure virtual |
Implemented in Diades::Altarica::ArrayExpression, Diades::Altarica::StructExpression, Diades::Altarica::FunctionCallExpression, Diades::Altarica::ExistExpression, Diades::Altarica::ForAllExpression, Diades::Altarica::IntegerExpression, Diades::Altarica::FalseExpression, Diades::Altarica::TrueExpression, Diades::Altarica::MinMaxExpression, Diades::Altarica::IdExpression, Diades::Altarica::VarExpression, Diades::Altarica::ArrayMemberExpression, Diades::Altarica::StructMemberExpression, Diades::Altarica::UnaryExpression, Diades::Altarica::BinaryExpression, Diades::Altarica::CaseExpression, Diades::Altarica::IteExpression, and Diades::Altarica::NullExpression.
Referenced by BOOST_AUTO_TEST_CASE(), and support().
const AltaricaModel& Diades::Altarica::Expression::model | ( | ) | const |
model of the current expression
Referenced by ~Expression().
|
inline |
Definition at line 100 of file Expression.hh.
References category(), and Expression().
const NodeDecl& Diades::Altarica::Expression::owner | ( | ) | const |
node declaration of the current expression
Referenced by BOOST_AUTO_TEST_CASE(), and ~Expression().
|
inline |
Definition at line 175 of file Expression.hh.
References _varSupport, Diades::Altarica::appendExpressionSupports(), isConstant(), Diades::Altarica::mergeExpressionSupports(), operator<<, and valueType().
|
inline |
VariableDecl support size
Definition at line 164 of file Expression.hh.
Referenced by BOOST_AUTO_TEST_CASE().
|
inlinestatic |
Definition at line 60 of file Expression.hh.
|
pure virtual |
Validity of an Expression
Implemented in Diades::Altarica::ArrayExpression, Diades::Altarica::StructExpression, Diades::Altarica::IntegerExpression, Diades::Altarica::FalseExpression, Diades::Altarica::TrueExpression, Diades::Altarica::MinMaxExpression, Diades::Altarica::IdExpression, Diades::Altarica::VarExpression, Diades::Altarica::ArrayMemberExpression, Diades::Altarica::StructMemberExpression, Diades::Altarica::UnaryExpression, Diades::Altarica::BinaryExpression, Diades::Altarica::CaseExpression, Diades::Altarica::IteExpression, and Diades::Altarica::NullExpression.
Referenced by Diades::Altarica::NodeDecl::addAssertion(), BOOST_AUTO_TEST_CASE(), id(), Diades::Altarica::IteExpression::valid(), Diades::Altarica::BinaryExpression::valid(), Diades::Altarica::UnaryExpression::valid(), Diades::Altarica::StructMemberExpression::valid(), and Diades::Altarica::ArrayMemberExpression::valid().
|
pure virtual |
Type of the Value returned by the Expression (lazy computation)
Implemented in Diades::Altarica::ArrayExpression, Diades::Altarica::StructExpression, Diades::Altarica::FunctionCallExpression, Diades::Altarica::ExistExpression, Diades::Altarica::ForAllExpression, Diades::Altarica::IntegerExpression, Diades::Altarica::FalseExpression, Diades::Altarica::TrueExpression, Diades::Altarica::MinMaxExpression, Diades::Altarica::IdExpression, Diades::Altarica::VarExpression, Diades::Altarica::ArrayMemberExpression, Diades::Altarica::StructMemberExpression, Diades::Altarica::UnaryExpression, Diades::Altarica::BinaryExpression, Diades::Altarica::CaseExpression, Diades::Altarica::IteExpression, and Diades::Altarica::NullExpression.
Referenced by BOOST_AUTO_TEST_CASE(), Diades::Altarica::BinaryExpression::category(), Diades::Altarica::IdExpression::category(), Diades::Altarica::FalseExpression::category(), Diades::Altarica::ForAllExpression::category(), Diades::Altarica::ExistExpression::category(), Diades::Altarica::FunctionCallExpression::category(), Diades::Altarica::StructMemberExpression::getMember(), Diades::Altarica::NullExpression::isConstant(), support(), Diades::Altarica::ArrayMemberExpression::valid(), Diades::Altarica::MinMaxExpression::valid(), Diades::Altarica::TrueExpression::valid(), Diades::Altarica::IntegerExpression::valid(), Diades::Altarica::StructExpression::valid(), Diades::Altarica::ArrayExpression::valid(), Diades::Altarica::IteExpression::valueType(), and Diades::Altarica::UnaryExpression::valueType().
|
inline |
VariableDecl iterator
Definition at line 152 of file Expression.hh.
Referenced by BOOST_AUTO_TEST_CASE(), and Diades::Altarica::VarExpression::getVariableDecl().
|
inline |
VariableDecl iterator
Definition at line 158 of file Expression.hh.
Referenced by BOOST_AUTO_TEST_CASE().
|
friend |
Output stream operator
os | output stream |
expr | the Expression to print out |
Referenced by Diades::Altarica::ArrayMemberExpression::isConstant(), support(), Diades::Altarica::CaseExpression::~CaseExpression(), Diades::Altarica::ExistExpression::~ExistExpression(), Diades::Altarica::FalseExpression::~FalseExpression(), Diades::Altarica::ForAllExpression::~ForAllExpression(), Diades::Altarica::FunctionCallExpression::~FunctionCallExpression(), Diades::Altarica::IdExpression::~IdExpression(), Diades::Altarica::IntegerExpression::~IntegerExpression(), Diades::Altarica::IteExpression::~IteExpression(), Diades::Altarica::MinMaxExpression::~MinMaxExpression(), Diades::Altarica::TrueExpression::~TrueExpression(), and Diades::Altarica::VarExpression::~VarExpression().
|
protected |
Definition at line 74 of file Expression.hh.
Referenced by id().
|
protected |
VariableDecls that are supporting the Expression.
Type of the Value returned by the Expression. The VariableDecl is mutable because of lazy computation (may be not initialised at construction time but is constant characteristics of an Expression)
Definition at line 73 of file Expression.hh.
|
protected |
Definition at line 67 of file Expression.hh.
Referenced by support(), and Diades::Altarica::VarExpression::valid().