Ignore:
Timestamp:
06/28/07 21:30:25 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

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

    r7808 r8618  
    8989// this name in the parameter list (by MEvtLoop::SetParList)
    9090//
    91 MTaskList::MTaskList(const char *name, const char *title)
     91MTaskList::MTaskList(const char *name, const char *title) : fNumPasses(0), fNumPass(0)
    9292{
    9393    fName  = name  ? name  : gsDefName.Data();
     
    108108//   TaskList in the new TaskList.
    109109//
    110 MTaskList::MTaskList(MTaskList &ts) : MTask()
     110MTaskList::MTaskList(const MTaskList &ts) : MTask(), fNumPasses(ts.fNumPasses)
    111111{
    112112    fTasks->AddAll(ts.fTasks);
     
    612612}
    613613
    614 // --------------------------------------------------------------------------
    615 //
    616 // do the event execution of all tasks in the task-list
    617 //
    618 Int_t MTaskList::Process()
    619 {
    620     //
    621     // Check whether there is something which can be processed, otherwise
    622     // stop the eventloop.
    623     //
    624     if (fTasksProcess.GetSize()==0)
    625     {
    626         *fLog << warn << "Warning: No entries in " << GetDescriptor() << " for Processing." << endl;
    627         return kFALSE;
    628     }
    629 
    630     //
    631     // Reset the ReadyToSave flag.
    632     // Reset all containers.
    633     //
    634     // Make sure, that the parameter list is not reset from a tasklist
    635     // running as a task in another tasklist.
    636     //
    637     const Bool_t noreset = fParList->TestBit(MParList::kIsProcessing);
    638     if (!noreset)
    639     {
    640         fParList->SetBit(MParList::kIsProcessing);
    641         if (!HasAccelerator(kAccDontReset))
    642             fParList->Reset();
    643     }
    644 
     614Int_t MTaskList::ProcessTaskList()
     615{
    645616    //
    646617    //  create the Iterator for the TaskList
     
    707678    }
    708679
     680    return rc;
     681}
     682
     683// --------------------------------------------------------------------------
     684//
     685// do the event execution of all tasks in the task-list.
     686//
     687// If a task returns kCONTINUE, kCONTINUE is propagated if the
     688// number of passes==0, otherwise kTRUE is returned instead.
     689//
     690Int_t MTaskList::Process()
     691{
     692    //
     693    // Check whether there is something which can be processed, otherwise
     694    // stop the eventloop.
     695    //
     696    if (fTasksProcess.GetSize()==0)
     697    {
     698        *fLog << warn << "Warning: No entries in " << GetDescriptor() << " for Processing." << endl;
     699        return kFALSE;
     700    }
     701
     702    //
     703    // Reset the ReadyToSave flag.
     704    // Reset all containers.
     705    //
     706    // Make sure, that the parameter list is not reset from a tasklist
     707    // running as a task in another tasklist.
     708    //
     709    const Bool_t noreset = fParList->TestBit(MParList::kIsProcessing);
     710    if (!noreset)
     711    {
     712        fParList->SetBit(MParList::kIsProcessing);
     713        if (!HasAccelerator(kAccDontReset))
     714            fParList->Reset();
     715    }
     716
     717    // Initialize storage variable for the return code
     718    Int_t rc = kTRUE;
     719
     720    // Execute the task list at least once
     721    const UInt_t cnt = fNumPasses==0 ? 1 : fNumPasses;
     722    for (fNumPass=0; fNumPass<cnt; fNumPass++)
     723    {
     724        // Execute the tasklist once
     725        rc = ProcessTaskList();
     726        // In cae of error or a stop-request leave loop
     727        if (rc==kERROR || rc==kFALSE)
     728            break;
     729    }
     730
     731    // Reset to the default
    709732    if (!noreset)
    710733    {
     
    713736    }
    714737
     738    // If the number of passes==0 <default> propagete kCONTINUE
     739    if (rc==kCONTINUE)
     740        return fNumPasses==0 ? kCONTINUE : kTRUE;
     741
     742    // Return return code
    715743    return rc;
    716744}
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r7808 r8618  
    2828    MParList *fParList;      //! The parameter list given in PreProcess
    2929
     30    UInt_t fNumPasses;
     31    UInt_t fNumPass; //!
     32
    3033    enum { kIsOwner = BIT(14) };
    3134
     
    3336    void   StreamPrimitive(ostream &out) const;
    3437    Bool_t CheckAddToList(MTask *task, /*const char *tType,*/ const MTask *where=NULL) const;
     38    Int_t  ProcessTaskList();
    3539
    3640public:
    3741    MTaskList(const char *name=NULL, const char *title=NULL);
    38     MTaskList(MTaskList &ts);
     42    MTaskList(const MTaskList &ts);
    3943
    4044    ~MTaskList();
     
    4347    void SetDisplay(MStatusDisplay *d);
    4448    void SetAccelerator(Byte_t acc=kAccStandard);
     49    void SetNumPasses(UInt_t cnt=0) { fNumPasses=cnt; }
     50
     51    UInt_t GetNumPass() const { return fNumPass; }
     52    UInt_t GetNumPasses() const { return fNumPasses; }
    4553
    4654    Bool_t AddToListBefore(MTask *task, const MTask *where, const char *tType="All");
Note: See TracChangeset for help on using the changeset viewer.