diag2dot.cpp

Go to the documentation of this file.
00001 /** diag2dot.cpp  Utility to convert gen files to dot files  */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005    Copyright (C) 2006  Bernd Opitz
00006    Exclusive copyright is granted to Klaus Schmidt
00007 
00008    This library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Lesser General Public
00010    License as published by the Free Software Foundation; either
00011    version 2.1 of the License, or (at your option) any later version.
00012 
00013    This library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Lesser General Public License for more details.
00017 
00018    You should have received a copy of the GNU Lesser General Public
00019    License along with this library; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00021    
00022 
00023 #include "libfaudes.h"
00024 #include <iostream>
00025 
00026 using namespace faudes;
00027 
00028 int main(int argc, char *argv[]) {
00029   if (argc != 2) {
00030     std::cerr << "usage: diag2dot <generator>" << std::endl;
00031     exit(1);
00032   }
00033 
00034         // read gen file
00035   Diagnoser g(argv[1]);
00036 
00037         // fix output file name
00038         std::string basename = argv[1];
00039         if (basename.rfind(".gen") < basename.size()) {
00040           basename.resize(basename.rfind(".gen"));
00041         }  
00042         std::string dotfilename = basename+".dot";
00043 
00044         // write dot file
00045   g.DotWrite(dotfilename);
00046 
00047   return 0;
00048 }

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen