/[PAMELA software]/yoda/techmodel/techmodelreader.cpp
ViewVC logotype

Diff of /yoda/techmodel/techmodelreader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.0 by kusanagi, Tue Sep 21 20:50:54 2004 UTC revision 2.2 by kusanagi, Tue Feb 15 17:55:25 2005 UTC
# Line 14  Line 14 
14  #include <cstdlib>  #include <cstdlib>
15  #include <iostream>  #include <iostream>
16  #include <time.h>  #include <time.h>
17    #include "Exception.h"
18    
19  extern "C" {  extern "C" {
20  //#include "DirectoryStructure.h"  //#include "DirectoryStructure.h"
21  #include <dirent.h>  #include <dirent.h>
22  }  }
23    
24    
25    
26  using namespace pamela;  using namespace pamela;
27  using namespace log4cxx;  using namespace log4cxx;
28  using namespace std;  using namespace std;
# Line 34  int main(int argc, char* argv[]) { Line 37  int main(int argc, char* argv[]) {
37      char nomeFileLog[L_tmpnam];      char nomeFileLog[L_tmpnam];
38      tmpnam(nomeFileLog);      tmpnam(nomeFileLog);
39      DIR *dirp;      DIR *dirp;
     string pathDir((char*)getenv("YODA_DATA"));  
     string pathLog = nomeFileLog;  
40    
41        // check if yoda_DATA exist!!!!
42        char *outDir;
43        try {
44        outDir = getenv("YODA_DATA");
45        if (getenv("YODA_DATA") == NULL) throw NotFoundEnvironmentVarException("The variable YODA_DATA has not been found. Please check your environment variables.");
46        } catch (NotFoundEnvironmentVarException exc) {
47         oss.str("");
48         oss << exc.print();
49         logger->fatal(oss.str().c_str());
50        }
51    
52        string pathDir(outDir);
53    
54        string pathLog = nomeFileLog;
55        bool ANALIZE = false;
56      //---------------- Log4cxx configuration-----------------------------------------------      //---------------- Log4cxx configuration-----------------------------------------------
57      //Define the configuration file to be used on log4cxx      //Define the configuration file to be used on log4cxx
58      PropertyConfigurator::configure(pathDir + "/log4cxx.conf");      PropertyConfigurator::configure(pathDir + "/log4cxx.conf");
# Line 71  int main(int argc, char* argv[]) { Line 87  int main(int argc, char* argv[]) {
87          cout << "Usage: yoda FILE [OPTION] \n";          cout << "Usage: yoda FILE [OPTION] \n";
88          cout << "\t --help              print this help and exit \n";          cout << "\t --help              print this help and exit \n";
89          cout << "\t -p                  maximum number of packets to process [default all] \n";          cout << "\t -p                  maximum number of packets to process [default all] \n";
90            cout << "\t -analize            generate pre-defined analisys files (gif/text) inside the unpacking directory\n";
91          exit(1);          exit(1);
92    }    }
93    
# Line 102  int main(int argc, char* argv[]) { Line 119  int main(int argc, char* argv[]) {
119          cout << "Try '--help' for more information. \n";          cout << "Try '--help' for more information. \n";
120          exit(1);          exit(1);
121      }      }
122    
123        if (!strcmp(argv[i], "-analize")) ANALIZE = true;
124        
125    }    }
126        
127        
# Line 118  int main(int argc, char* argv[]) { Line 138  int main(int argc, char* argv[]) {
138      time ( &rawtime );      time ( &rawtime );
139      timeinfo = localtime ( &rawtime );      timeinfo = localtime ( &rawtime );
140            
141      oss.flush();      oss.str("");
142      oss << "<-------------------------------START UNPACKING------------------------------->\n"      oss << "<-------------------------------START UNPACKING------------------------------->\n"
143          << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1];          << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1];
144      logger->info(oss.str().c_str());      logger->info(oss.str().c_str());
# Line 131  int main(int argc, char* argv[]) { Line 151  int main(int argc, char* argv[]) {
151    TechmodelPamelaRun Run(argv[1]);    TechmodelPamelaRun Run(argv[1]);
152    reader->Init(&Run);    reader->Init(&Run);
153    
154     oss.flush();     oss.str("");
155     oss << "Init successul ok" << asctime (timeinfo);     oss << "Init successul ok" << asctime (timeinfo);
156     logger->debug(oss.str().c_str());     logger->debug(oss.str().c_str());
157    
# Line 141  int main(int argc, char* argv[]) { Line 161  int main(int argc, char* argv[]) {
161    
162    logger->info("<-------------------------------END UNPACKING------------------------------->\n");    logger->info("<-------------------------------END UNPACKING------------------------------->\n");
163    
   std::string command;  
   command = "mv " + pathLog + "  " + pathDir + "/" + Run.GetRun() + "/YodaLog.txt";  
164    //Momentarly suspended the save      //Momentarly suspended the save  
165    //system(command.c_str());    //system(command.c_str());
166  }  }

Legend:
Removed from v.2.0  
changed lines
  Added in v.2.2

  ViewVC Help
Powered by ViewVC 1.1.23