Changeset 654 for trunk/MagicSoft/Mars/merpp.cc
- Timestamp:
- 03/01/01 15:56:58 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/merpp.cc
r609 r654 43 43 // check for the right usage of the program 44 44 // 45 if (argc !=3)45 if (argc<3 || argc>4) 46 46 { 47 47 gLog << "Sorry the usage is:" << endl; 48 gLog << " merpp inputfile outputfile " << endl << endl;48 gLog << " merpp inputfile outputfile [compression level]" << endl << endl; 49 49 return -1; 50 50 } 51 52 // 53 // This is to make argv[i] more readable insidethe code 54 // 55 const char *kNamein = argv[1]; 56 const char *kNameout = argv[2]; 57 const int kComprlvl = argc==4 ? atoi(argv[3]) : 9; 51 58 52 59 // … … 58 65 // check whether the given files are OK. 59 66 // 60 if (gSystem->AccessPathName( argv[1], kFileExists))67 if (gSystem->AccessPathName(kNamein, kFileExists)) 61 68 { 62 gLog << "Sorry, the file '" << argv[1]<< "' doesn't exist." << endl;69 gLog << "Sorry, the file '" << kNamein << "' doesn't exist." << endl; 63 70 return -1; 64 71 } 65 72 66 if (!gSystem->AccessPathName( argv[2], kFileExists))67 gLog << "Warning: The file '" << argv[2]<< "' exists." << endl;73 if (!gSystem->AccessPathName(kNameout, kFileExists)) 74 gLog << "Warning: The file '" << kNameout << "' exists." << endl; 68 75 else 69 if (!gSystem->AccessPathName( argv[2], kWritePermission))76 if (!gSystem->AccessPathName(kNameout, kWritePermission)) 70 77 { 71 gLog << "Sorry, you don't have write permission for '" << argv[2]<< "'." << endl;78 gLog << "Sorry, you don't have write permission for '" << kNameout << "'." << endl; 72 79 return -1; 73 80 } … … 77 84 // and an (empty) list of tasks which should be executed 78 85 // 79 MParList *plist = new MParList;86 MParList plist; 80 87 81 MTaskList *tasks = new MTaskList;82 plist ->AddToList(tasks);88 MTaskList tasks; 89 plist.AddToList(&tasks); 83 90 84 MRawRunHeader *runheader = new MRawRunHeader;85 plist ->AddToList(runheader);91 MRawRunHeader runheader; 92 plist.AddToList(&runheader); 86 93 87 MRawEvtHeader *evtheader = new MRawEvtHeader;88 plist ->AddToList(evtheader);94 MRawEvtHeader evtheader; 95 plist.AddToList(&evtheader); 89 96 90 MRawEvtData *evtdata = new MRawEvtData;91 plist ->AddToList(evtdata);97 MRawEvtData evtdata; 98 plist.AddToList(&evtdata); 92 99 93 MRawCrateArray *cratearray = new MRawCrateArray;94 plist ->AddToList(cratearray);100 MRawCrateArray cratearray; 101 plist.AddToList(&cratearray); 95 102 96 MTime *evttime = new MTime("MRawEvtTime");97 plist ->AddToList(evttime);103 MTime evttime("MRawEvtTime"); 104 plist.AddToList(&evttime); 98 105 99 106 // … … 102 109 // be created by MRawFileRead::PreProcess 103 110 // 104 MRawFileRead *reader = new MRawFileRead(argv[1]);105 MRawFileWrite *writer = new MRawFileWrite(argv[2], "RECREATE");106 tasks ->AddToList(reader);107 tasks ->AddToList(writer);111 MRawFileRead reader(kNamein); 112 MRawFileWrite writer(kNameout, "RECREATE", "Title", kComprlvl); 113 tasks.AddToList(&reader); 114 tasks.AddToList(&writer); 108 115 109 116 // … … 114 121 MEvtLoop magic; 115 122 116 magic.SetParList( plist);123 magic.SetParList(&plist); 117 124 118 125 //
Note:
See TracChangeset
for help on using the changeset viewer.