DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
Diades::Automata::SynchronisationRules Class Reference

#include <SynchronisationRules.hh>

Public Types

typedef Diades::Utils::Exception< SynchronisationRulesException
 
typedef vector< const Component * > ComponentVector
 
typedef ComponentVector::size_type size_type
 
typedef list< SynchronisationEvent >::const_iterator SynchronisationIterator
 
typedef _ComponentIterator ComponentIterator
 

Public Member Functions

 SynchronisationRules (const ComponentVector &components)
 
 SynchronisationRules ()
 
void setComponentVector (const ComponentVector &components)
 
SynchronisationIterator beginOfSynchronisedEvents () const
 
SynchronisationIterator endOfSynchronisedEvents () const
 
size_type numberOfComponents () const
 
size_type size () const
 
ComponentIterator beginOfComponents () const
 
ComponentIterator endOfComponents () const
 
const ComponentgetComponent (size_type index) const
 
ComponentIterator findComponent (const string &name) const
 
ComponentIterator findComponent (const Component &component) const
 
bool operator== (const SynchronisationRules &rules) const
 
void getSynchronisationEvents (const Component &component, Event event, list< SynchronisationEvent::ConstPointer > &events) const
 
bool valid () const
 

Static Public Member Functions

static string typeName ()
 

Protected Attributes

ComponentVector _components
 
list< SynchronisationEvent_synchros
 

Friends

ostream & operator<< (ostream &os, const SynchronisationRules &rules)
 

Detailed Description

This class defines a synchronisation law between components. It is implemented as a list of SynchronisationEvent objects. Off course, the SynchronisationEvent objects must be consistent with each other (same components that are involved). When a composition is performed based on such SynchronisationRules, it means that only synchronised events from this list are triggered. It means, for instance, if an event from a component involved in the SynchronisationEvent objects is not present in at least one of the SynchronisationEvent, then the event cannot occur in the synchronisation, the component cannot trigger it.

The class SynchronisationRules is the most generic one and should never be used. Use the derived classes instead or define new ones.

Definition at line 333 of file SynchronisationRules.hh.

Member Typedef Documentation

◆ ComponentIterator

Definition at line 349 of file SynchronisationRules.hh.

◆ ComponentVector

Definition at line 340 of file SynchronisationRules.hh.

◆ Exception

Definition at line 339 of file SynchronisationRules.hh.

◆ size_type

typedef ComponentVector::size_type Diades::Automata::SynchronisationRules::size_type

Definition at line 347 of file SynchronisationRules.hh.

◆ SynchronisationIterator

Definition at line 348 of file SynchronisationRules.hh.

Constructor & Destructor Documentation

◆ SynchronisationRules() [1/2]

Diades::Automata::SynchronisationRules::SynchronisationRules ( const ComponentVector components)

Parametrized constructor

Parameters
components
Precondition
components must not be empty
components must be all valid and no component must be present twice in components Create the SynchronisationRules based on the components 'components'

◆ SynchronisationRules() [2/2]

Diades::Automata::SynchronisationRules::SynchronisationRules ( )
inline

Default constructor

Definition at line 362 of file SynchronisationRules.hh.

Member Function Documentation

◆ beginOfComponents()

ComponentIterator Diades::Automata::SynchronisationRules::beginOfComponents ( ) const
inline
Returns
start iterator on the Component

Definition at line 402 of file SynchronisationRules.hh.

◆ beginOfSynchronisedEvents()

SynchronisationIterator Diades::Automata::SynchronisationRules::beginOfSynchronisedEvents ( ) const
inline
Returns
start iterator on the SynchronisationEvent objects

Definition at line 374 of file SynchronisationRules.hh.

Referenced by exportLogIntoPtaLogFile(), and main().

◆ endOfComponents()

ComponentIterator Diades::Automata::SynchronisationRules::endOfComponents ( ) const
inline
Returns
end iterator on the Component

Definition at line 409 of file SynchronisationRules.hh.

◆ endOfSynchronisedEvents()

SynchronisationIterator Diades::Automata::SynchronisationRules::endOfSynchronisedEvents ( ) const
inline
Returns
end iterator on the SynchronisationEvent objects

Definition at line 381 of file SynchronisationRules.hh.

Referenced by exportLogIntoPtaLogFile(), and main().

◆ findComponent() [1/2]

ComponentIterator Diades::Automata::SynchronisationRules::findComponent ( const string &  name) const
Parameters
component
Precondition
component should be valid
Returns
an iterator on the Component, endOfComponents() otherwise

◆ findComponent() [2/2]

ComponentIterator Diades::Automata::SynchronisationRules::findComponent ( const Component component) const
Parameters
component
Precondition
component should be valid
Returns
an iterator on the Component, endOfComponents() otherwise

◆ getComponent()

const Component& Diades::Automata::SynchronisationRules::getComponent ( size_type  index) const
inline
Parameters
indexan index between 0 and numberOfComponents()-1
Returns

Definition at line 420 of file SynchronisationRules.hh.

References Diades::Automata::_ComponentIterator::index(), and require.

◆ getSynchronisationEvents()

void Diades::Automata::SynchronisationRules::getSynchronisationEvents ( const Component component,
Event  event,
list< SynchronisationEvent::ConstPointer > &  events 
) const
Parameters
componenta Component
eventan Event
eventsthe result
Precondition
component should be valid
event should be valid and belongs to component Return the list of SynchronisationEvent objects found in these rules that involve the event e of the component

◆ numberOfComponents()

size_type Diades::Automata::SynchronisationRules::numberOfComponents ( ) const
inline
Returns
the number of components involved in these rules

Definition at line 388 of file SynchronisationRules.hh.

◆ operator==()

bool Diades::Automata::SynchronisationRules::operator== ( const SynchronisationRules rules) const
inline

equality operator (value)

Definition at line 446 of file SynchronisationRules.hh.

References _components, and _synchros.

◆ setComponentVector()

void Diades::Automata::SynchronisationRules::setComponentVector ( const ComponentVector components)
Parameters
componentsa ComponentVector
Postcondition
initialises this set of rule with the set of components \

◆ size()

size_type Diades::Automata::SynchronisationRules::size ( ) const
inline
Returns
the number of rules (i.e the number SynchronisationEvent objects)

Definition at line 395 of file SynchronisationRules.hh.

◆ typeName()

static string Diades::Automata::SynchronisationRules::typeName ( )
inlinestatic

Definition at line 336 of file SynchronisationRules.hh.

◆ valid()

bool Diades::Automata::SynchronisationRules::valid ( ) const
inline
Returns
true if the rules are all valid

Definition at line 464 of file SynchronisationRules.hh.

References Diades::Automata::operator<<().

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  os,
const SynchronisationRules rules 
)
friend

Output stream operator

Parameters
osoutput stream
rulesthe SynchronisationRules
Returns
the output stream filled in the following format:
components: comp1, comp2,comp3,..., compN;
rules:
<compi.evti, compj.evtj, compk.evtk>
...
<compl.evtl, comps.evts, ...>;

Member Data Documentation

◆ _components

ComponentVector Diades::Automata::SynchronisationRules::_components
protected

Definition at line 344 of file SynchronisationRules.hh.

Referenced by operator==().

◆ _synchros

list<SynchronisationEvent> Diades::Automata::SynchronisationRules::_synchros
protected

Definition at line 345 of file SynchronisationRules.hh.

Referenced by operator==().


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