DiaDes  0.1
DIAgnosis of Discrete-Event System
Run.cc
Go to the documentation of this file.
1 
10 #include <cstdlib>
11 #include<iostream>
12 #include<fstream>
13 #include<regex>
14 #include<unordered_map>
15 #include<boost/program_options.hpp>
16 
23 #include"../AutomataInterface.hh"
24 
25 using namespace std;
26 using namespace Diades::Automata::Experimental;
27 using namespace Diades::Utils;
28 using namespace Diades::CmdInterface;
29 
30 namespace Poptions = boost::program_options;
31 
32 
33 
38 const string program("dd-run");
39 
40 /*
41  * File suffixes
42  */
43 FileSuffixes suffixes({"aut","ddaut"});
44 
45 
53 void initialiseOptions(int argc, char * argv[],
54  Poptions::options_description & desc,
55  Poptions::variables_map & vm)
56 {
57  desc.add_options()
58  ("help,h", "produce help message")
59  ("file,f", Poptions::value< string >(), "automaton file (.aut/.ddaut format)");
60  Poptions::positional_options_description p;
61  p.add("file", 1);
62  Poptions::store(Poptions::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
63  Poptions::notify(vm);
64 }
65 
66 
74 using Path = std::vector<std::pair<State,Transition> >;
75 using TrIndexes = std::unordered_map<size_t,Transition>;
76 using StIndexes = std::unordered_map<State::NodeId,State>;
77 using Params = std::vector<std::string>;
78 
79 enum Command
80 {
92 };
93 
94 std::unordered_map<Command, std::string> cmds =
95 {
96  { Command::back, "back"},
97  { Command::commands, "commands"},
98  { Command::current, "current"},
99  { Command::help, "help"},
100  { Command::initial, "initial"},
101  { Command::next, "next" },
102  { Command::path, "path" },
103  { Command::start, "start" },
104  { Command::quit, "quit" },
105  { Command::undo, "undo"},
106  { Command::unknown, "unknown"}
107 };
108 
109 std::map<std::string,Command> textTocmds =
110 {
111  { "back",Command::back},
112  { "commands",Command::commands},
113  { "current",Command::current},
114  { "help", Command::help },
115  { "initial", Command::initial },
116  { "next", Command::next },
117  { "path", Command::path },
118  { "start", Command::start },
119  { "quit", Command::quit},
120  { "undo", Command::undo },
121  { "unknown", Command::unknown }
122 };
123 
124 std::unordered_map<Command, std::string> cmdHelp =
125 {
126  { Command::back,
127  R"(back command:
128 'back input-transition-id': fire the input transition with the
129  id '[input-transition-id]' from the
130  current state (check the command 'current')
131  So here we move backward but we keep the path
132  updated (it is not undo, check the command 'undo'))"},
134  R"(commands command:
135 'command' : display the list of available commands in dd-run.
136 )"},
138  R"(current command:
139 'current' : display the current state of the fsm.
140  If such a current state does not exist
141  use 'start'.
142 )"},
143  { Command::help,
144  R"(help command:
145 'help' : print this message
146 'help cmd' : print help message for the command 'cmd'
147 
148 To list the possible set of commands, use 'commands'.)"
149  },
150 
152  R"(initial command:
153 'initial' : display the set of initial states of the fsm.)"
154  },
155  { Command::next,
156  R"(next command:
157 'next output-transition-id': fire the output transition with the
158  id '[output-transition-id]' from the
159  current state (check the command 'current'))"
160  },
161  { Command::path,
162  R"(path command:
163 'path': display the current path)"
164  },
165  { Command::start,
166  R"(start command:
167 'start state-id' : set the current state of the fsm to be the one
168  with the corresponding state-id. Erase the current
169  explored path.)"},
170  { Command::quit,
171  R"(quit command:
172 'quit' : quit dd-run.)"
173  },
174  { Command::undo,
175  R"(undo command:
176 'undo' : undo the last transition fire (back/next)
177  The current path is updated.)"
178  },
180  R"(unknown command: check the command list with 'commands')"
181  }
182 };
183 
184 
186 {
187  std::cout << cmdHelp[cmd] << "\n";
188 }
189 
190 
191 Command convertCommand(const std::string & cmd)
192 {
193  auto it = textTocmds.find(cmd);
194  if(it == textTocmds.end())
195  {
196  return Command::unknown;
197  }
198  return it->second;
199 }
200 
201 
202 
203 
204 
210 size_t runAut(const std::string & fileName)
211 {
212  AutFsm fsm;
213  ifstream file(fileName.c_str());
214  if(file.is_open())
215  {
216  auto loaded = fromAutFile(file, fsm);
217  file.close();
218  if(!loaded)
219  {
220  return printCommandLineError(Msg("Error when loading the automaton file %1%")%fileName);
221  }
222  }
223  else
224  {
225  return printCommandLineError(Msg("Error when opening the automaton file %1%")%fileName);
226  }
227  // interactiveAut(fsm);
228  return SUCCESS;
229 }
230 
231 
232 void prompt(std::string & cmd)
233 {
234  std::cout << "dd-run: ";
235  cmd.clear();
236  std::getline(std::cin, cmd);
237 }
238 
239 
240 void command(Command & cmd,
241  Params & params)
242 {
243  std::string cmdText;
244  prompt(cmdText);
245  cmd = Command::unknown;
246  std::stringstream stream;
247  stream << cmdText;
248  std::string mycmd;
249  stream >> mycmd;
250  cmd = convertCommand(mycmd);
251  params.clear();
252  while(!stream.eof())
253  {
254  std::string param;
255  stream >> param;
256  if(!param.empty())
257  {
258  params.push_back(param);
259  }
260  }
261 }
262 
263 
264 
265 
267 
268 void initialiseStates(const DdAutFsm & fsm)
269 {
270  if (states.empty())
271  {
272  std::for_each(fsm.stateBegin(),fsm.stateEnd(),
273  [&](DdAutFsm::State s)
274  {
275  states[s.id()] = s;
276  });
277  }
278 }
279 
280 
281 
282 
283 
284 
285 void printState(const DdAutFsm & fsm, const State & state,const DdAutStateManager & sManager)
286 {
287  std::cout << "[" << state.id() << "] " << sManager.getStateProperty(fsm.getStatePropertyId(state)) << '\n';
288 }
289 
290 
291 void printTransition(const DdAutFsm & fsm, const Transition & transition, const DdAutEventManager & eManager, size_t index)
292 {
293  std::cout << " [" << index << "]:" << states[transition.source().id()] << "-->" << states[transition.target().id()] << " "
294  << eManager.getEvent(fsm.getEvent(transition))
295  << '\n';
296 }
297 
298 
300  const State & state,
301  const DdAutEventManager & eManager,
302  TrIndexes & transitions)
303 {
304  transitions.clear();
305  std::for_each(fsm.outputTransitionBegin(state),
306  fsm.outputTransitionEnd(state),
307  [&](const Transition & transition)
308  {
309  printTransition(fsm,transition,eManager,transitions.size());
310  transitions[transitions.size()]=transition;
311  });
312 }
313 
314 
316  const State & state,
317  const DdAutEventManager & eManager,
318  TrIndexes & transitions)
319 {
320  transitions.clear();
321  std::for_each(fsm.inputTransitionBegin(state),
322  fsm.inputTransitionEnd(state),
323  [&](const DdAutFsm::Transition & transition)
324  {
325  printTransition(fsm,transition,eManager,transitions.size());
326  transitions[transitions.size()]=transition;
327  });
328 }
329 
330 
331 void printCurrentState(const DdAutFsm & fsm, const State & state,
332  const DdAutStateManager & sManager,
333  const DdAutEventManager & eManager,
334  TrIndexes & outputs,
335  TrIndexes & inputs)
336 {
337  printState(fsm, state, sManager);
338  std::cout << "outputs:\n";
339  printOutputTransitions(fsm, state, eManager, outputs);
340  std::cout << "inputs:\n";
341  printInputTransitions(fsm, state, eManager, inputs);
342 }
343 
344 
345 void printInitialStates(const DdAutFsm & fsm, const DdAutStateManager & sManager, const Params & params)
346 {
347  if(params.size() != 0)
348  {
349  std::cout << "error: I read initial with some parameters\n";
351  }
352  else
353  {
354  std::for_each(fsm.initialStateBegin(),fsm.initialStateEnd(),
355  [&](State s)
356  {
357  printState(fsm,s,sManager);
358  });
359  }
360 }
361 
362 State::NodeId getStateId(const std::string & param, bool & ok)
363 {
364  std::regex regStateId("[[:digit:]]+");
365  State::NodeId result = 0;
366  if(std::regex_match(param,regStateId))
367  {
368  std::stringstream stream;
369  stream << param ;
370  stream >> result;
371  ok = true;
372  }
373  else
374  {
375  ok = false;
376  }
377  return result;
378 }
379 
380 size_t getId(const std::string & param, bool & ok)
381 {
382  std::regex regStateId("[[:digit:]]+");
383  size_t result = 0;
384  if(std::regex_match(param,regStateId))
385  {
386  std::stringstream stream;
387  stream << param ;
388  stream >> result;
389  ok = true;
390  }
391  else
392  {
393  ok = false;
394  }
395  return result;
396 }
397 
398 
399 void initialiseFsm(const DdAutFsm & fsm, DdAutFsm::State & newInitialState,
400  const DdAutStateManager & sManager,
401  const DdAutEventManager & eManager,
402  TrIndexes & outputs,
403  TrIndexes & inputs,
404  const Params & params)
405 {
406  if(params.size() != 1)
407  {
408  std::cout << "error: here I read start with " << params.size() << " parameters (should be 1)'\n";
410  }
411  else
412  {
413  initialiseStates(fsm);
414  bool ok = true;
415  auto stateId = getStateId(params[0],ok);
416  if(ok)
417  {
418  auto it = states.find(stateId);
419  if(it==states.end())
420  {
421  std::cout << "error: the state of id=" << stateId << " does not exists.\n";
422  }
423  else
424  {
425  newInitialState = it->second;
426  printCurrentState(fsm,newInitialState,sManager,eManager,outputs, inputs);
427  }
428  }
429  else
430  {
431  std::cout << "error: here I read 'start " << params[0] << "'\n";
433  }
434  }
435 }
436 
437 void commandNext(const DdAutFsm & fsm,
438  Path & currentPath,
439  const DdAutStateManager & sManager,
440  const DdAutEventManager & eManager,
441  TrIndexes & outputs,
442  TrIndexes & inputs,
443  const Params & params)
444 {
445  if(params.size() != 1)
446  {
447  std::cout << "error: here I read next with " << params.size() << " parameters (should be 1)'\n";
449  }
450  else
451  {
452  bool ok = true;
453  auto transId = getId(params[0],ok);
454 
455 
456  if(ok)
457  {
458  auto it = outputs.find(transId);
459  if(it==outputs.end())
460  {
461  std::cout << "error: the transition of id=" << transId << " does not exists.\n";
462  }
463  else
464  {
465  currentPath.push_back(std::make_pair(it->second.target(),it->second));
466  printCurrentState(fsm,currentPath.back().first,sManager,eManager,outputs, inputs);
467  }
468  }
469  else
470  {
471  std::cout << "error: here I read 'next " << params[0] << "'\n";
473  }
474  }
475 }
476 
477 
478 
479 void commandBack(const DdAutFsm & fsm,
480  Path & currentPath,
481  const DdAutStateManager & sManager,
482  const DdAutEventManager & eManager,
483  TrIndexes & outputs,
484  TrIndexes & inputs,
485  const Params & params)
486 {
487  if(params.size() != 1)
488  {
489  std::cout << "error: here I read back with " << params.size() << " parameters (should be 1)'\n";
491  }
492  else
493  {
494  bool ok = true;
495  auto transId = getId(params[0],ok);
496 
497 
498  if(ok)
499  {
500  auto it = inputs.find(transId);
501  if(it==inputs.end())
502  {
503  std::cout << "error: the input transition of id=" << transId << " does not exists.\n";
504  }
505  else
506  {
507  currentPath.push_back(std::make_pair(it->second.source(),it->second));
508  printCurrentState(fsm,currentPath.back().first,sManager,eManager,outputs, inputs);
509  }
510  }
511  else
512  {
513  std::cout << "error: here I read 'back " << params[0] << "'\n";
515  }
516  }
517 }
518 
519 
520 
521 void printHelp(const Params & params)
522 {
523  if(params.empty() || (params.size() > 1))
524  {
526  }
527  else
528  {
529  printHelpCommand(convertCommand(params[0]));
530  }
531 }
532 
534 {
535  std::cout << "List of available commands: ";
536  if(!textTocmds.empty())
537  {
538  auto it = textTocmds.begin();
539  while(it!=textTocmds.end())
540  {
541  if(it->second != Command::unknown)
542  {
543  std::cout << it->first << " ";
544  }
545  ++it;
546  }
547  }
548  std::cout << '\n';
549 }
550 
551 
552 void commandInitial(const DdAutFsm & fsm,
553  const DdAutStateManager & sManager,
554  const Params & params)
555 {
556  printInitialStates(fsm,sManager,params);
557 }
558 
559 
560 void commandStart(const DdAutFsm & fsm,
561  Path & currentPath,
562  const DdAutStateManager & sManager,
563  const DdAutEventManager & eManager,
564  TrIndexes & outputs,
565  TrIndexes & inputs,
566  const Params & params)
567 {
568  currentPath.clear();
569  currentPath.push_back(std::make_pair(State(),Transition()));
570  initialiseFsm(fsm,currentPath.back().first,sManager,
571  eManager,outputs,inputs,params);
572 }
573 
574 
575 void commandCurrent(const DdAutFsm & fsm,
576  Path & currentPath,
577  const DdAutStateManager & sManager,
578  const DdAutEventManager & eManager,
579  TrIndexes & outputs,
580  TrIndexes & inputs)
581 {
582  if(currentPath.empty())
583  {
584  std::cout << "No current state\n";
585  }
586  else
587  {
588  printCurrentState(fsm, currentPath.back().first,
589  sManager,eManager,outputs,inputs);
590  }
591 }
592 
593 
594 void commandHelp(const Params & params)
595 {
596  printHelp(params);
597 }
598 
599 
600 void commandUndo(const DdAutFsm & fsm,
601  Path & currentPath,
602  const DdAutStateManager & sManager,
603  const DdAutEventManager & eManager,
604  TrIndexes & outputs,
605  TrIndexes & inputs,
606  const Params & params)
607 {
608  if(!params.empty())
609  {
610  std::cout << "error: I read the command 'undo' with some parameters.\n";
612  }
613  else
614  {
615  if(!currentPath.empty())
616  {
617  currentPath.pop_back();
618  if(currentPath.empty())
619  {
620  std::cout << "Empty path, no initial state.\n";
621  outputs.clear();
622  inputs.clear();
623  }
624  else
625  {
626  printCurrentState(fsm,currentPath.back().first,sManager,eManager,outputs, inputs);
627  }
628  }
629  }
630 }
631 
632 void commandPath(const DdAutFsm & fsm,
633  const Path & currentPath,
634  const DdAutStateManager & sManager,
635  const DdAutEventManager & eManager,
636  const Params & params)
637 {
638  if(!params.empty())
639  {
640  std::cout << "error: I read 'path' with parameters.\n";
642  }
643  else
644  {
645  if(currentPath.empty())
646  {
647  std::cout << "empty path.\n";
648  }
649  else
650  {
651  printState(fsm, currentPath.front().first,sManager);
652  auto it = currentPath.begin();
653  ++it;
654  while (it!=currentPath.end())
655  {
656  auto itPrev = it;
657  --itPrev;
658  if (it->second.source()==itPrev->first) {
659  std::cout << "\t|\n";
660  std::cout << eManager.getEvent(fsm.getEvent(it->second)) << "\n";
661  std::cout << "\t|\n";
662  std::cout << "\tv\n";
663  printState(fsm, it->first,sManager);
664  }
665  else
666  {
667  std::cout << "\t^\n";
668  std::cout << "\t|\n";
669  std::cout << eManager.getEvent(fsm.getEvent(it->second)) << "\n";
670  std::cout << "\t|\n";
671  printState(fsm, it->first,sManager);
672  }
673  ++it;
674  }
675  }
676  }
677 }
678 
679 
681 {
682  std::cout << "Unknown command: use 'commands' to print the list of commands.\n";
683 }
684 
685 size_t interactiveDdAut(const DdAutFsm & fsm,
686  const DdAutStateManager & sManager,
687  const DdAutEventManager & eManager)
688 {
690  Params params;
691  Path currentPath;
692  TrIndexes outputs;
693  TrIndexes inputs;
694  do
695  {
696  command(cmd, params);
697  switch(cmd)
698  {
699  case Command::back:
700  {
701  commandBack(fsm, currentPath,
702  sManager, eManager,
703  outputs, inputs,
704  params);
705  break;
706  }
707  case Command::current:
708  {
709  commandCurrent(fsm, currentPath,
710  sManager,eManager,
711  outputs,inputs);
712  break;
713  }
714  case Command::help:
715  {
716  commandHelp(params);
717  break;
718  }
719  case Command::commands:
720  {
721  commandCommands();
722  break;
723  }
724  case Command::initial:
725  {
726  commandInitial(fsm,sManager,params);
727  break;
728  }
729  case Command::next:
730  {
731  commandNext(fsm,currentPath,
732  sManager, eManager,
733  outputs, inputs,
734  params);
735  break;
736  }
737  case Command::path:
738  {
739  commandPath(fsm, currentPath,
740  sManager, eManager,
741  params);
742  break;
743  }
744  case Command::start:
745  {
746  commandStart(fsm, currentPath,
747  sManager, eManager,
748  outputs, inputs,
749  params);
750  break;
751  }
752  case Command::quit:
753  {
754  break;
755  }
756  case Command::undo:
757  {
758  commandUndo(fsm,currentPath,sManager,eManager,outputs,inputs,params);
759  break;
760  }
761  case Command::unknown:
762  {
763  commandUnknown();
764  break;
765  }
766  }
767  }
768  while(cmd!=Command::quit);
769 
770  return SUCCESS;
771 }
772 
773 
774 
775 
781 size_t runDdaut(const std::string & fileName)
782 {
783  DdAutFileDescriptor descriptor;
784  DdAutEventManager eManager;
785  DdAutStateManager sManager;
786 
787  ifstream file(fileName.c_str());
788  if(file.is_open())
789  {
790  auto loaded = descriptor.readStream(file);
791  file.close();
792  if(!loaded)
793  {
794  return printCommandLineError(Msg("Error when loading the 'ddaut' automaton file %1%")%fileName);
795  }
796  }
797  else
798  {
799  return printCommandLineError(Msg("Error when opening the 'ddaut' automaton file %1%")%fileName);
800  }
801  DdAutFsm fsm;
802  bool result = fsmFromDescriptor(descriptor,fsm, sManager, eManager);
803  if(!result)
804  {
805  return printCommandLineError(Msg("Error when converting the DdAutFileDescriptor from %1% to a Finite State Machine")%fileName);
806  }
807  std::cout << "Diades automaton explorer, LAAS-CNRS, Univ. Toulouse, France\n";
808  std::cout << "\nIf you don't know how to use it, type 'help' unless you just\n want to quit then type 'quit'.\n";
809  return interactiveDdAut(fsm,sManager,eManager);
810 }
811 
812 
819 size_t runFsm(const std::string & fileName)
820 {
821 
822  if (suffixes.match(fileName, "aut")) {
823  return runAut(fileName);
824  }
825  else
826  {
827  if(suffixes.match(fileName, "ddaut"))
828  {
829  return runDdaut(fileName);
830  }
831  else
832  {
833  return printCommandLineError(Msg("Expecting a file with a name ending with .aut, but I read %1%") % fileName);
834  }
835  }
837 }
838 
839 
840 
841 
842 
849 int main(int argc, char** argv)
850 {
851  std::string fileName, output;
852  try
853  {
854  Poptions::options_description desc("Options");
855  Poptions::variables_map vm;
856  initialiseOptions(argc, argv, desc, vm);
857  if(vm.count("help"))
858  {
859  return printUsage(program,desc);
860  }
861  if(vm.count("file"))
862  {
863  fileName = vm["file"].as<std::string>();
864  }
865  }
866  catch(Poptions::required_option & e)
867  {
868  return printCommandLineError(e.what());
869  }
870  catch(Poptions::error & e)
871  {
872  return printCommandLineError(e.what());
873  }
874  return runFsm(fileName);
875 }
876 
std::unordered_map< Command, std::string > cmdHelp
Definition: Run.cc:124
const size_t SUCCESS
Definition: CmdInterface.hh:34
void printState(const DdAutFsm &fsm, const State &state, const DdAutStateManager &sManager)
Definition: Run.cc:285
void initialiseStates(const DdAutFsm &fsm)
Definition: Run.cc:268
size_t runFsm(const std::string &fileName)
Definition: Run.cc:819
void printCurrentState(const DdAutFsm &fsm, const State &state, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs)
Definition: Run.cc:331
void commandStart(const DdAutFsm &fsm, Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs, const Params &params)
Definition: Run.cc:560
void commandUndo(const DdAutFsm &fsm, Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs, const Params &params)
Definition: Run.cc:600
Command
Definition: Run.cc:79
StateMachine< AutStateId, AutEventId > AutFsm
Definition: AutFile.hh:45
size_t getId(const std::string &param, bool &ok)
Definition: Run.cc:380
StatePropertyManager< DdAutStateLabel, DdAutStateId > DdAutStateManager
Definition: DdAutFile.hh:63
bool fsmFromDescriptor(const DdAutFileDescriptor &descriptor, DdAutFsm &fsm, DdAutStateManager &sManager, DdAutEventManager &eManager)
const size_t ERROR_UNHANDLED_EXCEPTION
Definition: CmdInterface.hh:35
size_t printCommandLineError(const string &msg)
Definition: CmdInterface.cc:98
std::map< std::string, Command > textTocmds
Definition: Run.cc:109
size_t runAut(const std::string &fileName)
Definition: Run.cc:210
void commandInitial(const DdAutFsm &fsm, const DdAutStateManager &sManager, const Params &params)
Definition: Run.cc:552
Definition: Run.cc:88
STL namespace.
void printTransition(const DdAutFsm &fsm, const Transition &transition, const DdAutEventManager &eManager, size_t index)
Definition: Run.cc:291
Definition: Run.cc:91
void printInitialStates(const DdAutFsm &fsm, const DdAutStateManager &sManager, const Params &params)
Definition: Run.cc:345
vector< string > options(numberOfOptions)
size_t runDdaut(const std::string &fileName)
Definition: Run.cc:781
void printInputTransitions(const DdAutFsm &fsm, const State &state, const DdAutEventManager &eManager, TrIndexes &transitions)
Definition: Run.cc:315
OutputTransitionIterator outputTransitionBegin(State s) const
InitialStateIterator initialStateEnd() const
void commandPath(const DdAutFsm &fsm, const Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, const Params &params)
Definition: Run.cc:632
size_t interactiveDdAut(const DdAutFsm &fsm, const DdAutStateManager &sManager, const DdAutEventManager &eManager)
Definition: Run.cc:685
void commandUnknown()
Definition: Run.cc:680
InputTransitionIterator inputTransitionBegin(State s) const
StIndexes states
Definition: Run.cc:266
std::vector< std::pair< State, Transition > > Path
Definition: Run.cc:74
Definition: Run.cc:81
int main(int argc, char **argv)
Definition: Run.cc:849
Definition: Run.cc:84
Definition: Run.cc:85
Definition: Run.cc:87
bool match(const std::string &fileName, const std::string &suffix) const
Definition: CmdInterface.cc:54
void commandCommands()
Definition: Run.cc:533
AutFsm::State State
Definition: Run.cc:72
AutFsm::Transition Transition
Definition: Run.cc:73
FileSuffixes suffixes({"aut","ddaut"})
const EventPropertyId & getEvent(Transition t) const
void printOutputTransitions(const DdAutFsm &fsm, const State &state, const DdAutEventManager &eManager, TrIndexes &transitions)
Definition: Run.cc:299
void commandCurrent(const DdAutFsm &fsm, Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs)
Definition: Run.cc:575
void commandNext(const DdAutFsm &fsm, Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs, const Params &params)
Definition: Run.cc:437
const Event & getEvent(EventId id) const
Definition: Event.hh:183
void printHelpCommand(Command cmd)
Definition: Run.cc:185
void prompt(std::string &cmd)
Definition: Run.cc:232
void command(Command &cmd, Params &params)
Definition: Run.cc:240
OutputTransitionIterator outputTransitionEnd(State s) const
Definition: Run.cc:89
InputTransitionIterator inputTransitionEnd(State s) const
Definition: Run.cc:83
std::vector< std::string > Params
Definition: Run.cc:77
State::NodeId getStateId(const std::string &param, bool &ok)
Definition: Run.cc:362
Definition: Run.cc:82
InitialStateIterator initialStateBegin() const
Command convertCommand(const std::string &cmd)
Definition: Run.cc:191
EventManager< DdAutEventLabel, DdAutEventId > DdAutEventManager
Definition: DdAutFile.hh:68
void initialiseFsm(const DdAutFsm &fsm, DdAutFsm::State &newInitialState, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs, const Params &params)
Definition: Run.cc:399
Definition: Run.cc:86
bool fromAutFile(std::istream &stream, AutFsm &fsm)
const string program("dd-run")
StateMachine< DdAutStateId, DdAutEventId > DdAutFsm
Definition: DdAutFile.hh:42
Definition: Run.cc:90
void commandBack(const DdAutFsm &fsm, Path &currentPath, const DdAutStateManager &sManager, const DdAutEventManager &eManager, TrIndexes &outputs, TrIndexes &inputs, const Params &params)
Definition: Run.cc:479
SizeType NodeId
Definition: Node.hh:42
void initialiseOptions(int argc, char *argv[], Poptions::options_description &desc, Poptions::variables_map &vm)
Definition: Run.cc:53
boost::format Msg
Definition: Verbose.hh:42
std::unordered_map< State::NodeId, State > StIndexes
Definition: Run.cc:76
const StatePropertyId & getStatePropertyId(State state) const
void printHelp(const Params &params)
Definition: Run.cc:521
const StateProperty & getStateProperty(StatePropertyId id) const
std::unordered_map< size_t, Transition > TrIndexes
Definition: Run.cc:75
std::unordered_map< Command, std::string > cmds
Definition: Run.cc:94
void commandHelp(const Params &params)
Definition: Run.cc:594
virtual bool readStream(std::istream &stream)
void printUsage(const po::options_description &desc)