Ignore:
Timestamp:
03/01/01 15:56:58 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/merpp.cc

    r609 r654  
    4343    // check for the right usage of the program
    4444    //
    45     if (argc!=3)
     45    if (argc<3 || argc>4)
    4646    {
    4747        gLog << "Sorry the usage is:" << endl;
    48         gLog << "   merpp inputfile outputfile" << endl << endl;
     48        gLog << "   merpp inputfile outputfile [compression level]" << endl << endl;
    4949        return -1;
    5050    }
     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;
    5158
    5259    //
     
    5865    // check whether the given files are OK.
    5966    //
    60     if (gSystem->AccessPathName(argv[1], kFileExists))
     67    if (gSystem->AccessPathName(kNamein, kFileExists))
    6168    {
    62         gLog << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
     69        gLog << "Sorry, the file '" << kNamein << "' doesn't exist." << endl;
    6370        return -1;
    6471    }
    6572
    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;
    6875    else
    69         if (!gSystem->AccessPathName(argv[2], kWritePermission))
     76        if (!gSystem->AccessPathName(kNameout, kWritePermission))
    7077        {
    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;
    7279            return -1;
    7380        }
     
    7784    // and an (empty) list of tasks which should be executed
    7885    //
    79     MParList *plist  = new MParList;
     86    MParList plist;
    8087
    81     MTaskList *tasks = new MTaskList;
    82     plist->AddToList(tasks);
     88    MTaskList tasks;
     89    plist.AddToList(&tasks);
    8390
    84     MRawRunHeader *runheader = new MRawRunHeader;
    85     plist->AddToList(runheader);
     91    MRawRunHeader runheader;
     92    plist.AddToList(&runheader);
    8693
    87     MRawEvtHeader *evtheader = new MRawEvtHeader;
    88     plist->AddToList(evtheader);
     94    MRawEvtHeader evtheader;
     95    plist.AddToList(&evtheader);
    8996
    90     MRawEvtData *evtdata = new MRawEvtData;
    91     plist->AddToList(evtdata);
     97    MRawEvtData evtdata;
     98    plist.AddToList(&evtdata);
    9299
    93     MRawCrateArray *cratearray = new MRawCrateArray;
    94     plist->AddToList(cratearray);
     100    MRawCrateArray cratearray;
     101    plist.AddToList(&cratearray);
    95102
    96     MTime *evttime = new MTime("MRawEvtTime");
    97     plist->AddToList(evttime);
     103    MTime evttime("MRawEvtTime");
     104    plist.AddToList(&evttime);
    98105
    99106    //
     
    102109    // be created by MRawFileRead::PreProcess
    103110    //
    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);
    108115
    109116    //
     
    114121    MEvtLoop magic;
    115122
    116     magic.SetParList(plist);
     123    magic.SetParList(&plist);
    117124
    118125    //
Note: See TracChangeset for help on using the changeset viewer.