DiaDes  0.1
DIAgnosis of Discrete-Event System
Classes | Functions | Variables
Simulate.cc File Reference
#include <thread>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <regex>
#include <unordered_map>
#include <random>
#include <chrono>
#include <boost/program_options.hpp>
#include <diades/automata/experimental/AutFile.hh>
#include <diades/automata/experimental/DdAutFile.hh>
#include <diades/automata/experimental/DdAutFileDescriptor.hh>
#include <diades/automata/experimental/Io.hh>
#include "../AutomataInterface.hh"
#include "../CmdInterface.hh"

Go to the source code of this file.

Classes

struct  DdSimOptions
 

Functions

const string program ("dd-sim")
 
const string briefcomment (": dd-sim simulates a model. Given a ddaut file, dd-sim computes some runs of the model")
 
void initialiseOptions (int argc, char *argv[], Poptions::options_description &desc, Poptions::variables_map &vm)
 
size_t setOptions (int argc, char **argv, DdSimOptions &options)
 
bool isThroughState (const ConstManagedDdAutFsm &mfsm, State state, const std::regex &regularExpression, CstStMap< char > &throughStates)
 check whether the state is matching the 'through-state' expression given by –through More...
 
size_t prepareSimulation (const DdSimOptions &options)
 
int main (int argc, char **argv)
 

Variables

const string detailedcomment
 
FileSuffixes suffixes ({"ddaut"})
 

Function Documentation

◆ briefcomment()

const string briefcomment ( ": dd-sim simulates a model. Given a ddaut  file,
dd-sim computes some runs of the model"   
)

Referenced by setOptions().

◆ initialiseOptions()

void initialiseOptions ( int  argc,
char *  argv[],
Poptions::options_description &  desc,
Poptions::variables_map &  vm 
)

Initialise the options of the command present in the command line

Parameters
argc
argv
desc
vm

Definition at line 121 of file Simulate.cc.

References options().

◆ isThroughState()

bool isThroughState ( const ConstManagedDdAutFsm mfsm,
State  state,
const std::regex &  regularExpression,
CstStMap< char > &  throughStates 
)

check whether the state is matching the 'through-state' expression given by –through

throughStates is a mapping used as a cache. If the result is cached, simply return it if not, then the state label is tested to see whether it matches or not and the cache is updated consequently.

Parameters
[in]mfsmthe managed fsm
[in]statethe state to check
[in]regularExpressionthe regular expression given by the through option
[in,out]throughStatesthe cache
Returns
true if the state state matches regularExpression.

Definition at line 263 of file Simulate.cc.

References Diades::Automata::Experimental::ConstManagedDdAutFsm::fsm, Diades::Automata::Experimental::StatePropertyManager< _StateProperty, _StatePropertyId, NullStProperty, NullStPropertyId, Hash >::getStateProperty(), Diades::Automata::Experimental::StateMachine< _StatePropertyId, _EventPropertyId, _NullStatePropertyId, _NullEventPropertyId >::getStatePropertyId(), and Diades::Automata::Experimental::ConstManagedDdAutFsm::sMgr.

◆ main()

int main ( int  argc,
char **  argv 
)

Main file of the dd-dot command

Parameters
argc
argv
Returns
success code (SUCCESS or ERROR_COMMAND_LINE)

Definition at line 305 of file Simulate.cc.

References Diades::CmdInterface::checkDdAutFile(), DdSimOptions::controllable, DdSimOptions::fileName, Diades::CmdInterface::isOpenableFile(), DdSimOptions::observable, options(), prepareSimulation(), DdSimOptions::seed, setOptions(), and SUCCESS.

◆ prepareSimulation()

size_t prepareSimulation ( const DdSimOptions options)

◆ program()

const string program ( "dd-sim"  )

Referenced by setOptions().

◆ setOptions()

size_t setOptions ( int  argc,
char **  argv,
DdSimOptions options 
)

Variable Documentation

◆ detailedcomment

const string detailedcomment

Definition at line 69 of file Simulate.cc.

Referenced by setOptions().

◆ suffixes

FileSuffixes suffixes({"ddaut"})