DiaDes  0.1
DIAgnosis of Discrete-Event System
Classes | Typedefs | Functions
Diades::CmdInterface Namespace Reference

Classes

class  FileSuffixes
 

Typedefs

using Msg = Diades::Utils::Msg
 

Functions

size_t loadFiniteStateMachine (const std::string &input, const Diades::Automata::Experimental::ManagedDdAutFsm &mfsm)
 Load the fsm from a file called 'input'. More...
 
size_t loadFiniteStateAutomaton (const std::string &input, const Diades::Automata::Experimental::ManagedDdAutFA &mfa)
 Load the finite automaton from a file called 'input'. More...
 
size_t writeAut (const Diades::Automata::Experimental::AutFsm &fsm, const std::string &output, const FileSuffixes &suffixes)
 
size_t writeFiniteStateMachine (const Diades::Automata::Experimental::ConstManagedDdAutFsm &mfsm, const std::string &output, const FileSuffixes &suffixes)
 
size_t writeFiniteAutomaton (const Diades::Automata::Experimental::ConstManagedDdAutFA &mfa, const std::string &output, const FileSuffixes &suffixes)
 
size_t checkFileNameSuffix (const std::string &filename, const std::string &suffix)
 check that filename has the expected suffix More...
 
size_t checkDdAutFileName (const std::string &filename)
 check that filename is a proper file with the ddaut suffix More...
 
size_t isOpenableFile (const std::string &filename)
 check that the file can be opened More...
 
size_t checkDdAutFile (const std::string &filename)
 check that filename is a proper file with the ddaut suffix check that the file 'filename' can be opened and is readable and check that this file is well suffixed with '.ddaut'. Do not check the content of the file More...
 
size_t checkAutFile (const std::string &filename)
 check that filename is a proper file with the aut suffix More...
 
size_t checkAutFileName (const std::string &filename)
 check that filename is a proper filename with the aut suffix More...
 
size_t printUsage (const string &programName, Poptions::options_description &desc)
 
size_t printUsage (const string &description)
 
size_t printCommandLineError (const string &msg)
 
size_t printCommandLineWarning (const string &msg)
 
bool fileSuffixOk (const string &modelFile, const string &suffix)
 
string getSuffix (const string &name)
 
size_t printUsage (const string &programName, boost::program_options::options_description &desc)
 
size_t printCommandLineError (const Diades::Utils::Msg &msg)
 
size_t printCommandLineWarning (const Diades::Utils::Msg &msg)
 
template<typename Option >
bool getOption (const string &parameter, const vector< string > &options, Option &result)
 
template<typename T >
void getParameter (int argc, char **argv, int &index, T &param)
 
template<typename T >
void getParameterList (int argc, char **argv, const vector< string > &options, const vector< string > &fileExtensions, int &index, set< T > &records)
 

Typedef Documentation

◆ Msg

Definition at line 19 of file AutomataInterface.cc.

Function Documentation

◆ checkAutFile()

size_t Diades::CmdInterface::checkAutFile ( const std::string &  filename)

check that filename is a proper file with the aut suffix

check that the file 'filename' can be opened and is readable and check that this file is well suffixed with '.aut'. Do not check the content of the file

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper file with the aut suffix or ERROR_IN_COMMAND_LINE in other cases
See also
checkDdAutFileName

Definition at line 410 of file AutomataInterface.cc.

References checkAutFileName(), isOpenableFile(), and SUCCESS.

◆ checkAutFileName()

size_t Diades::CmdInterface::checkAutFileName ( const std::string &  filename)

check that filename is a proper filename with the aut suffix

check that the file 'filename' is well suffixed with '.aut'. Do not check the content of the file

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper filename with the aut suffix or ERROR_IN_COMMAND_LINE in other cases

Definition at line 433 of file AutomataInterface.cc.

References checkFileNameSuffix().

Referenced by checkAutFile().

◆ checkDdAutFile()

size_t Diades::CmdInterface::checkDdAutFile ( const std::string &  filename)

check that filename is a proper file with the ddaut suffix check that the file 'filename' can be opened and is readable and check that this file is well suffixed with '.ddaut'. Do not check the content of the file

check that filename is a proper file with the ddaut suffix

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper file with the ddaut suffix or ERROR_IN_COMMAND_LINE in other cases
See also
checkDdAutFileName

check that the file 'filename' can be opened and is readable and check that this file is well suffixed with '.ddaut'. Do not check the content of the file

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper file with the ddaut suffix or ERROR_IN_COMMAND_LINE in other cases
See also
checkDdAutFileName

Definition at line 386 of file AutomataInterface.cc.

References checkDdAutFileName(), isOpenableFile(), and SUCCESS.

Referenced by main().

◆ checkDdAutFileName()

size_t Diades::CmdInterface::checkDdAutFileName ( const std::string &  filename)

check that filename is a proper file with the ddaut suffix

check that filename is a proper filename with the ddaut suffix

check that the file 'filename' can be opened and is readable and check that this file is well suffixed with '.ddaut'. Do not check the content of the file

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper file with the ddaut suffix or ERROR_IN_COMMAND_LINE in other cases

check that the file 'filename' is well suffixed with '.ddaut'. Do not check the content of the file

Parameters
filenamethe name to check
Returns
SUCCESS if the filename is a proper filename with the ddaut suffix or ERROR_IN_COMMAND_LINE in other cases

Definition at line 348 of file AutomataInterface.cc.

References checkFileNameSuffix().

Referenced by checkDdAutFile().

◆ checkFileNameSuffix()

size_t Diades::CmdInterface::checkFileNameSuffix ( const std::string &  filename,
const std::string &  suffix 
)

check that filename has the expected suffix

check that filename has the expected suffix, suffix must not contain '.' characters

Parameters
[in]filenamethe name to check
[in]suffixexpected suffix (no '.' character in suffix)
Returns
SUCCESS if the filename has the correct suffix or ERROR_IN_COMMAND_LINE in other cases
Precondition
no '.' character in suffix

Definition at line 313 of file AutomataInterface.cc.

References printCommandLineError(), and SUCCESS.

Referenced by checkAutFileName(), and checkDdAutFileName().

◆ fileSuffixOk()

bool Diades::CmdInterface::fileSuffixOk ( const string &  modelFile,
const string &  suffix 
)
Parameters
modelFilethe name of a file
suffixa suffix
Returns
true if the modelFile has the suffix 'suffix'

Definition at line 128 of file CmdInterface.cc.

References Diades::Utils::getFileExtension().

Referenced by checkDescompFile(), main(), and printCommandLineWarning().

◆ getOption()

template<typename Option >
bool Diades::CmdInterface::getOption ( const string &  parameter,
const vector< string > &  options,
Option result 
)

Get the current option

Parameters
parameterthe parameter to analyse
optionsthe set of available options
resultthe return option
Returns
true if it founds options[result]==parameter, false otherwise.

Definition at line 171 of file CmdInterface.hh.

◆ getParameter()

template<typename T >
void Diades::CmdInterface::getParameter ( int  argc,
char **  argv,
int &  index,
T &  param 
)
Parameters
argcthe number of available parameters
argvthe list of available parameters
indexthe index of the current parameter, index is set to index + 1 at the end of this call
paramthe interpreted version of the current parameter as a type T

This function aborts the program if something wrong.

Definition at line 202 of file CmdInterface.hh.

References printCommandLineError().

◆ getParameterList()

template<typename T >
void Diades::CmdInterface::getParameterList ( int  argc,
char **  argv,
const vector< string > &  options,
const vector< string > &  fileExtensions,
int &  index,
set< T > &  records 
)
Parameters
argcthe number of available parameters
argvthe list of available parameters
optionsthe set of availble options for this command
fileExtensionsthe set of file extensions involved in this command.
indexthe index of the current parameter, index is set to (end of the list) + 1 at the end of this call
recordsthe set of recorded parameters from index to the end of the list.

This function aborts the program if something wrong.

Definition at line 241 of file CmdInterface.hh.

References Diades::Utils::getFileExtension().

◆ getSuffix()

string Diades::CmdInterface::getSuffix ( const string &  name)

get the suffix of the filename

Parameters
namea filename
Returns
the suffix of the filename

Definition at line 145 of file CmdInterface.cc.

Referenced by printCommandLineWarning().

◆ isOpenableFile()

size_t Diades::CmdInterface::isOpenableFile ( const std::string &  filename)

check that the file can be opened

attempt to open the file, SUCCESS if the file can be opened

Parameters
filenamename of the file to check
Returns
SUCCESS if the file can be opened.

Definition at line 362 of file AutomataInterface.cc.

References printCommandLineError(), and SUCCESS.

Referenced by checkAutFile(), checkDdAutFile(), and main().

◆ loadFiniteStateAutomaton()

size_t Diades::CmdInterface::loadFiniteStateAutomaton ( const std::string &  input,
const Diades::Automata::Experimental::ManagedDdAutFA mfa 
)

Load the finite automaton from a file called 'input'.

Load a ddaut file and initialise a DdAutFA. To only load a DdAutFsm

See also
loadFiniteStateMachine
Parameters
inputfilename of the file to load
mfathe loaded finite state machine
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Definition at line 65 of file AutomataInterface.cc.

References Diades::Automata::Experimental::ManagedDdAutFA::eMgr, Diades::Automata::Experimental::ManagedDdAutFA::fa, Diades::Automata::Experimental::faFromDescriptor(), printCommandLineError(), Diades::Automata::Experimental::DdAutFileDescriptor::readStream(), Diades::Automata::Experimental::ManagedDdAutFA::sMgr, and SUCCESS.

◆ loadFiniteStateMachine()

size_t Diades::CmdInterface::loadFiniteStateMachine ( const std::string &  input,
const Diades::Automata::Experimental::ManagedDdAutFsm mfsm 
)

Load the fsm from a file called 'input'.

Load a ddaut file and initialise a DdAutFsm. If the file contains acceptor states it is ignored

See also
loadFiniteStateAutomaton
Parameters
inputfilename of the file to load
mfsmthe loaded finite state machine
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Definition at line 32 of file AutomataInterface.cc.

References Diades::Automata::Experimental::ManagedDdAutFsm::eMgr, Diades::Automata::Experimental::ManagedDdAutFsm::fsm, Diades::Automata::Experimental::fsmFromDescriptor(), printCommandLineError(), Diades::Automata::Experimental::DdAutFileDescriptor::readStream(), Diades::Automata::Experimental::ManagedDdAutFsm::sMgr, and SUCCESS.

Referenced by prepareSimulation().

◆ printCommandLineError() [1/2]

size_t Diades::CmdInterface::printCommandLineError ( const string &  msg)

◆ printCommandLineError() [2/2]

size_t Diades::CmdInterface::printCommandLineError ( const Diades::Utils::Msg msg)
inline

Print out on the standard output the description of an error.

Parameters
descriptionthe description of the error message
Returns
ERROR_IN_COMMAND_LINE

Definition at line 109 of file CmdInterface.hh.

References printCommandLineError(), and printCommandLineWarning().

◆ printCommandLineWarning() [1/2]

size_t Diades::CmdInterface::printCommandLineWarning ( const string &  msg)

Print out on the standard output the description of a warning.

Parameters
descriptionthe description of the error message
Returns
ERROR_IN_COMMAND_LINE

Print out on the standard output the description of a warning.

Parameters
descriptionthe description of the error message
Returns
WARNING_IN_COMMAND_LINE

Definition at line 110 of file CmdInterface.cc.

References WARNING_IN_COMMAND_LINE.

Referenced by explainFsm(), printCommandLineError(), and printCommandLineWarning().

◆ printCommandLineWarning() [2/2]

size_t Diades::CmdInterface::printCommandLineWarning ( const Diades::Utils::Msg msg)
inline

Print out on the standard output the description of an error.

Parameters
descriptionthe description of the error message
Returns
ERROR_IN_COMMAND_LINE

Definition at line 129 of file CmdInterface.hh.

References fileSuffixOk(), getSuffix(), and printCommandLineWarning().

◆ printUsage() [1/3]

size_t Diades::CmdInterface::printUsage ( const string &  programName,
Poptions::options_description &  desc 
)

Print out on the standard output the description of the usage of a program.

Parameters
programNamethe name of the program, "" if not available
descthe boost::program_options description
Returns
SUCCESS

Definition at line 73 of file CmdInterface.cc.

References SUCCESS.

◆ printUsage() [2/3]

size_t Diades::CmdInterface::printUsage ( const string &  programName,
boost::program_options::options_description &  desc 
)

Print out on the standard output the description of the usage of a program.

Parameters
programNamename of the program, "" if not available
descthe boost::program_options description
Returns
SUCCESS

◆ printUsage() [3/3]

size_t Diades::CmdInterface::printUsage ( const string &  description)

Print out on the standard output the description of the usage of a program.

Parameters
descriptionthe usage as a string
Returns
SUCCESS

Definition at line 86 of file CmdInterface.cc.

References SUCCESS.

◆ writeAut()

size_t Diades::CmdInterface::writeAut ( const Diades::Automata::Experimental::AutFsm fsm,
const std::string &  output,
const FileSuffixes suffixes 
)

Write the fsm in a file called 'output' in "aut" format

Parameters
fsmthe StateMachine to save
outputthe output filename
suffixesto check
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Write the fsm in a file called 'output'

Parameters
fsmthe StateMachine to save
outputthe output filename
suffixesto check
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Definition at line 102 of file AutomataInterface.cc.

References Diades::CmdInterface::FileSuffixes::match(), printCommandLineError(), SUCCESS, and Diades::Automata::Experimental::toAutFile().

Referenced by completeAut(), determineAut(), insertAuts(), minimizeAut(), and projectAut().

◆ writeFiniteAutomaton()

size_t Diades::CmdInterface::writeFiniteAutomaton ( const Diades::Automata::Experimental::ConstManagedDdAutFA mfa,
const std::string &  output,
const FileSuffixes suffixes 
)

Write the finite automaton in a file called 'output' in "ddaut" format

Parameters
fsmthe StateMachine to save
outputthe output filename
suffixesto check
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Definition at line 240 of file AutomataInterface.cc.

References Diades::Automata::Experimental::ConstManagedDdAutFA::eMgr, Diades::Automata::Experimental::ConstManagedDdAutFA::fa, Diades::Automata::Experimental::faToDdAutFile(), Diades::Automata::Experimental::fsmToAutFile(), Diades::CmdInterface::FileSuffixes::match(), printCommandLineError(), and SUCCESS.

Referenced by completeDdaut(), determineDdaut(), explainFsm(), insertDdAuts(), minimizeDdaut(), projectDdaut(), and synchroniseDdAut().

◆ writeFiniteStateMachine()

size_t Diades::CmdInterface::writeFiniteStateMachine ( const Diades::Automata::Experimental::ConstManagedDdAutFsm mfsm,
const std::string &  output,
const FileSuffixes suffixes 
)

Write the fsm in a file called 'output' in "ddaut" format

Parameters
fsmthe StateMachine to save
outputthe output filename
suffixesto check
Returns
SUCCESS if success or ERROR_IN_COMMAND_LINE

Definition at line 169 of file AutomataInterface.cc.

References Diades::Automata::Experimental::ConstManagedDdAutFsm::eMgr, Diades::Automata::Experimental::ConstManagedDdAutFsm::fsm, Diades::Automata::Experimental::fsmToAutFile(), Diades::Automata::Experimental::fsmToDdAutFile(), Diades::CmdInterface::FileSuffixes::match(), printCommandLineError(), and SUCCESS.

Referenced by completeDdaut(), determineDdaut(), minimizeDdaut(), and projectDdaut().