DiaDes  0.1
DIAgnosisofDiscrete-EventSystem
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Diades::Altarica::NodeDecl Class Reference

#include <NodeDecl.hh>

Public Types

typedef reference_wrapper< NodeDeclReference
 
typedef reference_wrapper< NodeDecl const > ConstReference
 
typedef NodeDeclPointer
 
typedef const NodeDeclConstPointer
 
typedef VariableDecl::VarType VarType
 
typedef unordered_map< Identifier, NodeDecl::ReferenceSubNodeDictionary
 
typedef vector< EventDecl::ConstReference >::const_iterator EventDeclIterator
 

Public Member Functions

 ~NodeDecl ()
 
bool operator== (const NodeDecl &nodeDecl) const
 
bool operator!= (const NodeDecl &nodeDecl) const
 
const AltaricaModelowner () const
 
AltaricaModelowner ()
 
unsigned id () const
 
const Identifiername () const
 
void terminateInitialisation ()
 
const VariableDeclvariableDecl () const
 
VariableDeclvariableDecl ()
 
const VariableDeclgetVariableDecl (const Identifier &id) const
 
void addVariableDecl (const VariableDecl &var)
 
const vector< VariableDecl::ConstReference > & flowVariableDecls () const
 
const vector< VariableDecl::ConstReference > & stateVariableDecls () const
 
const DomaingetDomain (const Identifier &id)
 
void setDomain (const Domain &dom)
 
void addAssertion (const Expression &assertion)
 
const Expression::ExprVectorassertions () const
 
TransitionnewTransition (const Expression &precondition)
 
const vector< Transition::ConstReference > & transitions () const
 
const EventDeclgetEventDecl (const Identifier &id) const
 
EventDeclgetEventDecl (const Identifier &id)
 
void addEventDecl (EventDecl &event)
 
EventDeclIterator eventDeclBegin () const
 
EventDeclIterator eventDeclEnd () const
 
void setPriorities (const list< EventDecl::Reference > &lowEventDecls, const list< EventDecl::Reference > &highEventDecls)
 
bool isGreater (const EventDecl &evt1, const EventDecl &evt2) const
 
bool isLower (const EventDecl &evt1, const EventDecl &evt2) const
 
bool notOrdered (const EventDecl &evt1, const EventDecl &evt2) const
 
void newAttribute (const Identifier &name)
 
const ParameterDeclnewParameterDecl (const Identifier &name, const Domain &domain)
 
const ParameterDeclgetParameterDecl (const Identifier &name) const
 
void addSyncVector (const vector< list< Identifier > > &paths)
 
const vector< vector< list< Identifier > > > & synchronisations () const
 
const AssignmentnewAssignment (const Expression &memberAccess, const Expression &expression)
 
void addInitialisation (const Assignment &assignment)
 
const vector< Assignment::ConstReference > & initialisations () const
 
bool valid () const
 
bool isNull () const
 
void addSubNode (const Identifier &id, NodeDecl &nodeDecl)
 
NodeDeclgetSubNode (const Identifier &id)
 
const NodeDeclgetSubNode (const Identifier &id) const
 
const SubNodeDictionarysubNodes () const
 
Constants
const ConstantDictionaryconstants () const
 
void addConstant (const Identifier &name, const Value &value)
 
const ValuegetConstant (const Identifier &name) const
 

Private Types

typedef unordered_map< Identifier, VariableDecl::ConstReferenceVariableDeclDictionary
 
typedef unordered_map< Identifier, Domain::ConstReferenceDomainDictionary
 
typedef unordered_map< Identifier, Value::ConstReferenceConstantDictionary
 

Private Member Functions

 NodeDecl (VariableDecl &variable, unsigned id, NodeDeclFactory &factory)
 

Private Attributes

NodeDeclFactory_factory
 
unsigned _id
 
Identifier _name
 
vector< VariableDecl::Reference_variableDecl
 
VariableDeclDictionary _variableDeclDictionary
 
vector< VariableDecl::ConstReference_flowVarDecl
 
vector< VariableDecl::ConstReference_stateVarDecl
 
vector< Transition::Pointer_transitions
 
vector< Transition::ConstReference_transitionsRef
 
Diades::Graph::Graph _eventDag
 
map< Diades::Graph::Node, EventDecl::ConstReference_events
 
vector< EventDecl::ConstReference_eventDecls
 
set< Identifier_attributes
 
unordered_map< Identifier, ParameterDecl::ConstReference_parameterDecls
 
Expression::ExprVector _assertions
 
vector< Assignment::Pointer_assignments
 
vector< Assignment::ConstReference_initialisations
 
DomainDictionary _domains
 
vector< vector< list< Identifier > > > _syncVectors
 
SubNodeDictionary _subNodes
 
ConstantDictionary _constantDictionary
 

Friends

class NodeDeclFactory
 
class IdExpression
 

Exception

Exception mechanism

typedef Utils::Exception< NodeDeclException
 
static string typeName ()
 

Detailed Description

A NodeDecl is an object that represents a node declaration in an altarica model From a parsing point of view with arsyntax, this class gathers the information below a AR_TREE_NODE in an altarica tree.

Definition at line 36 of file NodeDecl.hh.

Member Typedef Documentation

◆ ConstantDictionary

ConstantDictionary dictionary of the global domains

Definition at line 114 of file NodeDecl.hh.

◆ ConstPointer

Definition at line 42 of file NodeDecl.hh.

◆ ConstReference

typedef reference_wrapper<NodeDecl const> Diades::Altarica::NodeDecl::ConstReference

Definition at line 40 of file NodeDecl.hh.

◆ DomainDictionary

DomainDictionary to store domain declarations

Definition at line 81 of file NodeDecl.hh.

◆ EventDeclIterator

EventDeclIterator iterator on the state VariableDecl

Definition at line 273 of file NodeDecl.hh.

◆ Exception

Definition at line 51 of file NodeDecl.hh.

◆ Pointer

Definition at line 41 of file NodeDecl.hh.

◆ Reference

typedef reference_wrapper<NodeDecl> Diades::Altarica::NodeDecl::Reference

Definition at line 39 of file NodeDecl.hh.

◆ SubNodeDictionary

SubNodeDictionary to store the sub-nodes

Definition at line 64 of file NodeDecl.hh.

◆ VariableDeclDictionary

VariableDeclDictionary to store variable declarations

Definition at line 73 of file NodeDecl.hh.

◆ VarType

VariableType the type of variable declared in the node A Variable may be declared as a flow, state or subnode variable

Definition at line 59 of file NodeDecl.hh.

Constructor & Destructor Documentation

◆ NodeDecl()

Diades::Altarica::NodeDecl::NodeDecl ( VariableDecl variable,
unsigned  id,
NodeDeclFactory factory 
)
private

Parametrised constructor

Parameters
variablethe associated node variable declaration
idits id
factorythe factory that owns this NodeDecl

◆ ~NodeDecl()

Diades::Altarica::NodeDecl::~NodeDecl ( )

Destructor

Member Function Documentation

◆ addAssertion()

void Diades::Altarica::NodeDecl::addAssertion ( const Expression assertion)
inline
Parameters
assertionan expression that defines an assertion of the NodeDecl
Precondition
valid() && assertion!=nullptr && assertion->valid()
Todo:
test

Definition at line 466 of file NodeDecl.hh.

References require, and Diades::Altarica::Expression::valid().

◆ addConstant()

void Diades::Altarica::NodeDecl::addConstant ( const Identifier name,
const Value value 
)
inline

Definition at line 247 of file NodeDecl.hh.

References always_require, getConstant(), isNull(), and name().

◆ addEventDecl()

void Diades::Altarica::NodeDecl::addEventDecl ( EventDecl event)

Add an event decl to the node

Parameters
eventthe event to add

Referenced by transitions().

◆ addInitialisation()

void Diades::Altarica::NodeDecl::addInitialisation ( const Assignment assignment)
inline

add initialisations

Parameters
assignmentan assignment
Todo:
test

Definition at line 655 of file NodeDecl.hh.

References Diades::Altarica::Assignment::owner(), require, and Diades::Altarica::Assignment::valid().

◆ addSubNode()

void Diades::Altarica::NodeDecl::addSubNode ( const Identifier id,
NodeDecl nodeDecl 
)
inline

Add a sub node

Parameters
idthe identifier of the sub node
nodeDeclthe declaration of the sub-node

Definition at line 703 of file NodeDecl.hh.

◆ addSyncVector()

void Diades::Altarica::NodeDecl::addSyncVector ( const vector< list< Identifier > > &  paths)
inline

add a synchronisation vector to a NodeDecl

Parameters
pathsa sunchronisation vector
Todo:
test

Definition at line 624 of file NodeDecl.hh.

◆ addVariableDecl()

void Diades::Altarica::NodeDecl::addVariableDecl ( const VariableDecl var)
Parameters
varthe variable to add

Referenced by variableDecl().

◆ assertions()

const Expression::ExprVector& Diades::Altarica::NodeDecl::assertions ( ) const
inline
Returns
the set of assertions

Definition at line 478 of file NodeDecl.hh.

References _assertions, and newTransition().

Referenced by Diades::Altarica::Node::assertions().

◆ constants()

const ConstantDictionary& Diades::Altarica::NodeDecl::constants ( ) const
inline

Definition at line 242 of file NodeDecl.hh.

References _constantDictionary.

◆ eventDeclBegin()

EventDeclIterator Diades::Altarica::NodeDecl::eventDeclBegin ( ) const
inline
Returns
an iterator on the first event of the node

Definition at line 525 of file NodeDecl.hh.

◆ eventDeclEnd()

EventDeclIterator Diades::Altarica::NodeDecl::eventDeclEnd ( ) const
inline
Returns
an iterator on the item after the last event of the node

Definition at line 533 of file NodeDecl.hh.

References setPriorities().

◆ flowVariableDecls()

const vector<VariableDecl::ConstReference>& Diades::Altarica::NodeDecl::flowVariableDecls ( ) const
inline
Returns
the flow variable declarations

Definition at line 411 of file NodeDecl.hh.

References _flowVarDecl.

◆ getConstant()

const Value& Diades::Altarica::NodeDecl::getConstant ( const Identifier name) const

Referenced by addConstant().

◆ getDomain()

const Domain& Diades::Altarica::NodeDecl::getDomain ( const Identifier id)

Get the domain of a given name in the scope of this node

Parameters
idthe id of the domain
Returns
the domain with this id or an invalid domain otherwise.

Referenced by setDomain(), and stateVariableDecls().

◆ getEventDecl() [1/2]

const EventDecl& Diades::Altarica::NodeDecl::getEventDecl ( const Identifier id) const

Get an event

Parameters
labelthe label of the event
Returns
the event 'label' declared in the current node
Todo:
test

Referenced by transitions().

◆ getEventDecl() [2/2]

EventDecl& Diades::Altarica::NodeDecl::getEventDecl ( const Identifier id)

Get an event

Parameters
labelthe label of the event
Returns
the event 'label' declared in the current node
Todo:
test

◆ getParameterDecl()

const ParameterDecl& Diades::Altarica::NodeDecl::getParameterDecl ( const Identifier name) const

Parameter access

Parameters
namethe identifier of the Parameter
Returns
the Parameter of the given name, an invalid Parameter otherwise
Todo:
test

Referenced by notOrdered().

◆ getSubNode() [1/2]

NodeDecl& Diades::Altarica::NodeDecl::getSubNode ( const Identifier id)
inline
Parameters
idIdentifier of the sub node
Returns
the sub node

Definition at line 715 of file NodeDecl.hh.

References always_require, and name().

◆ getSubNode() [2/2]

const NodeDecl& Diades::Altarica::NodeDecl::getSubNode ( const Identifier id) const
inline
Parameters
idIdentifier of the sub node
Returns
the sub node

Definition at line 732 of file NodeDecl.hh.

References always_require, and name().

◆ getVariableDecl()

const VariableDecl& Diades::Altarica::NodeDecl::getVariableDecl ( const Identifier id) const

Get the VariableDecl with the identifier id

Parameters
idthe identifier of the VariableDecl
Returns
the given VariableDecl if it exists, an invalid VariableDecl otherwise
Todo:
test

Referenced by variableDecl().

◆ id()

unsigned Diades::Altarica::NodeDecl::id ( ) const
inline
Returns
the id of the NodeDecl
Todo:
test

Definition at line 336 of file NodeDecl.hh.

References _id.

◆ initialisations()

const vector<Assignment::ConstReference>& Diades::Altarica::NodeDecl::initialisations ( ) const
inline
Returns
the set of initialisations

Definition at line 669 of file NodeDecl.hh.

References _initialisations.

Referenced by Diades::Altarica::Node::initialisations().

◆ isGreater()

bool Diades::Altarica::NodeDecl::isGreater ( const EventDecl evt1,
const EventDecl evt2 
) const
inline
Parameters
evt1an event of the node
evt2an event of the node
Returns
true if evt1 > evt2 (priority)

Definition at line 558 of file NodeDecl.hh.

References Diades::Altarica::EventDecl::graphNode(), and Diades::Graph::Graph::succeeds().

Referenced by isLower(), and notOrdered().

◆ isLower()

bool Diades::Altarica::NodeDecl::isLower ( const EventDecl evt1,
const EventDecl evt2 
) const
inline
Parameters
evt1an event of the node
evt2an event of the node
Returns
true if evt1 < evt2 (priority)

Definition at line 572 of file NodeDecl.hh.

References isGreater().

Referenced by notOrdered().

◆ isNull()

bool Diades::Altarica::NodeDecl::isNull ( ) const
Returns
true if the NodeDecl is null
Todo:
test

Referenced by addConstant(), setDomain(), and valid().

◆ name()

const Identifier& Diades::Altarica::NodeDecl::name ( ) const
inline
Returns
the name of the NodeDecl
Todo:
test

Definition at line 349 of file NodeDecl.hh.

References _name, and terminateInitialisation().

Referenced by addConstant(), getSubNode(), and setDomain().

◆ newAssignment()

const Assignment& Diades::Altarica::NodeDecl::newAssignment ( const Expression memberAccess,
const Expression expression 
)

new assignment to create

Parameters
themember to initialise
theinitialisation expression
Todo:
test

Referenced by synchronisations().

◆ newAttribute()

void Diades::Altarica::NodeDecl::newAttribute ( const Identifier name)

Attribute constructor

Parameters
namethe attrbute
Todo:
test

Referenced by notOrdered().

◆ newParameterDecl()

const ParameterDecl& Diades::Altarica::NodeDecl::newParameterDecl ( const Identifier name,
const Domain domain 
)

ParameterDecl constructor

Parameters
namethe identifier of the Parameter
domainthe domain of the Parameter
Returns
the newly created Parameter
Todo:
test

Referenced by notOrdered().

◆ newTransition()

Transition& Diades::Altarica::NodeDecl::newTransition ( const Expression precondition)
Parameters
preconditionthe precondition of the new Transition
Returns
a new transition
Precondition
valid()
Todo:
test

Referenced by assertions().

◆ notOrdered()

bool Diades::Altarica::NodeDecl::notOrdered ( const EventDecl evt1,
const EventDecl evt2 
) const
inline
Parameters
evt1an event of the node
evt2an event of the node
Returns
true if there is no priority between evt1 and evt2

Definition at line 587 of file NodeDecl.hh.

References getParameterDecl(), isGreater(), isLower(), newAttribute(), and newParameterDecl().

◆ operator!=()

bool Diades::Altarica::NodeDecl::operator!= ( const NodeDecl nodeDecl) const
inline

Difference operator (reference equality)

Parameters
nodeDeclthe NodeDecl to compare with
Returns
true of both NodeDecl are not equal (by reference, time-constant)

Definition at line 303 of file NodeDecl.hh.

References owner().

◆ operator==()

bool Diades::Altarica::NodeDecl::operator== ( const NodeDecl nodeDecl) const
inline

Equality operator (reference equality)

Parameters
nodeDeclthe NodeDecl to compare with
Returns
true of both NodeDecl are equal (by reference, time-constant)

Definition at line 291 of file NodeDecl.hh.

◆ owner() [1/2]

const AltaricaModel& Diades::Altarica::NodeDecl::owner ( ) const

◆ owner() [2/2]

AltaricaModel& Diades::Altarica::NodeDecl::owner ( )

The AltaricaModel that owns the NodeDecl

Returns
the AltaricaModel that owns the NodeDecl
Todo:
test

◆ setDomain()

void Diades::Altarica::NodeDecl::setDomain ( const Domain dom)
inline

Set the domain

Parameters
doma new Domain
Todo:
test

Definition at line 450 of file NodeDecl.hh.

References getDomain(), Diades::Altarica::Domain::isNull(), isNull(), Diades::Altarica::Domain::name(), name(), and require.

◆ setPriorities()

void Diades::Altarica::NodeDecl::setPriorities ( const list< EventDecl::Reference > &  lowEventDecls,
const list< EventDecl::Reference > &  highEventDecls 
)

EventDecl priorities

Parameters
lowEventDeclsthe set of events with the lower priority
highEventDeclsthe set of events with the higher priority
Todo:
test

Referenced by eventDeclEnd().

◆ stateVariableDecls()

const vector<VariableDecl::ConstReference>& Diades::Altarica::NodeDecl::stateVariableDecls ( ) const
inline
Returns
the state variable declarations

Definition at line 425 of file NodeDecl.hh.

References _stateVarDecl, and getDomain().

◆ subNodes()

const SubNodeDictionary& Diades::Altarica::NodeDecl::subNodes ( ) const
inline
Returns
the set of sub-nodes

Definition at line 748 of file NodeDecl.hh.

References _subNodes.

◆ synchronisations()

const vector< vector< list<Identifier> > >& Diades::Altarica::NodeDecl::synchronisations ( ) const
inline
Returns
the set of synchronisations

Definition at line 636 of file NodeDecl.hh.

References _syncVectors, and newAssignment().

◆ terminateInitialisation()

void Diades::Altarica::NodeDecl::terminateInitialisation ( )

Terminate the initialisation (should only be used at the end of the Node acquisition)

Referenced by name().

◆ transitions()

const vector<Transition::ConstReference>& Diades::Altarica::NodeDecl::transitions ( ) const
inline
Returns
the set of transition references

Definition at line 498 of file NodeDecl.hh.

References _transitionsRef, addEventDecl(), and getEventDecl().

Referenced by Diades::Altarica::Node::transitions().

◆ typeName()

static string Diades::Altarica::NodeDecl::typeName ( )
inlinestatic

Definition at line 52 of file NodeDecl.hh.

◆ valid()

bool Diades::Altarica::NodeDecl::valid ( ) const
inline
Returns
true if the NodeDecl is valid

Definition at line 680 of file NodeDecl.hh.

References isNull().

◆ variableDecl() [1/2]

const VariableDecl& Diades::Altarica::NodeDecl::variableDecl ( ) const
inline

The associated Variable Declaration. Every declaration of a node is associated to a variable declaration

Returns
the variable declaration associated to the current node declaration
Todo:
test

Definition at line 370 of file NodeDecl.hh.

References require.

◆ variableDecl() [2/2]

VariableDecl& Diades::Altarica::NodeDecl::variableDecl ( )
inline

The associated Variable Declaration. Every declaration of a node is associated to a variable declaration

Returns
the variable declaration associated to the current node declaration
Todo:
test

Definition at line 384 of file NodeDecl.hh.

References addVariableDecl(), getVariableDecl(), and require.

Friends And Related Function Documentation

◆ IdExpression

friend class IdExpression
friend

Definition at line 753 of file NodeDecl.hh.

◆ NodeDeclFactory

friend class NodeDeclFactory
friend

Definition at line 235 of file NodeDecl.hh.

Member Data Documentation

◆ _assertions

Expression::ExprVector Diades::Altarica::NodeDecl::_assertions
private

_assertions the set of assertions of the NodeDecl

Definition at line 183 of file NodeDecl.hh.

Referenced by assertions().

◆ _assignments

vector<Assignment::Pointer> Diades::Altarica::NodeDecl::_assignments
private

_assignments the set of assignments created in this node

Definition at line 189 of file NodeDecl.hh.

◆ _attributes

set<Identifier> Diades::Altarica::NodeDecl::_attributes
private

_attributes the set of attributes of the NodeDecl

Definition at line 169 of file NodeDecl.hh.

◆ _constantDictionary

ConstantDictionary Diades::Altarica::NodeDecl::_constantDictionary
private

_constantDictionary the set of declared constant

Definition at line 223 of file NodeDecl.hh.

Referenced by constants().

◆ _domains

DomainDictionary Diades::Altarica::NodeDecl::_domains
private

_domains the set of domains in the scope of the node

Definition at line 200 of file NodeDecl.hh.

◆ _eventDag

Diades::Graph::Graph Diades::Altarica::NodeDecl::_eventDag
private

_eventDag the direct acyclic graph that encodes the priorities of the events

Definition at line 144 of file NodeDecl.hh.

◆ _eventDecls

vector<EventDecl::ConstReference> Diades::Altarica::NodeDecl::_eventDecls
private

_eventDecls the set of events

Definition at line 159 of file NodeDecl.hh.

◆ _events

map<Diades::Graph::Node,EventDecl::ConstReference> Diades::Altarica::NodeDecl::_events
private

_events the mapping between the nodes og the event DAG and the event

Todo:
try to use a NodeMap

Definition at line 153 of file NodeDecl.hh.

◆ _factory

NodeDeclFactory& Diades::Altarica::NodeDecl::_factory
private

_factory the NodeDeclFactory that generated this NodeDecl

Definition at line 86 of file NodeDecl.hh.

◆ _flowVarDecl

vector<VariableDecl::ConstReference> Diades::Altarica::NodeDecl::_flowVarDecl
private

_flowVarDecl list of the flow variable declaration

Definition at line 119 of file NodeDecl.hh.

Referenced by flowVariableDecls().

◆ _id

unsigned Diades::Altarica::NodeDecl::_id
private

_id the identifier that is generated by _factory

Definition at line 90 of file NodeDecl.hh.

Referenced by id().

◆ _initialisations

vector<Assignment::ConstReference> Diades::Altarica::NodeDecl::_initialisations
private

_initialisations the set of initialisations

Definition at line 195 of file NodeDecl.hh.

Referenced by initialisations().

◆ _name

Identifier Diades::Altarica::NodeDecl::_name
private

_name the name of the NodeDecl

Definition at line 94 of file NodeDecl.hh.

Referenced by name().

◆ _parameterDecls

unordered_map<Identifier,ParameterDecl::ConstReference> Diades::Altarica::NodeDecl::_parameterDecls
private

_parameterDecls the set of parameter declarations of the NodeDecl

Definition at line 175 of file NodeDecl.hh.

◆ _stateVarDecl

vector<VariableDecl::ConstReference> Diades::Altarica::NodeDecl::_stateVarDecl
private

_stateVarDecl list of the state variable declaration

Definition at line 124 of file NodeDecl.hh.

Referenced by stateVariableDecls().

◆ _subNodes

SubNodeDictionary Diades::Altarica::NodeDecl::_subNodes
private

_subNodes to store the sub nodes

Definition at line 216 of file NodeDecl.hh.

Referenced by subNodes().

◆ _syncVectors

vector< vector< list<Identifier> > > Diades::Altarica::NodeDecl::_syncVectors
private

_syncVectors synchronisation vectors ??

Todo:
look closely to this structure

Definition at line 209 of file NodeDecl.hh.

Referenced by synchronisations().

◆ _transitions

vector<Transition::Pointer> Diades::Altarica::NodeDecl::_transitions
private

_transitions this vector stores the Transition of the declared node

Definition at line 132 of file NodeDecl.hh.

◆ _transitionsRef

vector<Transition::ConstReference> Diades::Altarica::NodeDecl::_transitionsRef
private

_transitionsRef this vector stores the references of the Transition of the declared node

Definition at line 137 of file NodeDecl.hh.

Referenced by transitions().

◆ _variableDecl

vector<VariableDecl::Reference> Diades::Altarica::NodeDecl::_variableDecl
private

_variableDecl any NodeDecl is associated with a special VariableDecl. In this way, a NodeDecl can also be seen as a VariableDecl and then a NodeDecl also defines a scope for othe VariableDecl. Here this VariableDecl is stored in a vector as a Reference. This is a trick to initialize the reference after the creation of the NodeDecl

Definition at line 103 of file NodeDecl.hh.

◆ _variableDeclDictionary

VariableDeclDictionary Diades::Altarica::NodeDecl::_variableDeclDictionary
private

_variableDeclDictionary this dictionary stores the declaration of variables of the current node with an efficient access by their identifier.

Definition at line 110 of file NodeDecl.hh.


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