Logo ROOT  
Reference Guide
TViewPubFunctions.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Philippe Canal October 2013
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 #ifndef ROOT_TViewPubFunctions
13 #define ROOT_TViewPubFunctions
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TViewPubFunctions //
18 // //
19 // //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TList.h"
24 
25 class TClass;
26 
27 
28 class TViewPubFunctions : public TList {
29 
30 protected:
31  TList fClasses; // list of the all the (base) classes for which we list methods.
32 
33 private:
34  TViewPubFunctions(const TViewPubFunctions&); // not implemented
35  TViewPubFunctions& operator=(const TViewPubFunctions&); // not implemented
36 
37 public:
38  TViewPubFunctions(TClass *cl = 0);
39  virtual ~TViewPubFunctions();
40 
41  TObject *FindObject(const char *name) const;
42  TObject *FindObject(const TObject *obj) const;
43 
44  virtual TObject *At(Int_t idx) const;
45  virtual const TList *GetListOfClasses() const { return &fClasses; }
46  virtual Int_t GetSize() const;
47  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const;
48 
49  void Load();
50 
51  // All the following routines are explicitly disallow/unsupported for
52  // a view
53 protected:
54  void Clear(Option_t *option="");
55  void Delete(Option_t *option="");
56 
57  void AddFirst(TObject *obj);
58  void AddFirst(TObject *obj, Option_t *opt);
59  void AddLast(TObject *obj);
60  void AddLast(TObject *obj, Option_t *opt);
61  void AddAt(TObject *obj, Int_t idx);
62  void AddAfter(const TObject *after, TObject *obj);
63  void AddAfter(TObjLink *after, TObject *obj);
64  void AddBefore(const TObject *before, TObject *obj);
65  void AddBefore(TObjLink *before, TObject *obj);
66 
67  virtual TObject *After(const TObject *obj) const;
68  virtual TObject *Before(const TObject *obj) const;
69  virtual TObject *First() const;
70  virtual TObjLink *FirstLink() const;
71  virtual TObject **GetObjectRef(const TObject *obj) const;
72  virtual TObject *Last() const;
73  virtual TObjLink *LastLink() const;
74 
75  void RecursiveRemove(TObject *obj);
76  TObject *Remove(TObject *obj);
77  TObject *Remove(TObjLink *lnk);
78 
79 public:
80  ClassDefInline(TViewPubFunctions, 0) // Doubly linked list with hashtable for lookup
81 };
82 
83 // Preventing warnings with -Weffc++ in GCC since it is a false positive for the TListIter destructor.
84 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
85 #pragma GCC diagnostic push
86 #pragma GCC diagnostic ignored "-Weffc++"
87 #endif
88 
89 //////////////////////////////////////////////////////////////////////////
90 // //
91 // TViewPubFunctionsIter //
92 // //
93 // Iterator of view of linked list. `1234 //
94 // //
95 //////////////////////////////////////////////////////////////////////////
97  public std::iterator<std::bidirectional_iterator_tag,
98  TObject*, std::ptrdiff_t,
99  const TObject**, const TObject*&>
100 {
101 protected:
102  const TList *fView; //View we are iterating over.
103  TIter fClassIter; //iterator over the classes
104  TIter fFuncIter; //iterator over the method of the current class
105  Bool_t fStarted; //iteration started
106  Bool_t fDirection; //iteration direction
107 
109 
110 public:
114  TIterator &operator=(const TIterator &rhs);
116 
117  const TCollection *GetCollection() const { return fView; }
118  TObject *Next();
119  void Reset();
120  Bool_t operator!=(const TIterator &aIter) const;
121  Bool_t operator!=(const TViewPubFunctionsIter &aIter) const;
122  TObject *operator*() const { return *fFuncIter; }
123 
124  // ClassDefInline does not yet support non default constructible classes
125  // ClassDefInline(TViewPubFunctionsIter,0) //Linked list iterator
126 };
127 
128 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
129 #pragma GCC diagnostic pop
130 #endif
131 
132 #endif // ROOT_TViewPubFunctions
l
auto * l
Definition: textangle.C:4
TViewPubFunctionsIter
Definition: TViewPubFunctions.h:96
TViewPubFunctionsIter::Reset
void Reset()
Reset list iterator.
Definition: TViewPubFunctions.cxx:456
TViewPubFunctions::MakeIterator
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TViewPubFunctions.cxx:122
TViewPubFunctions::First
virtual TObject * First() const
First is not allowed in this class.
Definition: TViewPubFunctions.cxx:251
TViewPubFunctionsIter::operator*
TObject * operator*() const
Return current object or nullptr.
Definition: TViewPubFunctions.h:122
TViewPubFunctionsIter::operator!=
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
Definition: TViewPubFunctions.cxx:465
TViewPubFunctionsIter::fStarted
Bool_t fStarted
Definition: TViewPubFunctions.h:105
TViewPubFunctions::Clear
void Clear(Option_t *option="")
Clear is not allowed in this class.
Definition: TViewPubFunctions.cxx:69
TViewPubFunctions::TViewPubFunctions
TViewPubFunctions(const TViewPubFunctions &)
TViewPubFunctionsIter::TViewPubFunctionsIter
TViewPubFunctionsIter()
Definition: TViewPubFunctions.h:108
TViewPubFunctions::AddAt
void AddAt(TObject *obj, Int_t idx)
AddAt is not allowed in this class.
Definition: TViewPubFunctions.cxx:167
TViewPubFunctions::fClasses
TList fClasses
Definition: TViewPubFunctions.h:31
TViewPubFunctionsIter::fView
const TList * fView
Definition: TViewPubFunctions.h:102
Int_t
int Int_t
Definition: RtypesCore.h:45
TViewPubFunctions::AddLast
void AddLast(TObject *obj)
AddLast is not allowed in this class.
Definition: TViewPubFunctions.cxx:149
TViewPubFunctions::FindObject
TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TViewPubFunctions.cxx:88
TList.h
TViewPubFunctions::GetListOfClasses
virtual const TList * GetListOfClasses() const
Definition: TViewPubFunctions.h:45
TViewPubFunctions::~TViewPubFunctions
virtual ~TViewPubFunctions()
Default destructor.
Definition: TViewPubFunctions.cxx:61
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TViewPubFunctions
Definition: TViewPubFunctions.h:28
TViewPubFunctionsIter::fDirection
Bool_t fDirection
Definition: TViewPubFunctions.h:106
bool
TIterator
Definition: TIterator.h:30
TViewPubFunctions::GetSize
virtual Int_t GetSize() const
Return the total number of public methods (currently loaded in the list of functions) in this class a...
Definition: TViewPubFunctions.cxx:281
kIterForward
const Bool_t kIterForward
Definition: TCollection.h:40
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TViewPubFunctions::Last
virtual TObject * Last() const
Last is not allowed in this class.
Definition: TViewPubFunctions.cxx:310
ClassDefInline
#define ClassDefInline(name, id)
Definition: Rtypes.h:337
TViewPubFunctions::Before
virtual TObject * Before(const TObject *obj) const
Before is not allowed in this class.
Definition: TViewPubFunctions.cxx:241
TViewPubFunctions::FirstLink
virtual TObjLink * FirstLink() const
FirstLink is not allowed in this class.
Definition: TViewPubFunctions.cxx:261
TViewPubFunctions::RecursiveRemove
void RecursiveRemove(TObject *obj)
RecursiveRemove is not allowed in this class.
Definition: TViewPubFunctions.cxx:330
TViewPubFunctions::AddAfter
void AddAfter(const TObject *after, TObject *obj)
AddAfter is not allowed in this class.
Definition: TViewPubFunctions.cxx:176
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TViewPubFunctions::Delete
void Delete(Option_t *option="")
Delete is not allowed in this class.
Definition: TViewPubFunctions.cxx:78
TViewPubFunctionsIter::fClassIter
TIter fClassIter
Definition: TViewPubFunctions.h:103
TViewPubFunctions::AddBefore
void AddBefore(const TObject *before, TObject *obj)
AddBefore is not allowed in this class.
Definition: TViewPubFunctions.cxx:194
TViewPubFunctions::Remove
TObject * Remove(TObject *obj)
Remove is not allowed in this class.
Definition: TViewPubFunctions.cxx:339
TViewPubFunctions::After
virtual TObject * After(const TObject *obj) const
After is not allowed in this class.
Definition: TViewPubFunctions.cxx:231
TViewPubFunctions::GetObjectRef
virtual TObject ** GetObjectRef(const TObject *obj) const
GetObjectRef is not allowed in this class.
Definition: TViewPubFunctions.cxx:271
TViewPubFunctionsIter::Next
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
Definition: TViewPubFunctions.cxx:415
TViewPubFunctionsIter::operator=
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
Definition: TViewPubFunctions.cxx:384
TViewPubFunctions::Load
void Load()
Load all the functions known to the interpreter for the scope 'fClass' and all its bases classes.
Definition: TViewPubFunctions.cxx:298
TViewPubFunctionsIter::fFuncIter
TIter fFuncIter
Definition: TViewPubFunctions.h:104
TViewPubFunctions::LastLink
virtual TObjLink * LastLink() const
LastLink is not allowed in this class.
Definition: TViewPubFunctions.cxx:320
TClass
Definition: TClass.h:80
TObject
Definition: TObject.h:37
name
char name[80]
Definition: TGX11.cxx:110
TViewPubFunctions::operator=
TViewPubFunctions & operator=(const TViewPubFunctions &)
TIter
Definition: TCollection.h:233
TViewPubFunctionsIter::GetCollection
const TCollection * GetCollection() const
Definition: TViewPubFunctions.h:117
TViewPubFunctions::AddFirst
void AddFirst(TObject *obj)
AddFirst is not allowed in this class.
Definition: TViewPubFunctions.cxx:131
TCollection
Definition: TCollection.h:63
TViewPubFunctions::At
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TViewPubFunctions.cxx:211
TViewPubFunctionsIter::~TViewPubFunctionsIter
~TViewPubFunctionsIter()
Definition: TViewPubFunctions.h:113
TList
Definition: TList.h:44
int