00001 // @(#)root/base:$Id: TTask.h 31784 2009-12-10 13:47:29Z brun $ 00002 // Author: Rene Brun 02/09/2000 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TTask 00013 #define ROOT_TTask 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TTask // 00019 // // 00020 // Base class for recursive execution of tasks. // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 #ifndef ROOT_TNamed 00025 #include "TNamed.h" 00026 #endif 00027 #ifndef ROOT_TList 00028 #include "TList.h" 00029 #endif 00030 00031 class TBrowser; 00032 00033 00034 class TTask : public TNamed { 00035 00036 protected: 00037 TList *fTasks; //List of Tasks 00038 TString fOption; //Option specified in ExecuteTask 00039 Int_t fBreakin; //=1 if a break point set at task extry 00040 Int_t fBreakout; //=1 if a break point set at task exit 00041 Bool_t fHasExecuted; //True if task has executed 00042 Bool_t fActive; //true if task is active 00043 00044 static TTask *fgBeginTask; //pointer to task initiator 00045 static TTask *fgBreakPoint; //pointer to current break point 00046 00047 private: 00048 00049 public: 00050 TTask(); 00051 TTask(const char* name, const char *title); 00052 virtual ~TTask(); 00053 TTask(const TTask &task); 00054 TTask& operator=(const TTask& tt); 00055 00056 virtual void Abort(); // *MENU* 00057 virtual void Add(TTask *task) {fTasks->Add(task);} 00058 virtual void Browse(TBrowser *b); 00059 virtual void CleanTasks(); 00060 virtual void Clear(Option_t *option=""); 00061 virtual void Continue(); // *MENU* 00062 virtual void Exec(Option_t *option); 00063 virtual void ExecuteTask(Option_t *option="0"); // *MENU* 00064 virtual void ExecuteTasks(Option_t *option); 00065 Int_t GetBreakin() const { return fBreakin; } 00066 Int_t GetBreakout() const { return fBreakout; } 00067 Bool_t IsActive() const { return fActive; } 00068 Bool_t IsFolder() const { return kTRUE; } 00069 virtual void ls(Option_t *option="*") const; // *MENU* 00070 void SetActive(Bool_t active=kTRUE) { fActive = active; } // *TOGGLE* 00071 void SetBreakin(Int_t breakin=1) { fBreakin = breakin; } // *TOGGLE* 00072 void SetBreakout(Int_t breakout=1) { fBreakout = breakout; } // *TOGGLE* 00073 TList *GetListOfTasks() const { return fTasks; } 00074 00075 ClassDef(TTask,1) //Base class for tasks 00076 }; 00077 00078 #endif