ROOT  6.06/09
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 #ifndef ROOT_TList
24 #include "TList.h"
25 #endif
26 
27 class TClass;
28 
29 
30 class TViewPubFunctions : public TList {
31 
32 protected:
33  TList fClasses; // list of the all the (base) classes for which we list methods.
34 
35 private:
36  TViewPubFunctions(const TViewPubFunctions&); // not implemented
37  TViewPubFunctions& operator=(const TViewPubFunctions&); // not implemented
38 
39 public:
40  TViewPubFunctions(TClass *cl = 0);
41  virtual ~TViewPubFunctions();
42 
43  TObject *FindObject(const char *name) const;
44  TObject *FindObject(const TObject *obj) const;
45 
46  virtual TObject *At(Int_t idx) const;
47  virtual const TList *GetListOfClasses() const { return &fClasses; }
48  virtual Int_t GetSize() const;
49  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const;
50 
51  void Load();
52 
53  // All the following routines are explicitly disallow/unsupported for
54  // a view
55 protected:
56  void Clear(Option_t *option="");
57  void Delete(Option_t *option="");
58 
59  void AddFirst(TObject *obj);
60  void AddFirst(TObject *obj, Option_t *opt);
61  void AddLast(TObject *obj);
62  void AddLast(TObject *obj, Option_t *opt);
63  void AddAt(TObject *obj, Int_t idx);
64  void AddAfter(const TObject *after, TObject *obj);
65  void AddAfter(TObjLink *after, TObject *obj);
66  void AddBefore(const TObject *before, TObject *obj);
67  void AddBefore(TObjLink *before, TObject *obj);
68 
69  virtual TObject *After(const TObject *obj) const;
70  virtual TObject *Before(const TObject *obj) const;
71  virtual TObject *First() const;
72  virtual TObjLink *FirstLink() const;
73  virtual TObject **GetObjectRef(const TObject *obj) const;
74  virtual TObject *Last() const;
75  virtual TObjLink *LastLink() const;
76 
79  TObject *Remove(TObjLink *lnk);
80 
81 public:
82  // ClassDef(THashList,0) //Doubly linked list with hashtable for lookup
83 };
84 
85 // Preventing warnings with -Weffc++ in GCC since it is a false positive for the TListIter destructor.
86 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
87 #pragma GCC diagnostic push
88 #pragma GCC diagnostic ignored "-Weffc++"
89 #endif
90 
91 //////////////////////////////////////////////////////////////////////////
92 // //
93 // TViewPubFunctionsIter //
94 // //
95 // Iterator of view of linked list. `1234 //
96 // //
97 //////////////////////////////////////////////////////////////////////////
99  public std::iterator<std::bidirectional_iterator_tag,
100  TObject*, std::ptrdiff_t,
101  const TObject**, const TObject*&>
102 {
103 protected:
104  const TList *fView; //View we are iterating over.
105  TIter fClassIter; //iterator over the classes
106  TIter fFuncIter; //iterator over the method of the current class
107  Bool_t fStarted; //iteration started
108  Bool_t fDirection; //iteration direction
109 
110  TViewPubFunctionsIter() : fView(0), fClassIter((TCollection *)0), fFuncIter((TCollection *)0), fStarted(kFALSE), fDirection(kIterForward) { }
111 
112 public:
116  TIterator &operator=(const TIterator &rhs);
118 
119  const TCollection *GetCollection() const { return fView; }
120  TObject *Next();
121  void Reset();
122  Bool_t operator!=(const TIterator &aIter) const;
123  Bool_t operator!=(const TViewPubFunctionsIter &aIter) const;
124  TObject *operator*() const { return *fFuncIter; }
125 
126  // ClassDef(TViewPubFunctionsIter,0) //Linked list iterator
127 };
128 
129 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
130 #pragma GCC diagnostic pop
131 #endif
132 
133 #endif // ROOT_TViewPubFunctions
Iterator of over the view's content.
TObject * FindObject(const char *name) const
Find an object in this list using its name.
TViewPubFunctions(const TViewPubFunctions &)
void Clear(Option_t *option="")
Clear is not allowed in this class.
const char Option_t
Definition: RtypesCore.h:62
const TCollection * GetCollection() const
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
int Int_t
Definition: RtypesCore.h:41
void AddLast(TObject *obj)
AddLast is not allowed in this class.
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void AddAt(TObject *obj, Int_t idx)
AddAt is not allowed in this class.
virtual TObject * Before(const TObject *obj) const
Before is not allowed in this class.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Iterator abstract base class.
Definition: TIterator.h:32
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
virtual ~TViewPubFunctions()
Default destructor.
std::map< std::string, std::string >::const_iterator iter
Definition: TAlienJob.cxx:54
virtual TObject ** GetObjectRef(const TObject *obj) const
GetObjectRef is not allowed in this class.
const Bool_t kIterForward
Definition: TCollection.h:43
TObject * operator*() const
Return current object or nullptr.
A doubly linked list.
Definition: TList.h:47
virtual TObject * First() const
First is not allowed in this class.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
virtual TObject * After(const TObject *obj) const
After is not allowed in this class.
void AddBefore(const TObject *before, TObject *obj)
AddBefore is not allowed in this class.
void RecursiveRemove(TObject *obj)
RecursiveRemove is not allowed in this class.
void Delete(Option_t *option="")
Delete is not allowed in this class.
Collection abstract base class.
Definition: TCollection.h:48
void AddAfter(const TObject *after, TObject *obj)
AddAfter is not allowed in this class.
virtual TObject * Last() const
Last is not allowed in this class.
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
TObject * Remove(TObject *obj)
Remove is not allowed in this class.
View implementing the TList interface and giving access all the TFunction describing public methods i...
void Load()
Load all the functions known to the interpreter for the scope 'fClass' and all its bases classes...
virtual TObjLink * FirstLink() const
FirstLink is not allowed in this class.
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
virtual TObjLink * LastLink() const
LastLink is not allowed in this class.
TViewPubFunctions & operator=(const TViewPubFunctions &)
void AddFirst(TObject *obj)
AddFirst is not allowed in this class.
virtual Int_t GetSize() const
Return the total number of public methods (currently loaded in the list of functions) in this class a...
virtual const TList * GetListOfClasses() const
TObject * obj
void Reset()
Reset list iterator.