Ignore:
Timestamp:
11/21/02 15:04:04 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r1574 r1661  
    6565    virtual ~MTask();
    6666
    67     void SetFilter(MFilter *filter) { fFilter=filter; }
     67    virtual void SetFilter(MFilter *filter) { fFilter=filter; }
    6868    const MFilter *GetFilter() const      { return fFilter; }
     69    MFilter *GetFilter()  { return fFilter; } // for MContinue only
    6970    virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
    7071
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1657 r1661  
    135135}
    136136
    137 
    138 // --------------------------------------------------------------------------
    139 //
    140 // schedule task for execution, whether as first task, or after
    141 // 'where'. 'tType' is the event type which should be processed
    142 //
    143 Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where)
    144 {
    145     // FIXME: We agreed to put the task into list in an ordered way.
    146 
     137Bool_t MTaskList::CheckAddToList(MTask *task, const char *type, const MTask *where) const
     138{
    147139    //
    148140    // Sanity check
     
    182174    }
    183175
    184     if (where)
    185     {
    186         if (!fTasks->FindObject(where))
    187         {
    188             *fLog << err << dbginf << "Error: Cannot find task after which the new task should be scheduled!" << endl;
    189             return kFALSE;
    190         }
    191     }
    192 
    193     *fLog << inf << "Adding " << name << " to " << GetName() << " for " << type << "... " << flush;
    194 
     176    if (!where)
     177        return kTRUE;
     178
     179    if (fTasks->FindObject(where))
     180        return kTRUE;
     181
     182    *fLog << err << dbginf << "Error: Cannot find task after which the new task should be scheduled!" << endl;
     183    return kFALSE;
     184}
     185
     186
     187// --------------------------------------------------------------------------
     188//
     189// schedule task for execution, before 'where'.
     190// 'type' is the event type which should be processed
     191//
     192Bool_t MTaskList::AddToListBefore(MTask *task, const MTask *where, const char *type)
     193{
     194    // FIXME: We agreed to put the task into list in an ordered way.
     195    if (!CheckAddToList(task, type, where))
     196        return kFALSE;
     197
     198    *fLog << inf << "Adding " << task->GetName() << " to " << GetName() << " for " << type << "... " << flush;
     199    task->SetStreamId(type);
     200    fTasks->AddBefore((TObject*)where, task);
     201    *fLog << "Done." << endl;
     202
     203    return kTRUE;
     204}
     205
     206// --------------------------------------------------------------------------
     207//
     208// schedule task for execution, after 'where'.
     209// 'type' is the event type which should be processed
     210//
     211Bool_t MTaskList::AddToListAfter(MTask *task, const MTask *where, const char *type)
     212{
     213    // FIXME: We agreed to put the task into list in an ordered way.
     214
     215    if (!CheckAddToList(task, type, where))
     216        return kFALSE;
     217
     218    *fLog << inf << "Adding " << task->GetName() << " to " << GetName() << " for " << type << "... " << flush;
     219    task->SetStreamId(type);
     220    fTasks->AddAfter((TObject*)where, task);
     221    *fLog << "Done." << endl;
     222
     223    return kTRUE;
     224}
     225
     226// --------------------------------------------------------------------------
     227//
     228// schedule task for execution, 'type' is the event type which should
     229// be processed
     230//
     231Bool_t MTaskList::AddToList(MTask *task, const char *type)
     232{
     233    // FIXME: We agreed to put the task into list in an ordered way.
     234
     235    if (!CheckAddToList(task, type))
     236        return kFALSE;
     237
     238    *fLog << inf << "Adding " << task->GetName() << " to " << GetName() << " for " << type << "... " << flush;
    195239    task->SetStreamId(type);
    196240    fTasks->Add(task);
    197 
    198241    *fLog << "Done." << endl;
    199242
     
    325368        *fLog << all << task->GetName() << "... " << flush;
    326369
    327         if (CheckClassForProcess(task->IsA()))
    328             fTasksProcess.Add(task);
    329 
    330370        //
    331371        // PreProcess the task and check for it's return value.
     
    350390
    351391    *fLog << all << endl;
     392
     393    Next.Reset();
     394
     395    //
     396    // loop over all tasks for preproccesing
     397    //
     398    while ((task=(MTask*)Next()))
     399        if (CheckClassForProcess(task->IsA()))
     400            fTasksProcess.Add(task);
    352401
    353402    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r1540 r1661  
    3535    void StreamPrimitive(ofstream &out) const;
    3636
     37    Bool_t CheckAddToList(MTask *task, const char *tType, const MTask *where=NULL) const;
     38
    3739public:
    3840    MTaskList(const char *name=NULL, const char *title=NULL);
     
    4345    void SetLogStream(MLog *log);
    4446
    45     Bool_t AddToList(MTask *task, const char *tType="All", MTask *where = NULL);
     47    Bool_t AddToListBefore(MTask *task, const MTask *where, const char *tType="All");
     48    Bool_t AddToListAfter(MTask *task, const MTask *where, const char *tType="All");
     49    Bool_t AddToList(MTask *task, const char *tType="All");
    4650
    4751    TObject *FindObject(const char *name) const;
Note: See TracChangeset for help on using the changeset viewer.