Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TBranchBrowsable.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Axel Naumann 14/10/2004
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 #ifndef ROOT_TBranchBrowsable
13 #define ROOT_TBranchBrowsable
14 
15 #include "TNamed.h"
16 
17 #include "TList.h"
18 
19 #include <list>
20 
21 class TMethod;
22 class TBowser;
23 class TClass;
24 class TBranch;
25 class TBranchElement;
26 class TString;
27 class TStreamerElement;
28 
30 public:
31 
32  // these methods are registered in RegisterGenerator, and
33  // called to create the list of browsables. See e.g.
34  // TMethodBrowsable::Register
36  (TList&, const TBranch* branch, const TVirtualBranchBrowsable* parent);
37 
39 
40  void Browse(TBrowser *b);
41  const char *GetIconName() const {
42  // return icon shown when browsing a TVirtualBranchBrowsable
43  if (IsFolder()) return "TBranchElement-folder";
44  else return "TBranchElement-leaf";
45  }
46  void GetScope(TString & scope) const;
47  Bool_t IsFolder() const {
48  // check whether we have sub-elements
49  return (GetLeaves() && GetLeaves()->GetSize()); }
50 
51  static Int_t FillListOfBrowsables(TList& list, const TBranch* branch,
52  const TVirtualBranchBrowsable* parent=0);
53 
54  const TBranch* GetBranch() const {
55  // return the parent branch (might be many levels up)
56  return fBranch; }
58  // return the parent TVirtualBranchBrowsable
59  return fParent; }
60  TClass* GetClassType() const {
61  // return the type of this browsable object
62  return fClass; }
64  // return whether the type of this browsable object is a pointer
65  return fTypeIsPointer; }
66  TList* GetLeaves() const;
67 
68  // static void Register() has to be implemented for all derived classes!
69  // static void Unregister() has to be implemented for all derived classes!
70 
71 protected:
72  TVirtualBranchBrowsable(const TBranch* b, TClass* type, Bool_t typeIsPointer,
73  const TVirtualBranchBrowsable* parent=0);
75  const TVirtualBranchBrowsable* parent, TClass* &contained);
76  static std::list<MethodCreateListOfBrowsables_t>& GetRegisteredGenerators();
79  void SetType(TClass* type) {
80  // sets the type of this browsable object
81  fClass=type; }
83  // sets whether the type of this browsable object is a pointer
84  fTypeIsPointer=set; }
85 
86 private:
87  static void RegisterDefaultGenerators();
88  const TBranch *fBranch; ///< pointer to the branch element representing the top object
89  const TVirtualBranchBrowsable *fParent; ///< parent method if this method is member of a returned class
90  TList *fLeaves; ///< pointer to leaves
91  TClass *fClass; ///< pointer to TClass representing our type (i.e. return type for methods), 0 if basic type
92  Bool_t fTypeIsPointer; ///< return type is pointer to class
93  static std::list<MethodCreateListOfBrowsables_t> fgGenerators; ///< list of MethodCreateListOfBrowsables_t called by CreateListOfBrowsables
94  static Bool_t fgGeneratorsSet; ///< have we set the generators yet? empty is not good enough - user might have removed them
95  ClassDef(TVirtualBranchBrowsable, 0); ///< Base class for helper objects used for browsing
96 };
97 
98 
100 public:
102 
103  static Int_t GetBrowsables(TList& list, const TBranch* branch,
104  const TVirtualBranchBrowsable* parent=0);
105  const char *GetIconName() const {
106  // return our special icons
107  if (IsFolder()) return "TMethodBrowsable-branch";
108  return "TMethodBrowsable-leaf";}
109  static Bool_t IsMethodBrowsable(const TMethod* m);
110  static void Register();
111  static void Unregister();
112 
113 protected:
114  static void GetBrowsableMethodsForClass(TClass* cl, TList& list);
115  TMethodBrowsable(const TBranch* branch, TMethod* m,
116  const TVirtualBranchBrowsable* parent=0);
117 
118 private:
119  TMethod *fMethod; // pointer to a method
120  ClassDef(TMethodBrowsable,0); // Helper object to browse methods
121 };
122 
123 
125 public:
127 
128  static Int_t GetBrowsables(TList& list, const TBranch* branch,
129  const TVirtualBranchBrowsable* parent=0);
130  static void Register();
131  static void Unregister();
132 
133 protected:
134  TNonSplitBrowsable(const TStreamerElement* element, const TBranch* branch,
135  const TVirtualBranchBrowsable* parent=0);
136 
137 private:
138  ClassDef(TNonSplitBrowsable, 0); // Helper object to browse unsplit objects
139 };
140 
141 
143 public:
145 
146  void Browse(TBrowser *b);
147  static Int_t GetBrowsables(TList& list, const TBranch* branch,
148  const TVirtualBranchBrowsable* parent=0);
149  const char* GetDraw() const {
150  // return the string passed to TTree::Draw
151  return fDraw.Data(); }
152  static void Register();
153  static void Unregister();
154 
155 protected:
156  TCollectionPropertyBrowsable(const char* name, const char* title,
157  const char* draw, const TBranch* branch, const TVirtualBranchBrowsable* parent=0):
158  TVirtualBranchBrowsable(branch, 0, kFALSE, parent), fDraw(draw) {
159  // constructor, which sets the name and title according to the parameters
160  // (and thus differently than our base class TVirtualBranchBrowsable)
161  SetNameTitle(name, title);
162  }
163 
164 private:
165  TString fDraw; // string to send to TTree::Draw(), NOT by GetScope()!
166  ClassDef(TCollectionPropertyBrowsable, 0); // Helper object to add browsable collection properties
167 };
168 
170 public:
172 
173  static Int_t GetBrowsables(TList& list, const TBranch* branch,
174  const TVirtualBranchBrowsable* parent=0);
175  static void Register();
176  static void Unregister();
177 
178 protected:
180  const TVirtualBranchBrowsable* parent=0);
181 
182  ClassDef(TCollectionMethodBrowsable,0); // Helper object to browse a collection's methods
183 };
184 
185 #endif // defined ROOT_TBranchBrowsable
static void Unregister()
Wrapper for the registration method.
void GetScope(TString &scope) const
Returns the full name for TTree::Draw to draw *this.
static void RegisterDefaultGenerators()
Adds the default generators.
TList * fLeaves
pointer to leaves
static Int_t GetBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
This methods fills list with TMethodBrowsables for the branch&#39;s or parent&#39;s collection class and its ...
static Int_t GetBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
This methods fills list with TMethodBrowsables for the branch&#39;s or parent&#39;s class and its base classe...
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
static void Register()
Wrapper for the registration method.
const char * GetIconName() const
Returns mime type name of object.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: TNamed.cxx:145
const TVirtualBranchBrowsable * fParent
parent method if this method is member of a returned class
A tiny browser helper object (and its generator) for adding a virtual (as in &quot;not actually part of th...
const TVirtualBranchBrowsable * GetParent() const
void SetType(TClass *type)
const char * Data() const
Definition: TString.h:344
static Int_t FillListOfBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
Askes all registered generators to fill their browsables into the list.
#define ClassDef(name, id)
Definition: Rtypes.h:297
const TBranch * GetBranch() const
static void GetBrowsableMethodsForClass(TClass *cl, TList &list)
Given a class, this methods fills list with TMethodBrowsables for the class and its base classes...
static void Unregister()
Wrapper for the registration method.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TNonSplitBrowsable(const TStreamerElement *element, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
Constructor.
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
TCollectionMethodBrowsable(const TBranch *branch, TMethod *m, const TVirtualBranchBrowsable *parent=0)
Contructor, see TMethodBrowsable&#39;s constructor.
A doubly linked list.
Definition: TList.h:43
static TClass * GetCollectionContainedType(const TBranch *b, const TVirtualBranchBrowsable *parent, TClass *&contained)
Check whether the branch (or the parent) contains a collection.
static void Register()
Wrapper for the registration method.
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Bool_t TypeIsPointer() const
TClass * fClass
pointer to TClass representing our type (i.e. return type for methods), 0 if basic type ...
static Bool_t IsMethodBrowsable(const TMethod *m)
A TMethod is browsable if it is const, public and not pure virtual, if does not have any parameter wi...
static void RegisterGenerator(MethodCreateListOfBrowsables_t generator)
Adds a generator to be called when browsing branches.
TMarker * m
Definition: textangle.C:8
TCollectionMethodBrowsable extends TCollectionPropertyBrowsable by showing all methods of the collect...
static Int_t GetBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
Given either a branch &quot;branch&quot; or a &quot;parent&quot; TVirtualBranchBrowsable, we fill &quot;list&quot; with objec...
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
static void Unregister()
Wrapper for the registration method.
static Bool_t fgGeneratorsSet
have we set the generators yet? empty is not good enough - user might have removed them ...
TMethodBrowsable(const TBranch *branch, TMethod *m, const TVirtualBranchBrowsable *parent=0)
Constructor.
TVirtualBranchBrowsable is a base class (not really abstract, but useless by itself) for helper objec...
A Branch for the case of an object.
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetTypeIsPointer(Bool_t set=kTRUE)
TClass * GetClassType() const
int type
Definition: TGX11.cxx:120
void Browse(TBrowser *b)
Calls TTree::Draw on the method if return type is not a class; otherwise expands returned object&#39;s &quot;f...
TCollectionPropertyBrowsable(const char *name, const char *title, const char *draw, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
const char * GetIconName() const
Returns mime type name of object.
TList * GetLeaves() const
Return list of leaves. If not set up yet we&#39;ll create them.
Int_t(* MethodCreateListOfBrowsables_t)(TList &, const TBranch *branch, const TVirtualBranchBrowsable *parent)
static void Register()
Wrapper for the registration method.
static Int_t GetBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
If the element to browse (given by either parent of branch) contains a collection (TClonesArray or so...
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
static void Unregister()
Wrapper for the registration method.
const TBranch * fBranch
pointer to the branch element representing the top object
static std::list< MethodCreateListOfBrowsables_t > fgGenerators
list of MethodCreateListOfBrowsables_t called by CreateListOfBrowsables
Bool_t fTypeIsPointer
return type is pointer to class
static void Register()
Wrapper for the registration method.
void Browse(TBrowser *b)
Browses a TCollectionPropertyBrowsable.
A TTree is a list of TBranches.
Definition: TBranch.h:57
static std::list< MethodCreateListOfBrowsables_t > & GetRegisteredGenerators()
returns the list of registered generator methods
const Bool_t kTRUE
Definition: RtypesCore.h:91
~TVirtualBranchBrowsable()
Destructor. Delete our leaves.
char name[80]
Definition: TGX11.cxx:109
TVirtualBranchBrowsable(const TBranch *b, TClass *type, Bool_t typeIsPointer, const TVirtualBranchBrowsable *parent=0)
Constructor setting all members according to parameters.
Allows a TBrowser to browse non-split branches as if they were split.
const char * GetDraw() const
static void UnregisterGenerator(MethodCreateListOfBrowsables_t generator)
Removes a generator from the list of generators to be called when browsing branches.
This helper object allows the browsing of methods of objects stored in branches.