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

#include <Node.hh>

Inheritance diagram for Diades::Altarica::Node:
Inheritance graph

Public Types

typedef reference_wrapper< Node const > ConstReference
 
typedef reference_wrapper< NodeReference
 
typedef std::vector< ConstReferenceNodeVector
 
typedef NodeVector::iterator SubNodeIterator
 
typedef NodeVector::const_iterator SubNodeConstIterator
 
- Public Types inherited from Diades::Altarica::Variable
typedef FlatVariableIterator FlatIterator
 
typedef VariablePointer
 
typedef reference_wrapper< VariableReference
 
typedef reference_wrapper< Variable const > ConstReference
 
typedef vector< ReferenceVarVector
 
typedef vector< Variable >::iterator VariableIterator
 
typedef vector< Variable >::const_iterator VariableConstIterator
 
typedef unordered_map< Identifier, VarVector::size_type > SubVarDictionary
 
typedef Utils::Exception< VariableException
 

Public Member Functions

Constructors/Destructor
 Node ()
 
 ~Node ()
 
Accessors
const AltaricaModelowner () const
 
AltaricaModelowner ()
 
const NodenodeScope () const
 
const NodeDeclnodeDeclaration () const
 
const vector< Node > & subnodes () const
 
vector< Node > & subnodes ()
 
const NodegetSubNode (const Identifier &name) const
 
const vector< Variable::Reference > & flowVariables () const
 
vector< Variable::Reference > & flowVariables ()
 
VariablegetFlowVariable (const Identifier &name)
 
const VariablegetFlowVariable (const Identifier &name) const
 
const vector< Variable::Reference > & stateVariables () const
 
vector< Variable::Reference > & stateVariables ()
 
VariablegetStateVariable (const Identifier &name)
 
const VariablegetStateVariable (const Identifier &name) const
 
const Expression::ExprVectorassertions () const
 
const vector< Assignment::ConstReference > & initialisations () const
 
const vector< Transition::ConstReference > & transitions () const
 
Modifiers
virtual void init (const Identifier &name, const NodeDecl &declaration, Node &nodeScope, AltaricaModel &model)
 
virtual void clear ()
 
Simulation
void initialise ()
 
- Public Member Functions inherited from Diades::Altarica::Variable
 Variable ()
 
virtual ~Variable ()
 
VariablegetVariableFromPath (const string &varPath)
 
const VariablegetVariableFromPath (const string &varPath) const
 
FlatIterator varBegin ()
 
FlatIterator varEnd ()
 
virtual void init (const Identifier &name, const VariableDecl &declaration, Variable &scope)
 
const Variablescope () const
 
void assign (const Value &value)
 
const Typetype () const
 
const VariableDecldeclaration () const
 
const Identifiername () const
 
const string & fullname () const
 
bool isNull () const
 
bool isFree () const
 
void makeFree ()
 
bool operator== (const Variable &variable) const
 
bool operator!= (const Variable &variable) const
 
VariablegetVariable (const Identifier &name)
 
const VariablegetVariable (const Identifier &name) const
 
VariablegetVariable (unsigned index)
 
const VariablegetVariable (unsigned index) const
 
VariableIterator variableBegin ()
 
VariableIterator variableEnd ()
 
VariableConstIterator variableBegin () const
 
VariableConstIterator variableEnd () const
 
const Valuevalue () const
 

Private Member Functions

VariableinitStateVariable (const Identifier &name) const
 
VariableinitFlowVariable (const Identifier &name) const
 

Private Attributes

vector< NodeDecl::ConstReference_nodeDeclaration
 
NodeVector _nodeScope
 
vector< Node_subNodes
 
unordered_map< Identifier, unsigned int > _subNodeDictionary
 
vector< Variable::Reference_stateVariables
 
unordered_map< Identifier, unsigned > _stateVarDictionary
 
vector< Variable::Reference_flowVariables
 
unordered_map< Identifier, unsigned > _flowVarDictionary
 
vector< reference_wrapper< AltaricaModel > > _owner
 

Exception

Exception mechanism

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

Additional Inherited Members

- Static Public Member Functions inherited from Diades::Altarica::Variable
static string typeName ()
 
- Protected Member Functions inherited from Diades::Altarica::Variable
VariableinitSubVariable (const Identifier &name) const
 
VariableinitSubVariable (unsigned index) const
 
void instanciateVariable () const
 

Detailed Description

This class implements a Node instance of the model. For example, if a node A is defined and in another node there is a sub-node b:A then the object 'b' is a Node of the Node A. A Node is a specialisation of a Variable

Definition at line 23 of file Node.hh.

Member Typedef Documentation

◆ ConstReference

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

ConstReference copiable reference of an Node Here we use a reference_wrapper to access any Node available in a model The basic idea is that any Node of a given AltaricaModel is created into the NodeFactory 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 NodeRef for that purpose.

Definition at line 46 of file Node.hh.

◆ Exception

Definition at line 31 of file Node.hh.

◆ NodeVector

NodeVector vector of node references.

Definition at line 64 of file Node.hh.

◆ Reference

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

Reference copiable reference of an Node Here we use a reference_wrapper to access any Node available in a model The basic idea is that any Node of a given AltaricaModel is created into the NodeFactory 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 NodeRef for that purpose.

Definition at line 58 of file Node.hh.

◆ SubNodeConstIterator

typedef NodeVector::const_iterator Diades::Altarica::Node::SubNodeConstIterator

SubNodeConstIterator constant iterator on sub-nodes

Definition at line 79 of file Node.hh.

◆ SubNodeIterator

typedef NodeVector::iterator Diades::Altarica::Node::SubNodeIterator

SubNodeIterator iterator on sub-nodes

Definition at line 73 of file Node.hh.

Constructor & Destructor Documentation

◆ Node()

Diades::Altarica::Node::Node ( )
inline

Default contructor

Returns
a null Node

Definition at line 175 of file Node.hh.

◆ ~Node()

Diades::Altarica::Node::~Node ( )
inline

Destructor.

Definition at line 193 of file Node.hh.

Member Function Documentation

◆ assertions()

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

Definition at line 357 of file Node.hh.

References Diades::Altarica::NodeDecl::assertions(), and nodeDeclaration().

◆ clear()

virtual void Diades::Altarica::Node::clear ( )
virtual

Clear the Node

Reimplemented from Diades::Altarica::Variable.

Referenced by transitions().

◆ flowVariables() [1/2]

const vector<Variable::Reference>& Diades::Altarica::Node::flowVariables ( ) const
Returns
the flow variables

Referenced by nodeDeclaration(), and printNodes().

◆ flowVariables() [2/2]

vector<Variable::Reference>& Diades::Altarica::Node::flowVariables ( )
Returns
the flow variables

◆ getFlowVariable() [1/2]

Variable& Diades::Altarica::Node::getFlowVariable ( const Identifier name)
Parameters
namethe name of a Flow variable
Returns
the flow variable

Referenced by nodeDeclaration().

◆ getFlowVariable() [2/2]

const Variable& Diades::Altarica::Node::getFlowVariable ( const Identifier name) const
Parameters
namethe name of a Flow variable
Returns
the flow variable

◆ getStateVariable() [1/2]

Variable& Diades::Altarica::Node::getStateVariable ( const Identifier name)
Parameters
namethe name of a State variable
Returns
the state variable

Referenced by nodeDeclaration().

◆ getStateVariable() [2/2]

const Variable& Diades::Altarica::Node::getStateVariable ( const Identifier name) const
Parameters
namethe name of a Flow variable
Returns
the state variable

◆ getSubNode()

const Node& Diades::Altarica::Node::getSubNode ( const Identifier name) const
Returns
the subnodes

Referenced by nodeDeclaration().

◆ init()

virtual void Diades::Altarica::Node::init ( const Identifier name,
const NodeDecl declaration,
Node nodeScope,
AltaricaModel model 
)
virtual

Set the associated declaration (NodeDecl)

Parameters
declarationthe associated declaration (NodeDecl)

Referenced by analyseComponent(), Diades::Altarica::Instance::mainNode(), and transitions().

◆ initFlowVariable()

Variable& Diades::Altarica::Node::initFlowVariable ( const Identifier name) const
private
Parameters
namename of the Variable to initialise
Returns
the initialise flow variable

◆ initialisations()

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

Definition at line 368 of file Node.hh.

References Diades::Altarica::NodeDecl::initialisations(), and nodeDeclaration().

◆ initialise()

void Diades::Altarica::Node::initialise ( )

Intialisation of the internal state of the node

Referenced by transitions().

◆ initStateVariable()

Variable& Diades::Altarica::Node::initStateVariable ( const Identifier name) const
private
Parameters
namename of the Variable to initialise
Returns
the initialise state variable

◆ nodeDeclaration()

const NodeDecl& Diades::Altarica::Node::nodeDeclaration ( ) const
inline
Returns
the node declaration associated to the Node
Precondition
!isNull()

Definition at line 245 of file Node.hh.

References flowVariables(), getFlowVariable(), getStateVariable(), getSubNode(), Diades::Altarica::Variable::isNull(), Diades::Altarica::Variable::name(), require, stateVariables(), and subnodes().

Referenced by assertions(), initialisations(), and transitions().

◆ nodeScope()

const Node& Diades::Altarica::Node::nodeScope ( ) const
inline
Returns
the node scope associated to the Node
Precondition
!isNull()

Definition at line 231 of file Node.hh.

References Diades::Altarica::Variable::isNull(), and require.

Referenced by transitions().

◆ owner() [1/2]

const AltaricaModel& Diades::Altarica::Node::owner ( ) const
inline

The AltaricaModel that owns the NodeDecl

Returns
the AltaricaModel that owns the NodeDecl
Todo:
test

Definition at line 206 of file Node.hh.

◆ owner() [2/2]

AltaricaModel& Diades::Altarica::Node::owner ( )
inline

The AltaricaModel that owns the NodeDecl

Returns
the AltaricaModel that owns the NodeDecl
Todo:
test

Definition at line 218 of file Node.hh.

◆ stateVariables() [1/2]

const vector<Variable::Reference>& Diades::Altarica::Node::stateVariables ( ) const
Returns
the state variables

Referenced by nodeDeclaration(), and printNodes().

◆ stateVariables() [2/2]

vector<Variable::Reference>& Diades::Altarica::Node::stateVariables ( )
Returns
the state variables

◆ subnodes() [1/2]

const vector<Node>& Diades::Altarica::Node::subnodes ( ) const
Returns
the subnodes

Referenced by nodeDeclaration(), and printNodes().

◆ subnodes() [2/2]

vector<Node>& Diades::Altarica::Node::subnodes ( )
Returns
the subnodes

◆ transitions()

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

Definition at line 380 of file Node.hh.

References clear(), Diades::Altarica::Variable::declaration(), init(), initialise(), nodeDeclaration(), nodeScope(), and Diades::Altarica::NodeDecl::transitions().

◆ typeName()

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

Definition at line 32 of file Node.hh.

Member Data Documentation

◆ _flowVarDictionary

unordered_map<Identifier,unsigned> Diades::Altarica::Node::_flowVarDictionary
mutableprivate

_flowVarDictionary the dictionary of flow Variable

Definition at line 126 of file Node.hh.

◆ _flowVariables

vector<Variable::Reference> Diades::Altarica::Node::_flowVariables
mutableprivate

_flowVariables the set of flow Variable

Definition at line 122 of file Node.hh.

◆ _nodeDeclaration

vector<NodeDecl::ConstReference> Diades::Altarica::Node::_nodeDeclaration
private

_declaration the Node Declaration

Definition at line 89 of file Node.hh.

◆ _nodeScope

NodeVector Diades::Altarica::Node::_nodeScope
private

_nodeScope the scope of the node

Definition at line 94 of file Node.hh.

◆ _owner

vector<reference_wrapper<AltaricaModel> > Diades::Altarica::Node::_owner
mutableprivate

_assertions the set of instanciated assertions of the NodeDecl

owner the owner of the Node

Definition at line 144 of file Node.hh.

◆ _stateVarDictionary

unordered_map<Identifier,unsigned> Diades::Altarica::Node::_stateVarDictionary
mutableprivate

_stateVarDictionary the dictionary of state Variable

Definition at line 116 of file Node.hh.

◆ _stateVariables

vector<Variable::Reference> Diades::Altarica::Node::_stateVariables
mutableprivate

_stateVariables the set of state Variable

Definition at line 112 of file Node.hh.

◆ _subNodeDictionary

unordered_map<Identifier,unsigned int> Diades::Altarica::Node::_subNodeDictionary
mutableprivate

_subNodeDictionary the subnodes by their name ( mutable feature because of the lazy evaluation)

Definition at line 106 of file Node.hh.

◆ _subNodes

vector<Node> Diades::Altarica::Node::_subNodes
mutableprivate

_subNodes the subnodes mutable feature because of the lazy evaluation

Definition at line 100 of file Node.hh.


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