Logo ROOT   6.12/07
Reference Guide
TProofMonSender.cxx
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: G.Ganis July 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 
13 /** \class TProofMonSender
14 \ingroup proofkernel
15 
16 Provides the interface for PROOF monitoring to different writers.
17 Allows to decouple the information sent from the backend.
18 
19 */
20 
21 #include "TProofDebug.h"
22 #include "TProofMonSender.h"
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Parse send options from string 'sendopts'.
26 /// Format is:
27 /// "[-,+]S[n]|[-,+]D[m]|[-,+]F[j]"
28 /// where:
29 /// 1. The big letter refers to the 'table' following
30 ///
31 /// S table with summary log
32 /// D table with dataset info
33 /// F table files info
34 ///
35 /// 2. The '-,+' in front disables/enables the related table; if
36 /// absent '+' is assumed
37 ///
38 /// 3. The number after the letter is the version of the related
39 /// table
40 ///
41 /// Returns -1 if nothing is enabled; 0 otherwise
42 
44 {
45 
46  // Must have something to parse
47  if (sendopts && strlen(sendopts) > 0) {
48 
49  PDB(kMonitoring,1) Info("SetSendOptions", "sendopts: '%s'", sendopts);
50 
51  Bool_t doit = kTRUE;
52  Char_t t = 0;
53  Int_t v = -1;
54  TString oos(sendopts), oo;
55  Ssiz_t from = 0;
56  while (oos.Tokenize(oo, from, ":")) {
57  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s'", oo.Data());
58  // Parse info
59  doit = kTRUE;
60  if (oo.BeginsWith("+")) oo.Remove(0,1);
61  if (oo.BeginsWith("-")) { doit = kFALSE; oo.Remove(0,1); }
62  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d", oo.Data(), doit);
63  t = oo[0];
64  oo.Remove(0,1);
65  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d t:'%c'", oo.Data(), doit, t);
66  v = -1;
67  if (!oo.IsNull() && oo.IsDigit()) v = oo.Atoi();
68  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d t:'%c' v:%d", oo.Data(), doit, t, v);
69  // Fill relevant variables
71  if (t == 'D') cbit = kSendDataSetInfo;
72  if (t == 'F') cbit = kSendFileInfo;
73  if (doit)
74  SetBit(cbit);
75  else
76  ResetBit(cbit);
77  if (v > -1) {
78  if (t == 'S') fSummaryVrs = v;
79  if (t == 'D') fDataSetInfoVrs = v;
80  if (t == 'F') fFileInfoVrs = v;
81  }
82  }
83  }
84 
85  // Something must be enabled
87  Warning("SetSendOptions", "all tables are disabled!");
88  return -1;
89  }
90 
91  // Notify
92  TString snot = TString::Format("%s: sending:", GetTitle());
93  if (TestBit(kSendSummary)) snot += TString::Format(" 'summary' (v:%d)", fSummaryVrs);
94  if (TestBit(kSendDataSetInfo)) snot += TString::Format(" 'dataset info' (v:%d)", fDataSetInfoVrs);
95  if (TestBit(kSendFileInfo)) snot += TString::Format(" 'file info' (v:%d)", fFileInfoVrs);
96  Info("SetSendOptions", "%s", snot.Data());
97 
98  // Done
99  return 0;
100 }
101 
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
Int_t SetSendOptions(const char *)
Parse send options from string 'sendopts'.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2365
#define PDB(mask, level)
Definition: TProofDebug.h:56
SVector< double, 2 > v
Definition: Dict.h:5
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:561
const Bool_t kFALSE
Definition: RtypesCore.h:88
TString & Remove(Ssiz_t pos)
Definition: TString.h:619
int Ssiz_t
Definition: RtypesCore.h:63
Bool_t IsNull() const
Definition: TString.h:383
char Char_t
Definition: RtypesCore.h:29
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1975
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1817
void ResetBit(UInt_t f)
Definition: TObject.h:171
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
const char * Data() const
Definition: TString.h:345