Isis 3.0 Application Source Code Reference |
Home |
00001 // $Id$ 00002 #include "Isis.h" 00003 #include "FileList.h" 00004 #include "Filename.h" 00005 #include "Pvl.h" 00006 #include "Process.h" 00007 #include "ProgramAnalyzer.h" 00008 #include "iTime.h" 00009 #include "iException.h" 00010 00011 using namespace std; 00012 using namespace Isis; 00013 00014 void IsisMain() { 00015 Process p; 00016 ProgramAnalyzer analyzer; 00017 00018 // Get the list of names of input CCD cubes to stitch together 00019 UserInterface &ui = Application::GetUserInterface(); 00020 00021 // Add program exclusions 00022 if (ui.WasEntered("EXCLUDE")) analyzer.setExclude(ui.GetString("EXCLUDE")); 00023 if (ui.WasEntered("EXCLUDEFROM") ) { 00024 FileList elist(ui.GetFilename("EXCLUDEFROM")); 00025 for (unsigned int i = 0 ; i < elist.size() ; i++ ) { 00026 analyzer.exclude(elist[i]); 00027 } 00028 } 00029 00030 // Add program inclusions 00031 if (ui.WasEntered("INCLUDE")) analyzer.setInclude(ui.GetString("INCLUDE")); 00032 if (ui.WasEntered("INCLUDEFROM") ) { 00033 FileList ilist(ui.GetFilename("INCLUDEFROM")); 00034 for (unsigned int i = 0 ; i < ilist.size() ; i++ ) { 00035 analyzer.include(ilist[i]); 00036 } 00037 } 00038 00039 // Add the file 00040 analyzer.add(ui.GetFilename("FROM")); 00041 00042 // Log results 00043 PvlGroup logger = analyzer.review(); 00044 Application::GuiLog(logger); 00045 Application::Log(logger); 00046 00047 logger = analyzer.cumulative(); 00048 Application::GuiLog(logger); 00049 Application::Log(logger); 00050 00051 00052 // Write the output file if requested for individual unique program summaries 00053 if(ui.WasEntered("SUMMARY")) { 00054 Pvl temp; 00055 temp.AddGroup(analyzer.review()); 00056 temp.AddGroup(analyzer.cumulative()); 00057 for (int i = 0 ; i < analyzer.Programs() ; i++) { 00058 temp.AddGroup(analyzer.summarize(i)); 00059 } 00060 temp.Write(ui.GetFilename("SUMMARY")); 00061 } 00062 00063 // Write the output file if requested of CSV formatted data 00064 if(ui.WasEntered("LOG")) { 00065 // Set up for opening 00066 Filename temp(ui.GetFilename("LOG")); 00067 string file = temp.Expanded(); 00068 ofstream ostm; 00069 00070 // Open the file 00071 ostm.open(file.c_str(), std::ios::out); 00072 if(!ostm) { 00073 string message = "Cannot open/create output file " + file; 00074 throw iException::Message(iException::Io, message, _FILEINFO_); 00075 } 00076 00077 analyzer.header(ostm); 00078 analyzer.listify(ostm); 00079 ostm.close(); 00080 } 00081 00082 p.EndProcess(); 00083 }