Ignore:
Timestamp:
07/18/07 20:30:13 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
11 edited

Legend:

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

    r7808 r8642  
    131131        }
    132132
    133         *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;
    134         return kFALSE;
     133        *fLog << inf << "My filter has vanished... skipping." << endl;
     134        return kSKIP;
    135135    }
    136136
     
    153153    if (!fTaskList->AddToListBefore(GetFilter(), this))
    154154    {
    155         *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl;
     155        *fLog << err << dbginf << "ERROR - Adding filter before MContinue failed... abort." << endl;
    156156        return kFALSE;
    157157    }
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r8011 r8642  
    102102// default constructor
    103103//
    104 MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fProgress(NULL)
     104MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fTaskList(NULL), fProgress(NULL)
    105105{
    106106    fName = name;
     
    11081108void MEvtLoop::RecursiveRemove(TObject *obj)
    11091109{
     1110    // If the tasklist was deleted... remove it
     1111    if (obj==fTaskList)
     1112        fTaskList = NULL;
     1113
     1114    // If the parlist was deleted...invalidate par- and tasklist
    11101115    if (obj==fParList)
    11111116    {
     
    11141119    }
    11151120
     1121    // if the progress bar was deleted...remove it
    11161122    if (obj==fProgress)
    11171123        fProgress = NULL;
    11181124
    1119     if (obj==fDisplay)
    1120         SetDisplay(NULL);
    1121 
    1122     if (obj==fLog)
    1123     {
    1124         if (fParList)
    1125             fParList->SetLogStream(NULL);
    1126         SetLogStream(NULL);
    1127     }
    1128 }
     1125    // If it was something else check par- and tasklist
     1126    if (fParList)
     1127        fParList->RecursiveRemove(obj);
     1128    else
     1129        if (fTaskList) // Note that the tasklist is included in the parlist
     1130            fTaskList->RecursiveRemove(obj);
     1131
     1132    // Now check for fDisplay and fLog
     1133    MParContainer::RecursiveRemove(obj);
     1134}
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r8218 r8642  
    7171#include "MLogManip.h"
    7272
     73#include "MStatusDisplay.h"
     74
    7375TList *gListOfPrimitives; // forard declaration in MParContainer.h
    7476
     
    116118        return;
    117119
    118     *fLog << all << "Deleting " << GetDescriptor() << endl;
     120    *fLog << all << "Deleting " << this << " " << GetDescriptor() << endl;
    119121    if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean())
    120122    {
     
    921923    return ((TEnv&)env).GetValue(prefix, dflt);
    922924}
     925
     926// --------------------------------------------------------------------------
     927//
     928// If object to remove is fDisplay set fDisplay to NULL.
     929// If object to remove is fLog     set fLog     to NULL.
     930// Call TObject::RecursiveRemove
     931//
     932void MParContainer::RecursiveRemove(TObject *obj)
     933{
     934    if (obj==fDisplay)
     935        fDisplay=NULL;
     936
     937    if (obj==fLog)
     938        fLog=NULL;
     939
     940    if (fDisplay)
     941        fDisplay->RecursiveRemove(obj);
     942
     943    if (fLog)
     944        fLog->RecursiveRemove(obj);
     945
     946    TObject::RecursiveRemove(obj);
     947}
     948
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r7804 r8642  
    146146    MParContainer *GetNewObject(const char *name, TClass *base=MParContainer::Class()) const;
    147147
     148    void RecursiveRemove(TObject *obj);
     149
    148150    ClassDef(MParContainer, 0)  //The basis for all parameter containers
    149151};
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r8218 r8642  
    312312
    313313    TObject *obj = fContainer->Remove(cont);
    314     if (!obj)
    315     {
    316         *fLog << warn << "Object not found in list..." << endl;
    317         return;
    318     }
    319 
    320     *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
    321 
    322     if (IsOwner() && !fAutodelete->FindObject(obj))
     314
     315    fContainer->RecursiveRemove(obj);
     316
     317    // if (!obj)
     318    // {
     319        //        *fLog << warn << "Object not found in list..." << endl;
     320    //    return;
     321    //}
     322
     323//    *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
     324
     325    if (obj && IsOwner() && !fAutodelete->FindObject(obj))
    323326        delete obj;
     327}
     328
     329// --------------------------------------------------------------------------
     330//
     331// Call MParContainer::RecursiveRemove
     332// Call fContainer->RecursiveRemove
     333//
     334void MParList::RecursiveRemove(TObject *obj)
     335{
     336    MParContainer::RecursiveRemove(obj);
     337
     338    if (obj==fContainer)
     339        fContainer = NULL;
     340
     341    if (fContainer)
     342        fContainer->RecursiveRemove(obj);
    324343}
    325344
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r7804 r8642  
    8686    }
    8787
     88    void RecursiveRemove(TObject *obj);
     89
    8890    void Reset();
    8991    void SetReadyToSave(Bool_t flag=kTRUE);
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.h

    r7827 r8642  
    6666        kPicMagic, kPicMars,
    6767        // kGui
    68         kSearch, kTabs
     68        kSearch, kTabs,
     69        // kLastElement
     70        kLastElement
    6971    } Status_t;
    7072
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r8426 r8642  
    147147{
    148148    fFilter=filter;
    149     if (filter)
    150         AddToBranchList(filter->GetDataMember());
     149    if (!filter)
     150        return;
     151
     152    fFilter->SetBit(kMustCleanup);    // Better is better ;-)
     153    AddToBranchList(filter->GetDataMember());
    151154}
    152155
     
    557560    *fLog << "%) Evts skipped: " << str << endl;
    558561}
     562
     563// --------------------------------------------------------------------------
     564//
     565// If obj==fFilter set fFilter to NULL
     566// Call MParcontainer::RecursiveRemove
     567//
     568void MTask::RecursiveRemove(TObject *obj)
     569{
     570    if (obj==fFilter)
     571        fFilter=NULL;
     572
     573    if (fFilter)
     574        fFilter->RecursiveRemove(obj);
     575
     576    MParContainer::RecursiveRemove(obj);
     577}
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r7804 r8642  
    123123    void SavePrimitive(ofstream &out, Option_t *o="");
    124124
     125    // TObject
     126    void RecursiveRemove(TObject *obj);
     127
    125128    ClassDef(MTask, 2) //Abstract base class for a task
    126129};
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r8618 r8642  
    1818!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2007
    2121!
    2222!
     
    8080using namespace std;
    8181
     82//#define DEBUG_PROCESS
     83#undef DEBUG_PROCESS
     84
    8285const TString MTaskList::gsDefName  = "MTaskList";
    8386const TString MTaskList::gsDefTitle = "A list for tasks to be executed";
     
    8992// this name in the parameter list (by MEvtLoop::SetParList)
    9093//
    91 MTaskList::MTaskList(const char *name, const char *title) : fNumPasses(0), fNumPass(0)
     94MTaskList::MTaskList(const char *name, const char *title) : fTasks(0), fParList(0), fNumPasses(0), fNumPass(0)
    9295{
    9396    fName  = name  ? name  : gsDefName.Data();
     
    465468void MTaskList::Remove(MTask *task)
    466469{
     470    if (!task)
     471        return;
     472
     473    // First remove it from the list(s) so that a later RecursiveRemove
     474    // cannot fint the task again
    467475    TObject *obj = fTasks->Remove(task);
    468476
    469     if (TestBit(kIsOwner))
     477    // Now do a recursive remove on all other tasks.
     478    fTasks->RecursiveRemove(task);
     479
     480    if (obj && TestBit(kIsOwner))
    470481        delete obj;
     482}
     483
     484// --------------------------------------------------------------------------
     485//
     486// Call MTask::RecursiveRemove
     487// Call fTasks->RecursiveRemove
     488//
     489void MTaskList::RecursiveRemove(TObject *obj)
     490{
     491    MTask::RecursiveRemove(obj);
     492
     493    if (obj==fTasks)
     494        fTasks=NULL;
     495
     496    if (fTasks)
     497    {
     498        fTasks->RecursiveRemove(obj);
     499
     500        // In theory this call is obsolete
     501        fTasksProcess.RecursiveRemove(obj);
     502    }
    471503}
    472504
     
    620652    MTask *task=NULL;
    621653
     654#ifdef DEBUG_PROCESS
     655    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - start." << endl;
     656#endif
     657
    622658    //
    623659    // loop over all tasks for processing
     
    626662    while ( (task=(MTask*)Next()) )
    627663    {
     664#ifdef DEBUG_PROCESS
     665        *fLog << all << "Process - " << (void*)task << " " << flush;
     666        *fLog << task->GetDescriptor() << "... " << flush;
     667#endif
    628668        //
    629669        // if the task has the wrong stream id skip it.
     
    646686            // everything was OK: go on with the next task
    647687            //
     688#ifdef DEBUG_PROCESS
     689            *fLog << "true." << endl;
     690#endif
    648691            continue;
    649692
     
    668711            // something occured: skip the rest of the tasks for this event
    669712            //
     713#ifdef DEBUG_PROCESS
     714            *fLog << "continue." << endl;
     715#endif
    670716            rc = kCONTINUE;
    671717            break;
     
    677723        break;
    678724    }
     725
     726#ifdef DEBUG_PROCESS
     727    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - done." << endl;
     728#endif
    679729
    680730    return rc;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r8618 r8642  
    9797    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
    9898
     99    void   RecursiveRemove(TObject *obj);
     100
    99101    operator TIterator*() const;
    100102
Note: See TracChangeset for help on using the changeset viewer.