Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TViewPubDataMembers.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_TViewPubDataMembers
13#define ROOT_TViewPubDataMembers
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TViewPubDataMembers //
18// //
19// //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TList.h"
24
25class TClass;
26
27
28class TViewPubDataMembers : public TList {
29
30protected:
31 TList fClasses; // list of the all the (base) classes for which we list methods.
32
33private:
36
37public:
38 TViewPubDataMembers(TClass *cl = nullptr);
39 virtual ~TViewPubDataMembers();
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
53protected:
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
79public:
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// TViewPubDataMembersIter //
92// //
93// Iterator of view of linked list. ` //
94// //
95//////////////////////////////////////////////////////////////////////////
97public:
98 using iterator_category = std::bidirectional_iterator_tag;
100 using difference_type = std::ptrdiff_t;
101 using pointer = const TObject **;
102 using reference = const TObject *&;
103
104protected:
105 const TList *fView; //View we are iterating over.
106 TIter fClassIter; //iterator over the classes
107 TIter fIter; //iterator over the members of the current class
108 Bool_t fStarted; //iteration started
109 Bool_t fDirection; //iteration direction
110
112
113public:
117 TIterator &operator=(const TIterator &rhs);
119
120 const TCollection *GetCollection() const { return fView; }
121 TObject *Next();
122 void Reset();
123 Bool_t operator!=(const TIterator &aIter) const;
124 Bool_t operator!=(const TViewPubDataMembersIter &aIter) const;
125 TObject *operator*() const { return *fIter; }
126
127 // ClassDefInline does not yet support non default constructible classes
128 // ClassDefInline(TViewPubDataMembersIter,0)
129};
130
131#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
132#pragma GCC diagnostic pop
133#endif
134
135#endif // ROOT_TViewPubDataMembers
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDefInline(name, id)
Definition Rtypes.h:337
const Bool_t kIterForward
Definition TCollection.h:42
char name[80]
Definition TGX11.cxx:110
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
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 * operator*() const
Return current object or nullptr.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
void Reset()
Reset list iterator.
std::bidirectional_iterator_tag iterator_category
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
const TCollection * GetCollection() const
View implementing the TList interface and giving access all the TDictionary describing public data me...
void AddBefore(const TObject *before, TObject *obj)
AddBefore is not allowed in this class.
virtual TObject ** GetObjectRef(const TObject *obj) const
GetObjectRef is not allowed in this class.
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' and all its bases classes.
virtual TObject * After(const TObject *obj) const
After is not allowed in this class.
virtual const TList * GetListOfClasses() const
virtual TObject * Last() const
Last is not allowed in this class.
TObject * Remove(TObject *obj)
Remove 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.
void AddLast(TObject *obj)
AddLast is not allowed in this class.
virtual Int_t GetSize() const
Return the total number of public data members(currently loaded in the list of DataMembers) in this c...
TViewPubDataMembers & operator=(const TViewPubDataMembers &)=delete
TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObjLink * FirstLink() const
FirstLink is not allowed in this class.
TViewPubDataMembers(const TViewPubDataMembers &)=delete
virtual TObject * First() const
First is not allowed in this class.
void AddAt(TObject *obj, Int_t idx)
AddAt is not allowed in this class.
virtual TObjLink * LastLink() const
LastLink is not allowed in this class.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual TObject * Before(const TObject *obj) const
Before is not allowed in this class.
void AddAfter(const TObject *after, TObject *obj)
AddAfter 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.
void AddFirst(TObject *obj)
AddFirst is not allowed in this class.
void Clear(Option_t *option="")
Clear is not allowed in this class.
virtual ~TViewPubDataMembers()
Default destructor.
auto * l
Definition textangle.C:4