Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
25class TClass;
26
27
28class TViewPubFunctions : public TList {
29
30protected:
31 TList fClasses; // list of the all the (base) classes for which we list methods.
32
33private:
36
37public:
38 TViewPubFunctions(TClass *cl = nullptr);
39 virtual ~TViewPubFunctions();
40
41 TObject *FindObject(const char *name) const override;
42 TObject *FindObject(const TObject *obj) const override;
43
44 TObject *At(Int_t idx) const override;
45 virtual const TList *GetListOfClasses() const { return &fClasses; }
46 Int_t GetSize() const override;
47 TIterator *MakeIterator(Bool_t dir = kIterForward) const override;
48
49 void Load();
50
51 // All the following routines are explicitly disallow/unsupported for
52 // a view
53protected:
54 void Clear(Option_t *option="") override;
55 void Delete(Option_t *option="") override;
56
57 void AddFirst(TObject *obj) override;
58 void AddFirst(TObject *obj, Option_t *opt) override;
59 void AddLast(TObject *obj) override;
60 void AddLast(TObject *obj, Option_t *opt) override;
61 void AddAt(TObject *obj, Int_t idx) override;
62 void AddAfter(const TObject *after, TObject *obj) override;
63 void AddAfter(TObjLink *after, TObject *obj) override;
64 void AddBefore(const TObject *before, TObject *obj) override;
65 void AddBefore(TObjLink *before, TObject *obj) override;
66
67 TObject *After(const TObject *obj) const override;
68 TObject *Before(const TObject *obj) const override;
69 TObject *First() const override;
70 TObjLink *FirstLink() const override;
71 TObject **GetObjectRef(const TObject *obj) const override;
72 TObject *Last() const override;
73 TObjLink *LastLink() const override;
74
75 void RecursiveRemove(TObject *obj) override;
76 TObject *Remove(TObject *obj) override;
77 TObject *Remove(TObjLink *lnk) override;
78
79public:
80 ClassDefInlineOverride(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//////////////////////////////////////////////////////////////////////////
97protected:
98 const TList *fView; //View we are iterating over.
99 TIter fClassIter; //iterator over the classes
100 TIter fFuncIter; //iterator over the method of the current class
101 Bool_t fStarted; //iteration started
102 Bool_t fDirection; //iteration direction
103
105
106public:
107 using iterator_category = std::bidirectional_iterator_tag;
109 using difference_type = std::ptrdiff_t;
110 using pointer = TObject **;
111 using const_pointer = const TObject **;
112 using reference = const TObject *&;
113
117 TIterator &operator=(const TIterator &rhs) override;
119
120 const TCollection *GetCollection() const override { return fView; }
121 TObject *Next() override;
122 void Reset() override;
123 Bool_t operator!=(const TIterator &aIter) const override;
124 Bool_t operator!=(const TViewPubFunctionsIter &aIter) const;
125 TObject *operator*() const override { return *fFuncIter; }
126
127 // ClassDefInline does not yet support non default constructible classes
128 // ClassDefInline(TViewPubFunctionsIter,0) //Linked list iterator
129};
130
131#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
132#pragma GCC diagnostic pop
133#endif
134
135#endif // ROOT_TViewPubFunctions
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
const char Option_t
Definition RtypesCore.h:66
#define ClassDefInlineOverride(name, id)
Definition Rtypes.h:353
const Bool_t kIterForward
Definition TCollection.h:42
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Collection abstract base class.
Definition TCollection.h:65
Iterator abstract base class.
Definition TIterator.h:30
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Iterator of over the view's content.
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
TObject * operator*() const override
Return current object or nullptr.
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator.
void Reset() override
Reset list iterator.
Bool_t operator!=(const TIterator &aIter) const override
This operator compares two TIterator objects.
std::bidirectional_iterator_tag iterator_category
std::ptrdiff_t difference_type
const TCollection * GetCollection() const override
View implementing the TList interface and giving access all the TFunction describing public methods i...
void AddLast(TObject *obj) override
AddLast is not allowed in this class.
virtual const TList * GetListOfClasses() const
TObject * Remove(TObject *obj) override
Remove is not allowed in this class.
void Load()
Load all the functions known to the interpreter for the scope 'fClass' and all its bases classes.
TObject * Before(const TObject *obj) const override
Before is not allowed in this class.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
TObjLink * LastLink() const override
LastLink is not allowed in this class.
TViewPubFunctions & operator=(const TViewPubFunctions &)=delete
TObject * First() const override
First is not allowed in this class.
void Clear(Option_t *option="") override
Clear is not allowed in this class.
void RecursiveRemove(TObject *obj) override
RecursiveRemove is not allowed in this class.
TObject ** GetObjectRef(const TObject *obj) const override
GetObjectRef is not allowed in this class.
virtual ~TViewPubFunctions()
Default destructor.
TObjLink * FirstLink() const override
FirstLink is not allowed in this class.
Int_t GetSize() const override
Return the total number of public methods (currently loaded in the list of functions) in this class a...
TObject * After(const TObject *obj) const override
After is not allowed in this class.
void Delete(Option_t *option="") override
Delete is not allowed in this class.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void AddFirst(TObject *obj) override
AddFirst is not allowed in this class.
void AddAt(TObject *obj, Int_t idx) override
AddAt is not allowed in this class.
void AddAfter(const TObject *after, TObject *obj) override
AddAfter is not allowed in this class.
TObject * Last() const override
Last is not allowed in this class.
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
TViewPubFunctions(const TViewPubFunctions &)=delete
void AddBefore(const TObject *before, TObject *obj) override
AddBefore is not allowed in this class.
TLine l
Definition textangle.C:4