/[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 1.7 by kusanagi, Tue Sep 21 20:24:33 2004 UTC revision 4.0 by kusanagi, Sun Mar 6 04:33:02 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.");
46        } catch (NotFoundEnvironmentVarException exc) {
47         cout << "The variable YODA_DATA has not been found. \n";
48         cout << "Please check your environment variables \n";
49         oss.str("");
50         oss << exc.print();
51         logger->fatal(oss.str().c_str());
52         exit(1);
53        }
54    
55        string pathDir(outDir);
56    
57        string pathLog = nomeFileLog;
58        bool ANALIZE = false;
59      //---------------- Log4cxx configuration-----------------------------------------------      //---------------- Log4cxx configuration-----------------------------------------------
60      //Define the configuration file to be used on log4cxx      //Define the configuration file to be used on log4cxx
61      PropertyConfigurator::configure(pathDir + "/log4cxx.conf");      PropertyConfigurator::configure(pathDir + "/log4cxx.conf");
# Line 71  int main(int argc, char* argv[]) { Line 90  int main(int argc, char* argv[]) {
90          cout << "Usage: yoda FILE [OPTION] \n";          cout << "Usage: yoda FILE [OPTION] \n";
91          cout << "\t --help              print this help and exit \n";          cout << "\t --help              print this help and exit \n";
92          cout << "\t -p                  maximum number of packets to process [default all] \n";          cout << "\t -p                  maximum number of packets to process [default all] \n";
93            cout << "\t -analize            generate pre-defined analisys files (gif/text) inside the unpacking directory\n";
94          exit(1);          exit(1);
95    }    }
96    
# Line 102  int main(int argc, char* argv[]) { Line 122  int main(int argc, char* argv[]) {
122          cout << "Try '--help' for more information. \n";          cout << "Try '--help' for more information. \n";
123          exit(1);          exit(1);
124      }      }
125    
126        if (!strcmp(argv[i], "-analize")) ANALIZE = true;
127        
128    }    }
129        
130        
# Line 118  int main(int argc, char* argv[]) { Line 141  int main(int argc, char* argv[]) {
141      time ( &rawtime );      time ( &rawtime );
142      timeinfo = localtime ( &rawtime );      timeinfo = localtime ( &rawtime );
143            
144      oss.flush();      oss.str("");
145      oss << "<-------------------------------START UNPACKING------------------------------->\n"      oss << "<-------------------------------START UNPACKING------------------------------->\n"
146          << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1];          << " Starting the program at: " << asctime (timeinfo) << " Opening file: " << argv[1];
147      logger->info(oss.str().c_str());      logger->info(oss.str().c_str());
# Line 131  int main(int argc, char* argv[]) { Line 154  int main(int argc, char* argv[]) {
154    TechmodelPamelaRun Run(argv[1]);    TechmodelPamelaRun Run(argv[1]);
155    reader->Init(&Run);    reader->Init(&Run);
156    
157     oss.flush();     oss.str("");
158     oss << "Init successul ok" << asctime (timeinfo);     oss << "Init successul ok" << asctime (timeinfo);
159     logger->debug(oss.str().c_str());     logger->debug(oss.str().c_str());
160    
# Line 141  int main(int argc, char* argv[]) { Line 164  int main(int argc, char* argv[]) {
164    
165    logger->info("<-------------------------------END UNPACKING------------------------------->\n");    logger->info("<-------------------------------END UNPACKING------------------------------->\n");
166    
   std::string command;  
   command = "mv " + pathLog + "  " + pathDir + "/" + Run.GetRun() + "/YodaLog.txt";  
167    //Momentarly suspended the save      //Momentarly suspended the save  
168    //system(command.c_str());    //system(command.c_str());
169  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.4.0

  ViewVC Help
Powered by ViewVC 1.1.23