DiaDes  0.1
DIAgnosis of Discrete-Event System
Functions | Variables
Complete.cc File Reference

This file implements the dd-complete command that is used to make convert any kind of automata to a complete automaton. An automaton is complete for a given alphabet if from any state and for every symbol, there is at least one output transition labeled with the symbol. In case of a 'aut' finite state machine we just add a state and add as many transitions as needed to reach it (with self-loops) In case of a 'ddaut' we do the same thing and make the state non-accepting. More...

#include <cstdlib>
#include <iostream>
#include <fstream>
#include <regex>
#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/Printer.hh>
#include <diades/automata/experimental/StateMachine.hh>
#include <diades/automata/experimental/StateCreation.hh>
#include <diades/automata/experimental/Complete.hh>
#include "../AutomataInterface.hh"

Go to the source code of this file.

Functions

const string program ("dd-complete")
 
void initialiseOptions (int argc, char *argv[], Poptions::options_description &desc, Poptions::variables_map &vm)
 
size_t completeAut (const std::string &fileName, const std::string &output)
 
size_t completeDdaut (const std::string &fileName, const std::string &output)
 
size_t completeFsm (const std::string &fileName, const std::string &output)
 
int main (int argc, char **argv)
 

Variables

FileSuffixes suffixes ({"aut","ddaut"})
 

Detailed Description

This file implements the dd-complete command that is used to make convert any kind of automata to a complete automaton. An automaton is complete for a given alphabet if from any state and for every symbol, there is at least one output transition labeled with the symbol. In case of a 'aut' finite state machine we just add a state and add as many transitions as needed to reach it (with self-loops) In case of a 'ddaut' we do the same thing and make the state non-accepting.

Author
Yannick Pencolé
Date
21 January 2020, 15:38

Definition in file Complete.cc.

Function Documentation

◆ completeAut()

size_t completeAut ( const std::string &  fileName,
const std::string &  output 
)

Load the file (aut file) and make the automaton complete (low-level) and print on the output

Parameters
fileNameaut file to load
outputthe file to write (if empty, write on the standard output)
Returns
success code (SUCCESS or ERROR_COMMAND_LINE)

Definition at line 90 of file Complete.cc.

References Diades::Automata::Experimental::complete(), Diades::Automata::Experimental::fromAutFile(), Diades::CmdInterface::printCommandLineError(), suffixes, and Diades::CmdInterface::writeAut().

Referenced by completeFsm().

◆ completeDdaut()

size_t completeDdaut ( const std::string &  fileName,
const std::string &  output 
)

Load the file (ddaut file) and make the automaton complete and print on the output

Parameters
fileNameddaut file to load
outputthe file to write (if empty, write on the standard output, can be aut or ddaut file)
Returns
success code (SUCCESS or ERROR_COMMAND_LINE)

Definition at line 119 of file Complete.cc.

References Diades::Automata::Experimental::DdAutFileDescriptor::acceptorBegin(), Diades::Automata::Experimental::DdAutFileDescriptor::acceptorEnd(), Diades::Automata::Experimental::complete(), Diades::Automata::Experimental::faFromDescriptor(), Diades::Automata::Experimental::fsmFromDescriptor(), Diades::CmdInterface::printCommandLineError(), Diades::Automata::Experimental::DdAutFileDescriptor::readStream(), suffixes, Diades::CmdInterface::writeFiniteAutomaton(), and Diades::CmdInterface::writeFiniteStateMachine().

Referenced by completeFsm().

◆ completeFsm()

size_t completeFsm ( const std::string &  fileName,
const std::string &  output 
)

Load the file (aut file) and make the automaton complete (low-level) and print on the output

Parameters
fileNameaut file to load
outputthe file to write (if empty, write on the standard output)
Returns
success code (SUCCESS or ERROR_COMMAND_LINE)

Definition at line 174 of file Complete.cc.

References completeAut(), completeDdaut(), ERROR_UNHANDLED_EXCEPTION, Diades::CmdInterface::FileSuffixes::match(), Diades::CmdInterface::printCommandLineError(), and suffixes.

Referenced by main().

◆ 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 58 of file Complete.cc.

References options().

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Main file of the dd-complete command

Parameters
argc
argv
Returns
success code (SUCCESS or ERROR_COMMAND_LINE)

Definition at line 204 of file Complete.cc.

References completeFsm(), initialiseOptions(), Diades::CmdInterface::printCommandLineError(), printUsage(), and program().

◆ program()

const string program ( "dd-complete"  )

Referenced by main().

Variable Documentation

◆ suffixes

FileSuffixes suffixes({"aut","ddaut"})