Logo ROOT  
Reference Guide
TStatus.h
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Maarten Ballintijn 12/03/2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TStatus
13 #define ROOT_TStatus
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TStatus //
18 // //
19 // This class holds the status of a ongoing operation and collects //
20 // error messages. It provides a Merge() operation allowing it to //
21 // be used in PROOF to monitor status in the slaves. //
22 // No messages indicates success. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "TNamed.h"
27 #include "THashList.h"
28 
29 #include <set>
30 #include <string>
31 
32 class TStatus : public TNamed {
33 
34 public:
35  enum EProcStatus {
36  kNotOk = BIT(15) // True if status of things are not OK
37  };
38 
39 private:
40  TList fMsgs; // list of error messages
41  TIter fIter; //!iterator in messages
42  THashList fInfoMsgs; // list of info messages
43 
44  Int_t fExitStatus; // Query exit status ((Int_t)TVirtualProofPlayer::EExitStatus or -1);
45  Long_t fVirtMemMax; // Max virtual memory used by the worker
46  Long_t fResMemMax; // Max resident memory used by the worker
47  Long_t fVirtMaxMst; // Max virtual memory used by the master
48  Long_t fResMaxMst; // Max resident memory used by the master
49 
50 public:
51  TStatus();
52  virtual ~TStatus() { }
53 
54  inline Bool_t IsOk() const { return TestBit(kNotOk) ? kFALSE : kTRUE; }
55  void Add(const char *mesg);
56  void AddInfo(const char *mesg);
57  virtual Int_t Merge(TCollection *list);
58  virtual void Print(Option_t *option="") const;
59  void Reset();
60  const char *NextMesg();
61 
62  Int_t GetExitStatus() const { return fExitStatus; }
63  Long_t GetResMemMax(Bool_t master = kFALSE) const { return ((master) ? fResMaxMst : fResMemMax); }
64  Long_t GetVirtMemMax(Bool_t master = kFALSE) const { return ((master) ? fVirtMaxMst : fVirtMemMax); }
65 
66  void SetExitStatus(Int_t est) { fExitStatus = est; }
67  void SetMemValues(Long_t vmem = -1, Long_t rmem = -1, Bool_t master = kFALSE);
68 
69  ClassDef(TStatus,5); // Status class
70 };
71 
72 #endif
TStatus::~TStatus
virtual ~TStatus()
Definition: TStatus.h:52
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TStatus::Merge
virtual Int_t Merge(TCollection *list)
PROOF Merge() function.
Definition: TStatus.cxx:65
Option_t
const char Option_t
Definition: RtypesCore.h:66
TStatus::GetExitStatus
Int_t GetExitStatus() const
Definition: TStatus.h:62
TNamed.h
TStatus::TStatus
TStatus()
Default constructor.
Definition: TStatus.cxx:34
Int_t
int Int_t
Definition: RtypesCore.h:45
TStatus::Print
virtual void Print(Option_t *option="") const
Standard print function.
Definition: TStatus.cxx:110
TStatus::fInfoMsgs
THashList fInfoMsgs
iterator in messages
Definition: TStatus.h:42
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TStatus::NextMesg
const char * NextMesg()
Return the next message or 0.
Definition: TStatus.cxx:150
TStatus::AddInfo
void AddInfo(const char *mesg)
Add an info message.
Definition: TStatus.cxx:57
bool
TStatus::EProcStatus
EProcStatus
Definition: TStatus.h:35
TStatus::SetMemValues
void SetMemValues(Long_t vmem=-1, Long_t rmem=-1, Bool_t master=kFALSE)
Set max memory values.
Definition: TStatus.cxx:160
TStatus::Reset
void Reset()
Reset the iterator on the messages.
Definition: TStatus.cxx:142
TStatus
This class holds the status of an ongoing operation and collects error messages.
Definition: TStatus.h:32
THashList
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TStatus::kNotOk
@ kNotOk
Definition: TStatus.h:36
Long_t
long Long_t
Definition: RtypesCore.h:54
TStatus::fIter
TIter fIter
Definition: TStatus.h:41
TStatus::Add
void Add(const char *mesg)
Add an error message.
Definition: TStatus.cxx:47
TStatus::GetResMemMax
Long_t GetResMemMax(Bool_t master=kFALSE) const
Definition: TStatus.h:63
TStatus::fResMemMax
Long_t fResMemMax
Definition: TStatus.h:46
BIT
#define BIT(n)
Definition: Rtypes.h:85
TStatus::fResMaxMst
Long_t fResMaxMst
Definition: TStatus.h:48
TStatus::fExitStatus
Int_t fExitStatus
Definition: TStatus.h:44
THashList.h
TStatus::fVirtMaxMst
Long_t fVirtMaxMst
Definition: TStatus.h:47
TStatus::IsOk
Bool_t IsOk() const
Definition: TStatus.h:54
TStatus::SetExitStatus
void SetExitStatus(Int_t est)
Definition: TStatus.h:66
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TIter
Definition: TCollection.h:233
TStatus::fMsgs
TList fMsgs
Definition: TStatus.h:40
TCollection
Collection abstract base class.
Definition: TCollection.h:63
TStatus::fVirtMemMax
Long_t fVirtMemMax
Definition: TStatus.h:45
TList
A doubly linked list.
Definition: TList.h:44
TStatus::GetVirtMemMax
Long_t GetVirtMemMax(Bool_t master=kFALSE) const
Definition: TStatus.h:64
int