Logo ROOT  
Reference Guide
TListOfFunctions.h
Go to the documentation of this file.
1 // @(#)root/cont
2 // Author: Philippe Canal Aug 2013
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, 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_TListOfFunctions
13 #define ROOT_TListOfFunctions
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TListOfFunctions //
18 // //
19 // A collection of TFunction objects designed for fast access given a //
20 // DeclId_t and for keep track of TFunction that were described //
21 // unloaded function. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "THashList.h"
26 
27 #include "THashTable.h"
28 
29 #include "TDictionary.h"
30 
31 class TExMap;
32 class TFunction;
33 
35 {
36 private:
37  friend class TClass;
38  TClass *fClass; // Context of this list. Not owned.
39 
40  TExMap *fIds; // Map from DeclId_t to TFunction*
41  THashList *fUnloaded; // Holder of TFunction for unloaded functions.
42  THashTable fOverloads; // TLists of overloads.
43  ULong64_t fLastLoadMarker; // Represent interpreter state when we last did a full load.
44 
45  TListOfFunctions(const TListOfFunctions&); // not implemented
46  TListOfFunctions& operator=(const TListOfFunctions&); // not implemented
47  TList *GetListForObjectNonConst(const char* name);
48 
49  void MapObject(TObject *obj);
50  void UnmapObject(TObject *obj);
51 
52 public:
54 
57 
58  virtual void Clear(Option_t *option);
59  virtual void Delete(Option_t *option="");
60 
61  virtual TObject *FindObject(const TObject* obj) const;
62  virtual TObject *FindObject(const char *name) const;
63  virtual TList *GetListForObject(const char* name) const;
64  virtual TList *GetListForObject(const TObject* obj) const;
65  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const;
66 
67  virtual TObject *At(Int_t idx) const;
68  virtual TObject *After(const TObject *obj) const;
69  virtual TObject *Before(const TObject *obj) const;
70  virtual TObject *First() const;
71  virtual TObjLink *FirstLink() const;
72  virtual TObject **GetObjectRef(const TObject *obj) const;
73  virtual TObject *Last() const;
74  virtual TObjLink *LastLink() const;
75 
76  virtual Int_t GetLast() const;
77  virtual Int_t IndexOf(const TObject *obj) const;
78 
79  virtual Int_t GetSize() const;
80 
81 
82  TFunction *Find(DeclId_t id) const;
83  TFunction *Get(DeclId_t id);
84 
85  void AddFirst(TObject *obj);
86  void AddFirst(TObject *obj, Option_t *opt);
87  void AddLast(TObject *obj);
88  void AddLast(TObject *obj, Option_t *opt);
89  void AddAt(TObject *obj, Int_t idx);
90  void AddAfter(const TObject *after, TObject *obj);
91  void AddAfter(TObjLink *after, TObject *obj);
92  void AddBefore(const TObject *before, TObject *obj);
93  void AddBefore(TObjLink *before, TObject *obj);
94 
95  void RecursiveRemove(TObject *obj);
96  TObject *Remove(TObject *obj);
97  TObject *Remove(TObjLink *lnk);
98 
99  void Load();
100  void Unload();
101  void Unload(TFunction *func);
102 
103  ClassDef(TListOfFunctions,0); // List of TFunctions for a class
104 };
105 
106 //////////////////////////////////////////////////////////////////////////
107 // //
108 // TListOfFunctionsIter //
109 // //
110 // Iterator of TListOfFunctions. //
111 // //
112 //////////////////////////////////////////////////////////////////////////
114 {
115 public:
117 
118  using TListIter::operator=;
119 
120  TObject *Next();
121 
123 };
124 
125 
126 #endif // ROOT_TListOfFunctions
TListOfFunctions::RecursiveRemove
void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: TListOfFunctions.cxx:328
l
auto * l
Definition: textangle.C:4
TListOfFunctions
Definition: TListOfFunctions.h:34
TListOfFunctions::~TListOfFunctions
~TListOfFunctions()
Destructor.
Definition: TListOfFunctions.cxx:40
TListOfFunctionsIter
Definition: TListOfFunctions.h:113
TListOfFunctions::AddAt
void AddAt(TObject *obj, Int_t idx)
Insert object at location idx in the list.
Definition: TListOfFunctions.cxx:106
TListOfFunctions::Unload
void Unload()
Mark 'all func' as being unloaded.
Definition: TListOfFunctions.cxx:409
TListOfFunctions::fClass
TClass * fClass
Definition: TListOfFunctions.h:38
TListOfFunctions::GetObjectRef
virtual TObject ** GetObjectRef(const TObject *obj) const
Return address of pointer to obj.
Definition: TListOfFunctions.cxx:499
TListOfFunctions::GetListForObjectNonConst
TList * GetListForObjectNonConst(const char *name)
Return the set of overloads for this name, collecting all available ones.
Definition: TListOfFunctions.cxx:191
TListOfFunctions::MapObject
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
Definition: TListOfFunctions.cxx:51
TDictionary::DeclId_t
const typedef void * DeclId_t
Definition: TDictionary.h:209
TListOfFunctions::FirstLink
virtual TObjLink * FirstLink() const
Definition: TListOfFunctions.cxx:491
TListOfFunctions::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TListOfFunctions.cxx:541
bool
TIterator
Definition: TIterator.h:30
TListIter
Definition: TList.h:197
TListOfFunctions::At
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TListOfFunctions.cxx:459
TListOfFunctions::operator=
TListOfFunctions & operator=(const TListOfFunctions &)
TListOfFunctionsIter::Next
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
Definition: TListOfFunctions.cxx:560
kIterForward
const Bool_t kIterForward
Definition: TCollection.h:40
TListOfFunctions::Clear
virtual void Clear(Option_t *option)
Remove all objects from the list.
Definition: TListOfFunctions.cxx:152
TDictionary.h
TListOfFunctions::Remove
TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TListOfFunctions.cxx:341
TListOfFunctionsIter::TListOfFunctionsIter
TListOfFunctionsIter(const TListOfFunctions *l, Bool_t dir=kIterForward)
Definition: TListOfFunctions.cxx:555
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
THashTable
Definition: THashTable.h:35
TListOfFunctions::AddBefore
void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
Definition: TListOfFunctions.cxx:133
TListOfFunctions::fLastLoadMarker
ULong64_t fLastLoadMarker
Definition: TListOfFunctions.h:43
THashList
Definition: THashList.h:34
TListOfFunctions::MakeIterator
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TListOfFunctions.cxx:451
TListOfFunctions::First
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TListOfFunctions.cxx:483
TListOfFunctions::fIds
TExMap * fIds
Definition: TListOfFunctions.h:40
TListOfFunctions::Delete
virtual void Delete(Option_t *option="")
Delete all TFunction object files.
Definition: TListOfFunctions.cxx:162
TListOfFunctions::LastLink
virtual TObjLink * LastLink() const
Definition: TListOfFunctions.cxx:515
TListOfFunctions::GetListForObject
virtual TList * GetListForObject(const char *name) const
Return the set of overloads for this name, collecting all available ones.
Definition: TListOfFunctions.cxx:230
TListOfFunctions::Find
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'.
Definition: TListOfFunctions.cxx:250
TListOfFunctions::GetLast
virtual Int_t GetLast() const
Returns index of last object in collection.
Definition: TListOfFunctions.cxx:524
TListOfFunctions::fUnloaded
THashList * fUnloaded
Definition: TListOfFunctions.h:41
TListOfFunctions::Last
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TListOfFunctions.cxx:507
TListOfFunctions::UnmapObject
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of functions and their ids.
Definition: TListOfFunctions.cxx:311
TListOfFunctions::DeclId_t
TDictionary::DeclId_t DeclId_t
Definition: TListOfFunctions.h:53
THashList.h
TListOfFunctions::Load
void Load()
Load all the functions known to the interpreter for the scope 'fClass' into this collection.
Definition: TListOfFunctions.cxx:374
TListOfFunctions::Get
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
Definition: TListOfFunctions.cxx:262
TListOfFunctions::IndexOf
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
Definition: TListOfFunctions.cxx:532
TListOfFunctions::AddAfter
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
Definition: TListOfFunctions.cxx:115
ULong64_t
unsigned long long ULong64_t
Definition: RtypesCore.h:74
TListOfFunctions::FindObject
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
Definition: TListOfFunctions.cxx:443
TClass
Definition: TClass.h:80
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TListOfFunctions::TListOfFunctions
TListOfFunctions(const TListOfFunctions &)
name
char name[80]
Definition: TGX11.cxx:110
TListOfFunctions::AddLast
void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TListOfFunctions.cxx:84
TExMap
Definition: TExMap.h:33
TListOfFunctions::AddFirst
void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TListOfFunctions.cxx:62
TListOfFunctions::Before
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition: TListOfFunctions.cxx:475
TFunction
Definition: TFunction.h:30
TList
Definition: TList.h:44
TListOfFunctions::fOverloads
THashTable fOverloads
Definition: TListOfFunctions.h:42
int
THashTable.h
TListOfFunctions::After
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TListOfFunctions.cxx:467