Logo ROOT   6.16/01
Reference Guide
TDataSetIter.h
Go to the documentation of this file.
1// @(#)root/table:$Id$
2// Author: Valery Fine(fine@mail.cern.ch) 03/07/98
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_TDataSetIter
13#define ROOT_TDataSetIter
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// //
19// TDataSetIter //
20// //
21// Iterator of TDataSet lists. //
22// //
23// Provides "standard" features of the TIter class for TDataSet object //
24// and //
25// allows navigating TDataSet structure using the custom "directory" //
26// notation (see TDataSet::Find(const Char *path) method) //
27// //
28//////////////////////////////////////////////////////////////////////////
29
30#include "TList.h"
31#include "TNamed.h"
32
33#include "TDataSet.h"
34
35class TDataSetIter : public TObject{
36protected:
37 TIter *fNext; // "standard" ROOT iterator for containers
38 TIter *fNextSet[100]; // the list of the TList iterators to bypass the whole dataset
39 Int_t fDepth; // the current depth of the passing
40 Int_t fMaxDepth; // the max depth of the passing (=1 by default)
41
42 TDataSet *fDataSet; // Pointer to the last selected TDataSet
43 TDataSet *fRootDataSet; // Pointer to the root TDataSet
44 TDataSet *fWorkingDataSet; // Pointer to the working TDataSet
46 TDataSet *NextDataSet(Int_t nDataSet);
47 TDataSet *GetNullSet(); // return a fake pointer == -1 casted to (TDataSet *)
48
50
51private:
52
53 TDataSetIter(const TDataSetIter&); // Not implemented.
54 TDataSetIter &operator=(const TDataSetIter&); // Not implemented.
55
56public:
59 virtual ~TDataSetIter();
60
61 virtual TDataSet *Add(TDataSet *set){return Add(set,(TDataSet *)0);}
62 virtual TDataSet *Add(TDataSet *set, const Char_t *path);
63 virtual TDataSet *Add(TDataSet *set, TDataSet *dataset);
64
65 virtual TDataSet *Cd(const Char_t *dirname);
66 virtual TDataSet *Cd(TDataSet *ds);
68 virtual TDataSet *operator()(const Char_t *path) { return Find(path); }
69 virtual TDataSet *operator[](const Char_t *path);
70 virtual Int_t GetDepth() const {return fDepth;}
71 virtual TDataSet *Cwd() const {return fWorkingDataSet;}
72 virtual TDataSet *Dir(Char_t *dirname);
73 virtual Int_t Du() const; // summarize dataset usage
74 virtual Int_t Df() const {return 0;} // report number of free "table" blocks.
75
76 virtual TDataSet *Find(const Char_t *path, TDataSet *rootset=0,Bool_t mkdir=kFALSE,Bool_t titleFlag=kFALSE);
77 virtual TDataSet *FindByPath(const Char_t *path, TDataSet *rootset=0,Bool_t mkdir=kFALSE);
78 virtual TDataSet *FindDataSet(const Char_t *name,const Char_t *path="",Option_t *opt="");
79 virtual TDataSet *FindByName(const Char_t *name,const Char_t *path="",Option_t *opt="");
80 virtual TDataSet *FindByTitle(const Char_t *title,const Char_t *path="",Option_t *opt="");
81 virtual TDataSet *FindDataSet(TDataSet *set,const Char_t *path,Option_t *opt="");
82 virtual TDataSet *FindByPointer(TDataSet *set,const Char_t *path=0,Option_t *opt="");
83 virtual TObject *FindObject(const Char_t *name) const;
84 virtual TObject *FindObject(const TObject *obj) const;
85
86 virtual Int_t Flag(UInt_t flag=TDataSet::kMark,TDataSet::EBitOpt reset=TDataSet::kSet){return Flag((TDataSet *)0,flag,reset);}
89
90 virtual TDataSet *Ls(const Char_t *dirname="",Option_t *opt="") const;
91 virtual TDataSet *Ls(const Char_t *dirname,Int_t depth) const;
92 virtual void ls(Option_t *dirname="") const { Ls(dirname,"");}
93 virtual TDataSet *ls(TString dirname,Option_t *opt="") const {return Ls(dirname.Data(),opt);}
94 virtual TDataSet *ls(const Char_t *dirname,Int_t depth) const {return Ls(dirname,depth);}
95 virtual TDataSet *Mkdir(const Char_t *dirname);
96 virtual TDataSet *Md(const Char_t *dirname) {return Mkdir(dirname);}
97 virtual TString Path(const Char_t *path) {TDataSet *set = Find(path); return set ? set->Path():TString ("");}
98 virtual TString Path() {return fWorkingDataSet ? fWorkingDataSet->Path() : TString ("");}
99 virtual TDataSet *Pwd(Option_t *opt="") const {if (Cwd()) Cwd()->ls(opt); return Cwd();}
100 virtual TDataSet *Rmdir(TDataSet *dataset,Option_t *option="");
101 virtual TDataSet *Rmdir(const Char_t *dirname,Option_t *option=""){return Rmdir(Find(dirname),option);}
102 virtual TDataSet *Rd(const Char_t *dirname,Option_t *option="") {return Rmdir(Find(dirname),option);}
103
104 virtual TDataSet *Shunt(TDataSet *set){return Shunt(set,(TDataSet *)0);}
105 virtual TDataSet *Shunt(TDataSet *set, const Char_t *path);
106 virtual TDataSet *Shunt(TDataSet *set, TDataSet *dataset);
107
109 virtual TDataSet *Next(const Char_t *path, TDataSet *rootset=0,Bool_t mkdir=kFALSE){return Find(path,rootset,mkdir);}
110 virtual Bool_t Notify() { return TObject::Notify();}
111 virtual void Notify(TDataSet *dataset);
112 const Option_t *GetOption() const { return fNext ? fNext->GetOption():0; }
113 virtual void Reset(TDataSet *l=0,Int_t depth=0);
114 virtual TDataSet *operator *() const ;
115
116 ClassDef(TDataSetIter,0) // class-iterator to navigate TDataSet structure
117};
118
119#endif
120
int Int_t
Definition: RtypesCore.h:41
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
const Bool_t kIterForward
Definition: TCollection.h:40
virtual ~TDataSetIter()
to be documented
virtual TDataSet * Pwd(Option_t *opt="") const
Definition: TDataSetIter.h:99
virtual TDataSet * operator()(const Char_t *path)
Definition: TDataSetIter.h:68
virtual TDataSet * Dir(Char_t *dirname)
Print the names of the TDataSet objects for the datatset named with "dirname" apart of TDataSet::Ls()...
virtual TDataSet * FindByName(const Char_t *name, const Char_t *path="", Option_t *opt="")
to be documented
virtual TDataSet * FindByPointer(TDataSet *set, const Char_t *path=0, Option_t *opt="")
Check whether the object does belong the TDataSet defined with "path" opt = "-l" - check the "referen...
virtual TDataSet * Next(const Char_t *path, TDataSet *rootset=0, Bool_t mkdir=kFALSE)
Definition: TDataSetIter.h:109
TIter * fNextSet[100]
Definition: TDataSetIter.h:38
virtual TDataSet * ls(const Char_t *dirname, Int_t depth) const
Definition: TDataSetIter.h:94
TDataSet * fWorkingDataSet
Definition: TDataSetIter.h:44
virtual TDataSet * Rmdir(TDataSet *dataset, Option_t *option="")
Remove the TDataSet *dataset from the current dataset If the current dataset is the deleted dataset t...
virtual Int_t Du() const
summarize dataset usage by Herb Ward proposal
virtual TDataSet * Add(TDataSet *set)
Definition: TDataSetIter.h:61
virtual TString Path()
Definition: TDataSetIter.h:98
virtual TDataSet * Next(TDataSet::EDataSetPass mode=TDataSet::kContinue)
returns the pointer the "next" TDataSet object = 0 if all objects have been returned.
virtual TDataSet * Ls(const Char_t *dirname="", Option_t *opt="") const
Ls(const Char_t *dirname,Option_t)
virtual TDataSet * FindByPath(const Char_t *path, TDataSet *rootset=0, Bool_t mkdir=kFALSE)
to be documented
virtual TDataSet * operator[](const Char_t *path)
operator [] returns the pointer to the TDataSet if it does contain any data (TTable for example)
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TDataSetIter.h:110
virtual void Reset(TDataSet *l=0, Int_t depth=0)
TDataSet *l != 0 means the new start pointer depth != 0 means the new value for the depth otherwise t...
TDataSet * NextDataSet(TIter &next)
to be documented
virtual TDataSet * operator()(TDataSet::EDataSetPass mode=TDataSet::kContinue)
Definition: TDataSetIter.h:67
Int_t fMaxDepth
Definition: TDataSetIter.h:40
TDataSetIter(const TDataSetIter &)
virtual void ls(Option_t *dirname="") const
The ls function lists the contents of a class on stdout.
Definition: TDataSetIter.h:92
TDataSetIter & operator=(const TDataSetIter &)
const Option_t * GetOption() const
Definition: TDataSetIter.h:112
virtual TDataSet * FindByTitle(const Char_t *title, const Char_t *path="", Option_t *opt="")
to be documented
static TDataSet * fgNullDataSet
Definition: TDataSetIter.h:49
virtual Int_t GetDepth() const
Definition: TDataSetIter.h:70
TDataSet * GetNullSet()
return a fake pointer == -1 casted to (TDataSet *)
virtual TDataSet * Rd(const Char_t *dirname, Option_t *option="")
Definition: TDataSetIter.h:102
virtual TDataSet * FindDataSet(const Char_t *name, const Char_t *path="", Option_t *opt="")
FindDataSet looks for the object with the name supplied across dataset.
virtual TString Path(const Char_t *path)
Definition: TDataSetIter.h:97
virtual TDataSet * Rmdir(const Char_t *dirname, Option_t *option="")
Definition: TDataSetIter.h:101
virtual TObject * FindObject(const Char_t *name) const
This method is not recommended.
TIter * fNext
Definition: TDataSetIter.h:37
TDataSet * fDataSet
Definition: TDataSetIter.h:42
virtual TDataSet * Cd(const Char_t *dirname)
virtual TDataSet * Mkdir(const Char_t *dirname)
to be documented
virtual TDataSet * ls(TString dirname, Option_t *opt="") const
Definition: TDataSetIter.h:93
virtual TDataSet * operator*() const
operator *
virtual TDataSet * Shunt(TDataSet *set)
Definition: TDataSetIter.h:104
TDataSet * fRootDataSet
Definition: TDataSetIter.h:43
virtual TDataSet * Find(const Char_t *path, TDataSet *rootset=0, Bool_t mkdir=kFALSE, Bool_t titleFlag=kFALSE)
virtual Int_t Df() const
Definition: TDataSetIter.h:74
virtual TDataSet * Md(const Char_t *dirname)
Definition: TDataSetIter.h:96
virtual Int_t Flag(UInt_t flag=TDataSet::kMark, TDataSet::EBitOpt reset=TDataSet::kSet)
Definition: TDataSetIter.h:86
virtual TDataSet * Cwd() const
Definition: TDataSetIter.h:71
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
EDataSetPass
Definition: TDataSet.h:40
@ kContinue
Definition: TDataSet.h:41
virtual TString Path() const
return the full path of this data set
Definition: TDataSet.cxx:626
@ kSet
Definition: TDataSet.h:80
@ kMark
Definition: TDataSet.h:75
Option_t * GetOption() const
Definition: TCollection.h:251
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TObject.cxx:506
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
auto * l
Definition: textangle.C:4