Logo ROOT   6.07/09
Reference Guide
ProcFileElements.h
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_ProcFileElements
3 ///
4 /// Class to hold information about the processed elements of a file
5 ///
6 /// \macro_code
7 ///
8 /// \author Gerardo Ganis (gerardo.ganis@cern.ch)
9 
10 
11 #ifndef ROOT_ProcFileElements
12 #define ROOT_ProcFileElements
13 
14 
15 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 #ifndef ROOT_TSortedList
19 #include "TSortedList.h"
20 #endif
21 
22 class ProcFileElements : public TObject {
23 
24 public:
25  class ProcFileElement : public TObject {
26  public:
27  Long64_t fFirst; // Lower bound of this range
28  Long64_t fLast; // Upper bound of this range
29  ProcFileElement(Long64_t fst = 0, Long64_t lst = -1) :
30  fFirst(fst), fLast(lst) { }
31  virtual ~ProcFileElement() { }
32 
33  Int_t Compare(const TObject *obj) const;
34 
35  Bool_t IsSortable() const { return kTRUE; }
36  Int_t MergeElement(ProcFileElement *);
37 
38  Int_t Overlapping(ProcFileElement *);
39  void Print(Option_t *option="") const;
40 
41  ClassDef(ProcFileElement, 1); // ProcFileElement class
42  };
43 
44 private:
45  TString fName; // File name
46  TSortedList *fElements; // List of processed elements
47 
48  Long64_t fFirst; // Overall lower bound
49  Long64_t fLast; // Overall Upper bound
50 
51 public:
52  ProcFileElements(const char *fn = "") : fName(fn), fElements(0),
53  fFirst(0), fLast(-1) { }
54  virtual ~ProcFileElements() { if (fElements) { fElements->SetOwner();
55  delete fElements; } }
56  const char * GetName() const { return fName; }
57  ULong_t Hash() const { return fName.Hash(); }
58 
59  Int_t Add(Long64_t fst = 0, Long64_t lst = -1);
60  Int_t Merge(TCollection *list);
61 
62  TSortedList *GetListOfElements() const { return fElements; }
63  Int_t GetNumElements() const { return (fElements ? fElements->GetSize() : 0); }
64 
65  Long64_t GetFirst() const { return fFirst; }
66  Long64_t GetLast() const { return fLast; }
67 
68  void Print(Option_t *option="") const;
69 
70  ClassDef(ProcFileElements, 1); // Processed File Elements class
71 };
72 
73 #endif
long long Long64_t
Definition: RtypesCore.h:69
UInt_t Hash(const TString &s)
Definition: TString.h:459
const char Option_t
Definition: RtypesCore.h:62
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:327
A sorted doubly linked list.
Definition: TSortedList.h:30
Collection abstract base class.
Definition: TCollection.h:48
virtual Int_t GetSize() const
Definition: TCollection.h:95
void Print(std::ostream &os, const OptionType &opt)
unsigned long ULong_t
Definition: RtypesCore.h:51
Mother of all ROOT objects.
Definition: TObject.h:44
Int_t Compare(const void *item1, const void *item2)
const Bool_t kTRUE
Definition: Rtypes.h:91
T1 fFirst
Definition: X11Events.mm:86
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:606