TProofLog.h

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TProofLog.h 28808 2009-06-04 14:18:34Z ganis $
00002 // Author: G. Ganis   31/08/06
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, 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_TProofLog
00013 #define ROOT_TProofLog
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TProofLog                                                            //
00018 //                                                                      //
00019 // Implementation of the PROOF session log handler                      //
00020 //                                                                      //
00021 //////////////////////////////////////////////////////////////////////////
00022 
00023 #ifndef ROOT_TDatime
00024 #include "TDatime.h"
00025 #endif
00026 #ifndef ROOT_TNamed
00027 #include "TNamed.h"
00028 #endif
00029 #ifndef ROOT_TQObject
00030 #include "TQObject.h"
00031 #endif
00032 
00033 class TMacro;
00034 class TProofLogElem;
00035 class TProofMgr;
00036 
00037 
00038 class TProofLog : public TNamed, public TQObject {
00039 
00040 friend class TProofLogElem;
00041 friend class TProofMgrLite;
00042 friend class TXProofMgr;
00043 
00044 private:
00045    TProofMgr  *fMgr;   // parent TProofMgr
00046    void       *fFILE;  // pointer logging file, if any
00047    TList      *fElem;  // list of TProofLogElem objects
00048    TDatime     fStartTime; // Time at which this session started
00049 
00050    TProofLogElem *Add(const char *ord, const char *url);
00051 
00052 public:
00053    // Screen or GUI box logging
00054    enum ELogLocationBit {
00055       kLogToBox = BIT(16)
00056    };
00057    enum ERetrieveOpt   { kLeading = 0x1, kTrailing = 0x2,
00058                          kAll = 0x3, kGrep = 0x4 };
00059 
00060    TProofLog(const char *stag, const char *url, TProofMgr *mgr);
00061    virtual ~TProofLog();
00062 
00063    void   Display(const char *ord = "*", Int_t from = -10, Int_t to = -1);
00064    TList *GetListOfLogs() const { return fElem; }
00065    Int_t  Grep(const char *txt, Int_t from = 0);
00066    void   Print(Option_t *opt = 0) const;
00067    void   Prt(const char *what);
00068    Int_t  Retrieve(const char *ord = "*",
00069                   TProofLog::ERetrieveOpt opt = TProofLog::kTrailing,
00070                   const char *fname = 0, const char *pattern = 0);
00071    Int_t  Save(const char *ord = "*", const char *fname = 0, Option_t *opt="w");
00072 
00073    TDatime StartTime() { return fStartTime; }
00074 
00075    // Where to log
00076    void SetLogToBox(Bool_t lgbox = kFALSE) { SetBit(kLogToBox, lgbox); }
00077    Bool_t LogToBox() { return (TestBit(kLogToBox)) ? kTRUE : kFALSE; }
00078 
00079    static void SetMaxTransferSize(Long64_t maxsz);
00080 
00081    ClassDef(TProofLog,0)  // PROOF session log handler
00082 };
00083 
00084 
00085 class TProofLogElem : public TNamed {
00086 
00087 private:
00088    TProofLog *fLogger;  // parent TProofLog
00089    TMacro    *fMacro;   // container for the log lines
00090    Long64_t   fSize;    // best knowledge of the log file size
00091    Long64_t   fFrom;    // starting offset of the current content
00092    Long64_t   fTo;      // end offset of the current content
00093    TString    fRole;    // role (master-submaster-worker)
00094 
00095    static Long64_t fgMaxTransferSize;
00096 
00097    //the name of TProofLogElem is the ordinal number of the corresp. worker
00098    //the title is the url
00099 
00100 public:
00101    TProofLogElem(const char *ord, const char *url,
00102                  TProofLog *logger);
00103    virtual ~TProofLogElem();
00104 
00105    void    Display(Int_t from = 0, Int_t to = -1);
00106    TMacro *GetMacro() const { return fMacro; }
00107    const char *    GetRole() { return fRole.Data(); }
00108    Int_t   Grep(const char *txt, TString &res, Int_t from = 0);
00109    Bool_t  IsMaster() const { return (fRole == "master") ? kTRUE : kFALSE; }
00110    Bool_t  IsSubMaster() const { return (fRole == "submaster") ? kTRUE : kFALSE; }
00111    Bool_t  IsWorker() const { return (fRole == "worker") ? kTRUE : kFALSE; }
00112    void    Print(Option_t *opt = 0) const;
00113    void    Prt(const char *what);
00114    Int_t   Retrieve(TProofLog::ERetrieveOpt opt = TProofLog::kTrailing,
00115                     const char *pattern = 0);
00116 
00117    static Long64_t GetMaxTransferSize();
00118    static void     SetMaxTransferSize(Long64_t maxsz);
00119 
00120    ClassDef(TProofLogElem,0)  // PROOF session log element
00121 };
00122 
00123 #endif

Generated on Tue Jul 5 14:28:01 2011 for ROOT_528-00b_version by  doxygen 1.5.1