Ignore:
Timestamp:
11/01/01 10:19:46 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1022 r1023  
    6666    fContainer  = new TOrdCollection;
    6767    fAutodelete = new TOrdCollection;
    68 
    69     fAutodelete->SetOwner();
    7068}
    7169
     
    8987MParList::~MParList()
    9088{
    91     if (TestBit(kIsOwner))
    92         fContainer->SetOwner();
     89    const Bool_t isowner = TestBit(kIsOwner);
     90
     91    //
     92    // Case:
     93    //  1) MParList is owner of the containers:
     94    //     All container are stored in fContainer, and become deleted by
     95    //     'delete fContainer'. Some of these containers, which were
     96    //     created automatically are stored in fAutodelete, too. To prevent
     97    //     double deletion this containers are not deleted by the destructor
     98    //     of fAutodelete.
     99    //  2) MParList is not owner of the containers:
     100    //     The containers which were Added by AddToList are not touched.
     101    //     Only the containers which were created automatically are also
     102    //     automatically deleted.
     103    //
     104    fContainer->SetOwner(isowner);
     105    fAutodelete->SetOwner(!isowner);
    93106
    94107    delete fContainer;
     
    113126void MParList::SetLogStream(MLog *log)
    114127{
    115     TIter Next(fContainer);
    116 
    117     MParContainer *cont=NULL;
    118 
    119     //
    120     // loop over all tasks for preproccesing
    121     //
    122     while ( (cont=(MParContainer*)Next()) )
    123         cont->SetLogStream(log);
    124 
     128    fContainer->ForEach(MParContainer, SetLogStream)(log);
    125129    MParContainer::SetLogStream(log);
    126130}
     
    209213    MParContainer *cont = NULL;
    210214    while ((cont=(MParContainer*)Next()))
    211     {
    212215        AddToList(cont);
    213 /*        //
    214         // Get Name of new container
    215         //
    216         const char *name = cont->GetName();
    217 
    218         //
    219         // Check if the new container is already existing in the list
    220         //
    221         const TObject *objn = fContainer->FindObject(name);
    222         const TObject *objt = fContainer->FindObject(cont);
    223 
    224         if (objn || objt)
    225         {
    226             //
    227             // If the container is already in the list ignore it.
    228             //
    229             if (objt || objn==cont)
    230             {
    231                 *fLog << dbginf << "Warning: Container '" << cont->GetName() << ", 0x" << (void*)cont;
    232                 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl;
    233                 continue;
    234             }
    235 
    236             //
    237             // Otherwise add it to the list, but print a warning message
    238             //
    239             *fLog << dbginf << "Warning: Container with the same name '" << cont->GetName();
    240             *fLog << "' already existing in '" << GetName() << "'." << endl;
    241             *fLog << "You may not be able to get a pointer to container task by name." << endl;
    242         }
    243 
    244         *fLog << "Adding " << name << " to " << GetName() << "... " << flush;
    245 
    246         fContainer->Add(cont);
    247 
    248         *fLog << "Done." << endl;*/
    249     }
    250216}
    251217
     
    426392void MParList::SetReadyToSave(Bool_t flag)
    427393{
    428     TIter Next(fContainer);
    429 
    430     MParContainer *cont=NULL;
    431 
    432     //
    433     // loop over all tasks for preproccesing
    434     //
    435     while ( (cont=(MParContainer*)Next()) )
    436         cont->SetReadyToSave(flag);
    437 
     394    fContainer->ForEach(MParContainer, SetReadyToSave)(flag);
    438395    MParContainer::SetReadyToSave(flag);
    439396}
     
    445402void MParList::Reset()
    446403{
    447     TIter Next(fContainer);
    448 
    449     MParContainer *cont=NULL;
    450 
    451     //
    452     // loop over all tasks for preproccesing
    453     //
    454     while ((cont=(MParContainer*)Next()))
    455         cont->Reset();
     404    fContainer->ForEach(MParContainer, Reset)();
    456405}
    457406
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1006 r1023  
    113113void MTaskList::SetLogStream(MLog *log)
    114114{
    115     //
    116     // create the Iterator over the tasklist
    117     //
    118     TIter Next(fTasks);
    119 
    120     MTask *task=NULL;
    121 
    122     //
    123     // loop over all tasks for preproccesing
    124     //
    125     while ((task=(MTask*)Next()))
    126         task->SetLogStream(log);
    127 
     115    fTasks->ForEach(MTask, SetLogStream)(log);
    128116    MParContainer::SetLogStream(log);
    129117}
     
    383371    //  create the Iterator for the TaskList
    384372    //
    385     TIter Next(fTasks);
    386 
    387     MTask *task=NULL;
    388     //
    389     //  loop over all tasks for postprocessing
    390     //  only tasks which have successfully been preprocessed are postprocessed.
    391     //
    392     while ( (task=(MTask*)Next()) )
    393         task->PrintStatistics(lvl+1);
     373    fTasks->ForEach(MTask, PrintStatistics)(lvl+1);
    394374
    395375    if (lvl==0)
Note: See TracChangeset for help on using the changeset viewer.