17 namespace CmdInterface
35 ifstream file(input.c_str());
52 return printCommandLineError(
Msg(
"Error when converting the DdAutFileDescriptor from %1% to a Finite Automaton") % input);
69 ifstream file(input.c_str());
86 return printCommandLineError(
Msg(
"Error when converting the DdAutFileDescriptor from %1% to a Finite Automaton") % input);
109 if(suffixes.
match(output,
"aut"))
128 if(suffixes.
match(output,
"ddaut"))
139 return printCommandLineError(
Msg(
"Error when dumping the deterministic automaton in the 'ddaut' file %1%") % output);
146 return printCommandLineError(
Msg(
"Expecting an output file with a name ending with '.aut' or '.ddaut', but I read %1%") % output);
174 const std::string & output,
181 if(suffixes.
match(output,
"aut"))
200 if(suffixes.
match(output,
"ddaut"))
211 return printCommandLineError(
Msg(
"Error when dumping the deterministic automaton in the 'ddaut' file %1%") % output);
218 return printCommandLineError(
Msg(
"Expecting an output file with a name ending with '.aut' or '.ddaut', but I read %1%") % output);
241 const std::string & output,
248 if(suffixes.
match(output,
"aut"))
267 if(suffixes.
match(output,
"ddaut"))
278 return printCommandLineError(
Msg(
"Error when dumping the deterministic automaton in the 'ddaut' file %1%") % output);
285 return printCommandLineError(
Msg(
"Expecting an output file with a name ending with '.aut' or '.ddaut', but I read %1%") % output);
315 if(suffix.find(
'.') != std::string::npos)
317 return printCommandLineError(
Msg(
"Checking a filename for a wrong suffix that contains at least a '.' character: %1%") % filename);
320 auto lastDot = filename.find_last_of(
".");
321 if(lastDot == std::string::npos)
323 return printCommandLineError(
Msg(
"Expecting a file with a name ending with '.%2%', but I read %1%") % filename % suffix);
325 auto startSuffix = filename.find(suffix,lastDot);
326 if(startSuffix == std::string::npos)
328 return printCommandLineError(
Msg(
"Expecting a file with a name ending with '.%2%'', but I read %1%") % filename % suffix);
330 if((filename.length() - startSuffix) != suffix.length())
332 return printCommandLineError(
Msg(
"Expecting a file with a name ending with '.%2%', but I read %1%") % filename % suffix);
365 std::ifstream file(filename.c_str());
const DdAutEventManager & eMgr
size_t writeAut(const Diades::Automata::Experimental::AutFsm &fsm, const std::string &output, const FileSuffixes &suffixes)
size_t checkDdAutFileName(const std::string &filename)
check that filename is a proper file with the ddaut suffix
size_t writeFiniteAutomaton(const Diades::Automata::Experimental::ConstManagedDdAutFA &mfa, const std::string &output, const FileSuffixes &suffixes)
bool fsmFromDescriptor(const DdAutFileDescriptor &descriptor, DdAutFsm &fsm, DdAutStateManager &sManager, DdAutEventManager &eManager)
size_t printCommandLineError(const string &msg)
bool faFromDescriptor(const DdAutFileDescriptor &descriptor, DdAutFA &fa, DdAutStateManager &sManager, DdAutEventManager &eManager)
size_t loadFiniteStateAutomaton(const std::string &input, const Diades::Automata::Experimental::ManagedDdAutFA &mfa)
Load the finite automaton from a file called 'input'.
size_t isOpenableFile(const std::string &filename)
check that the file can be opened
bool fsmToAutFile(ostream &stream, const DdAutFsm &fsm, const DdAutEventManager &eManager, bool enforce=false)
data structure that gathers an FA, a StateManager and a EventManager
data structure that gathers an Fsm, a StateManager and a EventManager
data structure that gathers an FA, a StateManager and a EventManager
bool faToDdAutFile(ostream &stream, const ConstManagedDdAutFA &mFa)
size_t checkFileNameSuffix(const std::string &filename, const std::string &suffix)
check that filename has the expected suffix
bool match(const std::string &fileName, const std::string &suffix) const
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 ope...
size_t checkAutFile(const std::string &filename)
check that filename is a proper file with the aut suffix
size_t checkAutFileName(const std::string &filename)
check that filename is a proper filename with the aut suffix
Namespace of the Diades project.
bool fsmToDdAutFile(ostream &stream, const ConstManagedDdAutFsm &mFsm)
data structure that gathers an Fsm, a StateManager and a EventManager
bool toAutFile(ostream &stream, const AutFsm &fsm, bool enforce=false)
size_t writeFiniteStateMachine(const Diades::Automata::Experimental::ConstManagedDdAutFsm &mfsm, const std::string &output, const FileSuffixes &suffixes)
FileSuffixes suffixes({"aut","ddaut"})
const DdAutEventManager & eMgr
size_t loadFiniteStateMachine(const std::string &input, const Diades::Automata::Experimental::ManagedDdAutFsm &mfsm)
Load the fsm from a file called 'input'.
virtual bool readStream(std::istream &stream)