Main Page | Compound List | File List | Compound Members | File Members

bytestreamexample.main.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include <fstream>
00012 #include "yapi.h"
00013 #include "bytestreamexample.h"
00014 #include "parse_options.h"
00015 
00016 using namespace::std;
00017 
00018 int main(int argc, char *argv[])
00019 {
00020   static struct
00021   {
00022     char* path;
00023     char* fefile;
00024     char* befile;
00025   } cmdl;
00026   char fefile[256];
00027   char befile[256];
00028   
00029   option_t options[] =
00030   {
00031     { "-path",    "str", "srcdir",                   &cmdl.path, "Environment variable containing path to files"},
00032     { "-fe-file", "str", "bytestreamexample.fe.ini", &cmdl.fefile, "Ini file for frontend"},
00033     { "-be-file", "str", "bytestreamexample.be.ini", &cmdl.befile, "Ini file for backend"},
00034     { NULL, NULL, NULL, NULL, NULL}
00035   };
00036 
00037   if (parse_options("bytestreamexample", argc, argv, options))
00038   {
00039     #ifdef VERBOSE
00040     fprintf(stderr, "(use \"-help\" for help)\n");
00041     #endif
00042     exit(1);
00043   }
00044   #ifdef VERBOSE
00045   print_option_values("bytestreamexample", options);
00046   #endif
00047   
00048   if (getenv(cmdl.path))
00049   {
00050     strcpy(fefile, getenv(cmdl.path));
00051     strcat(fefile, "/");
00052     strcat(fefile, cmdl.fefile);
00053 
00054     strcpy(befile, getenv(cmdl.path));
00055     strcat(befile, "/");
00056     strcat(befile, cmdl.befile);
00057    }
00058   else
00059   {
00060     strcpy(fefile, cmdl.fefile);
00061     strcpy(befile, cmdl.befile);
00062   }
00063   
00064   // create yapi run-time environment
00065   RTE rte;
00066 
00067   // redirect standard output
00068   ofstream f("./Results/bytestreamexample.out");
00069   rte.setOutStream(f);
00070 
00071   // redirect standard error
00072   ofstream g("./Results/bytestreamexample.err");
00073   rte.setErrorStream(g);
00074 
00075   byteStreamExample *bytestreamexample = new byteStreamExample(
00076     id("bytestreamexample"),
00077     fefile,
00078     befile
00079   );
00080 
00081   // start the process network and
00082   // wait for processes to finish
00083   rte.start(*bytestreamexample);
00084   
00085   // print workload
00086   ofstream h("./Results/bytestreamexample.workload");
00087   printWorkload(*bytestreamexample, h);
00088 
00089   // generate dotty file
00090   ofstream i("./Results/bytestreamexample.dot");
00091   printDotty(*bytestreamexample, i);
00092 
00093   f.close();
00094   g.close();
00095   h.close();
00096   i.close();
00097 
00098   delete bytestreamexample;
00099   
00100   return 0;
00101 }

Generated on Wed Feb 15 14:52:43 2006 for bytestreamfebe by doxygen 1.3.2