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

#include <DdSyncDescriptor.hh>

Classes

class  Synchronisation
 

Public Member Functions

 DdSyncDescriptor ()=default
 
 DdSyncDescriptor (DdSyncDescriptor const &other)=default
 
DdSyncDescriptoroperator= (DdSyncDescriptor const &other)=default
 
 DdSyncDescriptor (DdSyncDescriptor &&other)=default
 
DdSyncDescriptoroperator= (DdSyncDescriptor &&other)=default
 
 ~DdSyncDescriptor ()=default
 
ConstIterator begin () const
 
ConstIterator end () const
 
Iterator begin ()
 
Iterator end ()
 
void clear ()
 
Iterator insertSynchronisation (Synchronisation &&synchronisation)
 
virtual bool readStream (std::istream &stream, std::string &error)
 
virtual bool toStream (std::ostream &stream)
 
SynchronisationList::size_type numberOfSynchronisations () const
 
ostream & toDot (ostream &os) const
 

Private Types

enum  ParsingState {
  ParsingState::LeftP, ParsingState::RightP, ParsingState::Name, ParsingState::QuoteName,
  ParsingState::Comma, ParsingState::Evt, ParsingState::Out, ParsingState::Error,
  ParsingState::End
}
 
using SynchronisationList = std::list< Synchronisation >
 
using ConstIterator = SynchronisationList::const_iterator
 
using Iterator = SynchronisationList::iterator
 
using Size = std::string::size_type
 
using QuoteIndexes = std::pair< Size, Size >
 
using QuoteIndexesVector = std::vector< QuoteIndexes >
 

Private Member Functions

bool analyseSynchronisationLine (const std::string &syncLine, std::string &error)
 
bool analyseQuoteLabels (const std::string &syncLine, Size currentIndex, QuoteIndexesVector &quoteIndexes, std::string &error)
 
ParsingState analyseOut (const std::string &syncLine, Size &currentIndex, std::string &error)
 
ParsingState analyseLeftP (const std::string &syncLine, const QuoteIndexesVector &quoteIndexes, size_t currentQuoteIndex, Size &currentIndex, std::string &error)
 
ParsingState analyseName (const std::string &syncLine, Size &currentIndex, std::string &label, std::string &error)
 
ParsingState analyseQuoteName (const std::string &syncLine, const QuoteIndexesVector &quoteIndexes, size_t &currentQuoteIndex, Size &currentIndex, std::string &label, std::string &error)
 
ParsingState analyseComma (const std::string &syncLine, Size &currentIndex, std::string &error)
 
ParsingState analyseEvt (const std::string &syncLine, Size &currentIndex, DdAutEventId &evt, std::string &error)
 
ParsingState analyseRightP (const std::string &syncLine, Size &currentIndex, std::string &error)
 

Private Attributes

SynchronisationList _syncList
 

Static Private Attributes

static constexpr Size NPOS = std::string::npos
 

Detailed Description

Descriptor of ddsync file. It contains the synchronisation rules between component events

Definition at line 28 of file DdSyncDescriptor.hh.

Member Typedef Documentation

◆ ConstIterator

using Diades::Automata::Experimental::DdSyncDescriptor::ConstIterator = SynchronisationList::const_iterator
private

Definition at line 161 of file DdSyncDescriptor.hh.

◆ Iterator

using Diades::Automata::Experimental::DdSyncDescriptor::Iterator = SynchronisationList::iterator
private

Definition at line 162 of file DdSyncDescriptor.hh.

◆ QuoteIndexes

Definition at line 288 of file DdSyncDescriptor.hh.

◆ QuoteIndexesVector

Definition at line 289 of file DdSyncDescriptor.hh.

◆ Size

using Diades::Automata::Experimental::DdSyncDescriptor::Size = std::string::size_type
private

Definition at line 287 of file DdSyncDescriptor.hh.

◆ SynchronisationList

Definition at line 159 of file DdSyncDescriptor.hh.

Member Enumeration Documentation

◆ ParsingState

Enumerator
LeftP 
RightP 
Name 
QuoteName 
Comma 
Evt 
Out 
Error 
End 

Definition at line 282 of file DdSyncDescriptor.hh.

Constructor & Destructor Documentation

◆ DdSyncDescriptor() [1/3]

Diades::Automata::Experimental::DdSyncDescriptor::DdSyncDescriptor ( )
default

Default constructor

◆ DdSyncDescriptor() [2/3]

Diades::Automata::Experimental::DdSyncDescriptor::DdSyncDescriptor ( DdSyncDescriptor const &  other)
default

Copy constructor (default)

Parameters
other

◆ DdSyncDescriptor() [3/3]

Diades::Automata::Experimental::DdSyncDescriptor::DdSyncDescriptor ( DdSyncDescriptor &&  other)
default

Move constructor (default)

Parameters
other

◆ ~DdSyncDescriptor()

Diades::Automata::Experimental::DdSyncDescriptor::~DdSyncDescriptor ( )
default

Destructor

Member Function Documentation

◆ analyseComma()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseComma ( const std::string &  syncLine,
Size currentIndex,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from and the update if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseEvt()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseEvt ( const std::string &  syncLine,
Size currentIndex,
DdAutEventId evt,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from and the update if no error
evtthe result event if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseLeftP()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseLeftP ( const std::string &  syncLine,
const QuoteIndexesVector quoteIndexes,
size_t  currentQuoteIndex,
Size currentIndex,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
quoteIndexesthe preinitialised set of pairs (left quote index, right quote index)
currentQuoteIndexthe current pair in quoteIndexes updated if no parsing error
currentIndexthe index to start the analysis from and the update if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseName()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseName ( const std::string &  syncLine,
Size currentIndex,
std::string &  label,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from and the update if no error
labelthe resulting component name if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseOut()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseOut ( const std::string &  syncLine,
Size currentIndex,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from and the update if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseQuoteLabels()

bool Diades::Automata::Experimental::DdSyncDescriptor::analyseQuoteLabels ( const std::string &  syncLine,
Size  currentIndex,
QuoteIndexesVector quoteIndexes,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from
quoteIndexesthe resulting set of pairs (left quote index, right quote index)
erroran error message is appended here in case of error in the parsing
Returns
true if there is a even pair of quotes in the analysed syncLine

◆ analyseQuoteName()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseQuoteName ( const std::string &  syncLine,
const QuoteIndexesVector quoteIndexes,
size_t &  currentQuoteIndex,
Size currentIndex,
std::string &  label,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
quoteIndexesthe preinitialised set of pairs (left quote index, right quote index)
currentQuoteIndexthe current pair in quoteIndexes updated if no parsing error
currentIndexthe index to start the analysis from and the update if no error
labelthe resulting component name if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseRightP()

ParsingState Diades::Automata::Experimental::DdSyncDescriptor::analyseRightP ( const std::string &  syncLine,
Size currentIndex,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
currentIndexthe index to start the analysis from and the update if no error
erroran error message is appended here in case of error in the parsing
Returns
the new parsing state, if error the parsing has failed.

◆ analyseSynchronisationLine()

bool Diades::Automata::Experimental::DdSyncDescriptor::analyseSynchronisationLine ( const std::string &  syncLine,
std::string &  error 
)
private
Parameters
syncLinethe line to analyse
erroran error message is appended here in case of error in the parsing
Returns
true if the analysis is correct. The syncLine should contains something like this: (compName1,eventId1) (compName2,eventId2) ... (compNameN,eventIdN) with N >=2 , compNameI being either an identifier or a double quote string, and eventIdI should be a positive integer representing an event from the component of the given name. If the analysis is correct then the DdSyncDescriptor records this synchronisation rule.

◆ begin() [1/2]

ConstIterator Diades::Automata::Experimental::DdSyncDescriptor::begin ( ) const
Returns
an iterator on the first Synchronisation

Referenced by Diades::Automata::Experimental::descriptorToRules().

◆ begin() [2/2]

Iterator Diades::Automata::Experimental::DdSyncDescriptor::begin ( )
Returns
an iterator on the first Synchronisation

◆ clear()

void Diades::Automata::Experimental::DdSyncDescriptor::clear ( )

Clear the synchronisation list

◆ end() [1/2]

ConstIterator Diades::Automata::Experimental::DdSyncDescriptor::end ( ) const
Returns
an end iterator for the range of Synchronisation

Referenced by Diades::Automata::Experimental::descriptorToRules().

◆ end() [2/2]

Iterator Diades::Automata::Experimental::DdSyncDescriptor::end ( )
Returns
an end iterator for the range of Synchronisation

◆ insertSynchronisation()

Iterator Diades::Automata::Experimental::DdSyncDescriptor::insertSynchronisation ( Synchronisation &&  synchronisation)
Parameters
synchronisation
Returns
the iterator that points to newly inserted synchronisation

Referenced by Diades::Automata::Experimental::rulesToDescriptor().

◆ numberOfSynchronisations()

SynchronisationList::size_type Diades::Automata::Experimental::DdSyncDescriptor::numberOfSynchronisations ( ) const
inline
Returns
the number of synchronisations

Definition at line 263 of file DdSyncDescriptor.hh.

References toDot().

◆ operator=() [1/2]

DdSyncDescriptor& Diades::Automata::Experimental::DdSyncDescriptor::operator= ( DdSyncDescriptor const &  other)
default

Assignement (default)

Parameters
other
Returns
the current Transition

◆ operator=() [2/2]

DdSyncDescriptor& Diades::Automata::Experimental::DdSyncDescriptor::operator= ( DdSyncDescriptor &&  other)
default

Move assignement (default)

Parameters
other
Returns
the current Transition

◆ readStream()

virtual bool Diades::Automata::Experimental::DdSyncDescriptor::readStream ( std::istream &  stream,
std::string &  error 
)
virtual
Parameters
streaminput stream
erroran error message is appended here in case of error in the parsing Reads the stream to fill the DdSyncFileDescriptor If the DdSyncDescriptor was already filled, it is cleared first
Returns
true if the file parsing is a success. If not a success, the DdAutFileDescriptor is cleared.

Referenced by exportDdSyncToDot(), and synchroniseDdAut().

◆ toDot()

ostream& Diades::Automata::Experimental::DdSyncDescriptor::toDot ( ostream &  os) const

Dump the information of the descriptor as a dot graph

Parameters
osthe output stream
Returns
the updated output stream

Referenced by numberOfSynchronisations(), and Diades::Automata::Experimental::toDot().

◆ toStream()

virtual bool Diades::Automata::Experimental::DdSyncDescriptor::toStream ( std::ostream &  stream)
virtual
Parameters
streamoutput stream Write the content of the DdSyncFileDescriptor in the output stream
Returns
true if the writing is a success (valid DdSyncFileDescriptor).

Member Data Documentation

◆ _syncList

SynchronisationList Diades::Automata::Experimental::DdSyncDescriptor::_syncList
private

Definition at line 160 of file DdSyncDescriptor.hh.

◆ NPOS

constexpr Size Diades::Automata::Experimental::DdSyncDescriptor::NPOS = std::string::npos
staticprivate

Definition at line 290 of file DdSyncDescriptor.hh.


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