Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TProofLog.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id: 5d579564fccbadad9cd6f81ccb7726dddea80e0d $
2 // Author: G. Ganis 31/08/06
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TProofLog
13 #define ROOT_TProofLog
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TProofLog //
18 // //
19 // Implementation of the PROOF session log handler //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TDatime.h"
24 #include "TNamed.h"
25 #include "TQObject.h"
26 
27 class TMacro;
28 class TProofLogElem;
29 class TProofMgr;
30 
31 
32 class TProofLog : public TNamed, public TQObject {
33 
34 friend class TProofLogElem;
35 friend class TProofMgrLite;
36 friend class TXProofMgr;
37 
38 private:
39  TProofMgr *fMgr; // parent TProofMgr
40  void *fFILE; // pointer logging file, if any
41  TList *fElem; // list of TProofLogElem objects
42  TDatime fStartTime; // Time at which this session started
43 
44  TProofLogElem *Add(const char *ord, const char *url);
45 
46 public:
47  // Screen or GUI box logging
48  enum ELogLocationBit {
49  kLogToBox = BIT(16)
50  };
51  enum ERetrieveOpt { kLeading = 0x1, kTrailing = 0x2,
52  kAll = 0x3, kGrep = 0x4 };
53 
54  TProofLog(const char *stag, const char *url, TProofMgr *mgr);
55  virtual ~TProofLog();
56 
57  void Display(const char *ord = "*", Int_t from = -10, Int_t to = -1);
58  TList *GetListOfLogs() const { return fElem; }
59  Int_t Grep(const char *txt, Int_t from = 0);
60  void Print(Option_t *opt = 0) const;
61  void Prt(const char *what, Bool_t newline = kTRUE);
62  Int_t Retrieve(const char *ord = "*",
63  TProofLog::ERetrieveOpt opt = TProofLog::kTrailing,
64  const char *fname = 0, const char *pattern = 0);
65  Int_t Save(const char *ord = "*", const char *fname = 0, Option_t *opt="w");
66 
67  TDatime StartTime() { return fStartTime; }
68 
69  // Where to log
70  void SetLogToBox(Bool_t lgbox = kFALSE) { SetBit(kLogToBox, lgbox); }
71  Bool_t LogToBox() { return (TestBit(kLogToBox)) ? kTRUE : kFALSE; }
72 
73  static void SetMaxTransferSize(Long64_t maxsz);
74 
75  ClassDef(TProofLog,0) // PROOF session log handler
76 };
77 
78 
79 class TProofLogElem : public TNamed {
80 
81 private:
82  TProofLog *fLogger; // parent TProofLog
83  TMacro *fMacro; // container for the log lines
84  Long64_t fSize; // best knowledge of the log file size
85  Long64_t fFrom; // starting offset of the current content
86  Long64_t fTo; // end offset of the current content
87  TString fRole; // role (master-submaster-worker)
88 
89  static Long64_t fgMaxTransferSize;
90 
91  //the name of TProofLogElem is the ordinal number of the corresp. worker
92  //the title is the url
93 
94 public:
95  TProofLogElem(const char *ord, const char *url,
96  TProofLog *logger);
97  virtual ~TProofLogElem();
98 
99  void Display(Int_t from = 0, Int_t to = -1);
100  TMacro *GetMacro() const { return fMacro; }
101  const char * GetRole() { return fRole.Data(); }
102  Int_t Grep(const char *txt, TString &res, Int_t from = 0);
103  Bool_t IsMaster() const { return (fRole == "master") ? kTRUE : kFALSE; }
104  Bool_t IsSubMaster() const { return (fRole == "submaster") ? kTRUE : kFALSE; }
105  Bool_t IsWorker() const { return (fRole == "worker") ? kTRUE : kFALSE; }
106  void Print(Option_t *opt = 0) const;
107  void Prt(const char *what);
108  Int_t Retrieve(TProofLog::ERetrieveOpt opt = TProofLog::kTrailing,
109  const char *pattern = 0);
110 
111  static Long64_t GetMaxTransferSize();
112  static void SetMaxTransferSize(Long64_t maxsz);
113 
114  ClassDef(TProofLogElem,0) // PROOF session log element
115 };
116 
117 #endif