9 #ifndef __DIADES__AUTOMATA__EXPERIMENTAL__DDSYNCDESCRIPTOR__HH__ 10 #define __DIADES__AUTOMATA__EXPERIMENTAL__DDSYNCDESCRIPTOR__HH__ 20 namespace Experimental
154 return _synchronisation.size();
246 virtual bool readStream(std::istream& stream, std::string& error);
262 SynchronisationList::size_type
265 return _syncList.size();
274 toDot(ostream & os)
const;
284 LeftP, RightP, Name, QuoteName, Comma, Evt, Out, Error, End
287 using Size = std::string::size_type;
332 Size & currentIndex, std::string & error);
349 size_t currentQuoteIndex,
364 std::string & error);
379 size_t & currentQuoteIndex,
382 std::string & error);
393 std::string & error);
404 std::string & error);
414 std::string & error);
424 template<
typename DdAutFsmType>
434 auto it = syncEvent.beginOfSupport();
435 while(it != syncEvent.endOfSupport())
454 template<
typename DdAutFsmType>
462 std::for_each(desc.
begin(), desc.
end(),
465 std::map<typename Ptr<typename Sync::Component>::ConstP,
DdAutEventId> events;
466 std::for_each(sync.begin(), sync.end(),
467 [&](
const std::pair<std::string, DdAutEventId> & entry)
471 typename Sync::ComponentIterator compIt = rules.
findComponent(entry.first);
475 success = compIt->containsEvent(entry.second);
482 errorMsg +=
"descriptorToRules: the component " + entry.first
483 +
" has no event with the id " + std::to_string(entry.second)+ +
"Check that the rules are properly initialised with " 484 +
"\n Please check that the rules are properly initialised with\n" 485 +
"the correct set of components before reading this " 486 +
"\n synchronisation rules'descriptor.\n";
492 errorMsg +=
"descriptorToRules: the component " + entry.first
494 +
"Check that the rules are properly initialised with " 495 +
"\n the correct set of components before reading this " 496 +
"\n synchronisation rules'descriptor.\n";
515 errorMsg +=
"descriptorToRules: error so the rules are cleared.\n";
SynchronisationList::size_type numberOfSynchronisations() const
static ConstP get(const T &obj)
~Synchronisation()=default
std::vector< QuoteIndexes > QuoteIndexesVector
ConstIterator begin() const
virtual bool readStream(std::istream &stream, std::string &error)
ConstSynchronisationIterator endOfSynchronisedEvents() const
ParsingState analyseRightP(const std::string &syncLine, Size ¤tIndex, std::string &error)
void eraseComponent(const std::string &compName)
ConstIterator begin() const
bool descriptorToRules(const DdSyncDescriptor &desc, ParametrizedSynchronisation< DdAutFsmType > &rules, std::string &errorMsg)
ParsingState analyseQuoteName(const std::string &syncLine, const QuoteIndexesVector "eIndexes, size_t ¤tQuoteIndex, Size ¤tIndex, std::string &label, std::string &error)
SynchronisationList::const_iterator ConstIterator
ComponentIterator endOfComponents() const
bool analyseQuoteLabels(const std::string &syncLine, Size currentIndex, QuoteIndexesVector "eIndexes, std::string &error)
std::string::size_type Size
ParsingState analyseComma(const std::string &syncLine, Size ¤tIndex, std::string &error)
SynchronisationList _syncList
bool analyseSynchronisationLine(const std::string &syncLine, std::string &error)
ParsingState analyseOut(const std::string &syncLine, Size ¤tIndex, std::string &error)
ConstIterator end() const
Iterator insertSynchronisation(Synchronisation &&synchronisation)
ParsingState analyseLeftP(const std::string &syncLine, const QuoteIndexesVector "eIndexes, size_t currentQuoteIndex, Size ¤tIndex, std::string &error)
std::map< std::string, DdAutEventId > SynchroDictionary
DdSyncDescriptor()=default
Namespace of the Diades project.
static constexpr Size NPOS
ParsingState analyseName(const std::string &syncLine, Size ¤tIndex, std::string &label, std::string &error)
ParsingState analyseEvt(const std::string &syncLine, Size ¤tIndex, DdAutEventId &evt, std::string &error)
std::pair< Size, Size > QuoteIndexes
bool rulesToDescriptor(const SynchronisationRules< DdAutFsmType > &rules, DdSyncDescriptor &desc)
SynchroDictionary::const_iterator ConstIterator
ConstSynchronisationIterator beginOfSynchronisedEvents() const
ConstIterator on the Net.
Synchronisation()=default
std::list< Synchronisation > SynchronisationList
void synchronise(Event e)
bool containsComponent(const std::string &compName) const
size_t numberOfSynchronisations() const
Synchronisation & operator=(Synchronisation const &other)=default
virtual bool toStream(std::ostream &stream)
ostream & toDot(ostream &os) const
ComponentIterator findComponent(const string &name) const
virtual void clearRules()
DdAutEventId getEvent(const std::string &compName) const
std::pair< Iterator, bool > insertSynchronisation(const std::string &compName, DdAutEventId evt)
~DdSyncDescriptor()=default
SynchroDictionary _synchronisation
ConstIterator end() const