Logo ROOT   6.14/05
Reference Guide
TProofOutputList.cxx
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: G. Ganis 04/08/2010
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 /** \class TProofOutputList
13 \ingroup proofkernel
14 
15 Derivation of TList with an overload of ls() and Print() allowing to filter
16 out some of the variables
17 
18 */
19 
20 #include "TObjString.h"
21 #include "TProof.h"
22 #include "TProofOutputList.h"
23 #include "TRegexp.h"
24 #include "TString.h"
25 
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// Constructor
30 
31 TProofOutputList::TProofOutputList(const char *dontshow) : TList()
32 {
33  fDontShow = new TList();
34  TString regs(dontshow), reg;
35  Int_t from = 0;
36  while (regs.Tokenize(reg, from, ",")) {
37  fDontShow->Add(new TObjString(reg));
38  }
39 }
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Destructor
43 
45 {
48 }
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// Attach to list 'alist'
52 
54 {
55  if (!alist) return;
56 
57  if (GetSize() > 0) Clear();
58 
59  TIter nxo(alist);
60  TObject *obj = 0;
61  while ((obj = nxo())) { Add(obj); }
63 }
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// List the content of the list
67 
68 void TProofOutputList::ls(Option_t *option) const
69 {
70  TString opt(option);
71  opt.ToUpper();
72  if (opt.BeginsWith("ALL")) {
73  opt.Remove(0,3);
74  TList::ls(opt);
75  } else {
76  TIter nxos(fDontShow);
77  TObjString *os = 0;
78  TList doShow;
79  doShow.SetOwner(kFALSE);
80 
81  Bool_t hasmissing = kFALSE;
82  TIter nxo(this);
83  TObject *obj = 0;
84  while ((obj = nxo())) {
85  TString s = obj->GetName();
86  if (s == kPROOF_MissingFiles) {
87  TList *mf = dynamic_cast<TList *> (obj);
88  if (mf && mf->GetSize() > 0) hasmissing = kTRUE;
89  } else {
90  nxos.Reset();
91  Bool_t doadd = kTRUE;
92  while ((os = (TObjString *) nxos())) {
93  TRegexp rg(os->GetName(), kTRUE);
94  if (s.Index(rg) != kNPOS) {
95  doadd = kFALSE;
96  break;
97  }
98  }
99  if (doadd) doShow.Add(obj);
100  }
101  }
102  doShow.ls(option);
103  // Notify if missing files were found
104  if (hasmissing)
105  Printf(" +++ Missing files list not empty: use ShowMissingFiles to display it +++");
106  }
107  // Done
108  return;
109 }
110 
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Print the content of the list
114 
116 {
117  TString opt(option);
118  opt.ToUpper();
119  if (opt.BeginsWith("ALL")) {
120  opt.Remove(0,3);
121  TList::Print(opt);
122  } else {
123  TIter nxos(fDontShow);
124  TObjString *os = 0;
125  TList doShow;
126  doShow.SetOwner(kFALSE);
127 
128  Bool_t hasmissing = kFALSE;
129  TIter nxo(this);
130  TObject *obj = 0;
131  while ((obj = nxo())) {
132  TString s = obj->GetName();
133  if (s == kPROOF_MissingFiles) {
134  TList *mf = dynamic_cast<TList *> (obj);
135  if (mf && mf->GetSize() > 0) hasmissing = kTRUE;
136  } else {
137  nxos.Reset();
138  Bool_t doadd = kTRUE;
139  while ((os = (TObjString *) nxos())) {
140  TRegexp rg(os->GetName());
141  if (s.Index(rg) != kNPOS) {;
142  doadd = kFALSE;
143  break;
144  }
145  }
146  if (doadd) doShow.Add(obj);
147  }
148  }
149  doShow.Print(option);
150  // Notify if missing files were found
151  if (hasmissing)
152  Printf(" +++ Missing files list not empty: use ShowMissingFiles to display it +++");
153  }
154  // Done
155  return;
156 }
virtual void ls(Option_t *option="") const
List the content of the list.
TProofOutputList(const char *dontshow="PROOF_*")
Constructor.
Collectable string class.
Definition: TObjString.h:28
const char Option_t
Definition: RtypesCore.h:62
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1113
virtual void Print(Option_t *option="") const
Print the content of the list.
Regular expression class.
Definition: TRegexp.h:31
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void Reset()
Definition: TCollection.h:252
A doubly linked list.
Definition: TList.h:44
const char * GetName() const
Returns name of object.
Definition: TObjString.h:39
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:610
#define Printf
Definition: TGeoToOCC.h:18
const Bool_t kFALSE
Definition: RtypesCore.h:88
#define SafeDelete(p)
Definition: RConfig.h:529
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
const char *const kPROOF_MissingFiles
Definition: TProof.h:137
static constexpr double s
virtual ~TProofOutputList()
Destructor.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:399
Mother of all ROOT objects.
Definition: TObject.h:37
TList()
Definition: TList.h:78
virtual void Add(TObject *obj)
Definition: TList.h:87
void AttachList(TList *alist)
Attach to list &#39;alist&#39;.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
const Bool_t kTRUE
Definition: RtypesCore.h:87
Derivation of TList with an overload of ls() and Print() allowing to filter out some of the variables...