Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
25 class TClass;
26 
27 
28 class TViewPubDataMembers : public TList {
29 
30 protected:
31  TList fClasses; // list of the all the (base) classes for which we list methods.
32 
33 private:
34  TViewPubDataMembers(const TViewPubDataMembers&); // not implemented
35  TViewPubDataMembers& operator=(const TViewPubDataMembers&); // not implemented
36 
37 public:
38  TViewPubDataMembers(TClass *cl = 0);
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
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(TViewPubDataMembers, 0)
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 //////////////////////////////////////////////////////////////////////////
96 class TViewPubDataMembersIter : public TIterator,
97  public std::iterator<std::bidirectional_iterator_tag, TObject *, std::ptrdiff_t,
98  const TObject **, const TObject *&> {
99 protected:
100  const TList *fView; //View we are iterating over.
101  TIter fClassIter; //iterator over the classes
102  TIter fIter; //iterator over the members of the current class
103  Bool_t fStarted; //iteration started
104  Bool_t fDirection; //iteration direction
105 
106  TViewPubDataMembersIter() : fView(0), fClassIter((TCollection *)0), fIter((TCollection *)0), fStarted(kFALSE), fDirection(kIterForward) { }
107 
108 public:
109  TViewPubDataMembersIter(const TViewPubDataMembers *l, Bool_t dir = kIterForward);
110  TViewPubDataMembersIter(const TViewPubDataMembersIter &iter);
111  ~TViewPubDataMembersIter() { }
112  TIterator &operator=(const TIterator &rhs);
113  TViewPubDataMembersIter &operator=(const TViewPubDataMembersIter &rhs);
114 
115  const TCollection *GetCollection() const { return fView; }
116  TObject *Next();
117  void Reset();
118  Bool_t operator!=(const TIterator &aIter) const;
119  Bool_t operator!=(const TViewPubDataMembersIter &aIter) const;
120  TObject *operator*() const { return *fIter; }
121 
122  // ClassDefInline does not yet support non default constructible classes
123  // ClassDefInline(TViewPubDataMembersIter,0)
124 };
125 
126 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
127 #pragma GCC diagnostic pop
128 #endif
129 
130 #endif // ROOT_TViewPubDataMembers