Logo ROOT   6.12/07
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  TClass *fClass; // Context of this list. Not owned.
38 
39  TExMap *fIds; // Map from DeclId_t to TFunction*
40  THashList *fUnloaded; // Holder of TFunction for unloaded functions.
41  THashTable fOverloads; // TLists of overloads.
42  ULong64_t fLastLoadMarker; // Represent interpreter state when we last did a full load.
43 
44  TListOfFunctions(const TListOfFunctions&); // not implemented
45  TListOfFunctions& operator=(const TListOfFunctions&); // not implemented
46  TList *GetListForObjectNonConst(const char* name);
47 
48  void MapObject(TObject *obj);
49  void UnmapObject(TObject *obj);
50 
51 public:
53 
56 
57  virtual void Clear(Option_t *option);
58  virtual void Delete(Option_t *option="");
59 
60  virtual TObject *FindObject(const TObject* obj) const;
61  virtual TObject *FindObject(const char *name) const;
62  virtual TList *GetListForObject(const char* name) const;
63  virtual TList *GetListForObject(const TObject* obj) const;
64  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const;
65 
66  virtual TObject *At(Int_t idx) const;
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  virtual Int_t GetLast() const;
76  virtual Int_t IndexOf(const TObject *obj) const;
77 
78  virtual Int_t GetSize() const;
79 
80 
81  TFunction *Find(DeclId_t id) const;
82  TFunction *Get(DeclId_t id);
83 
84  void AddFirst(TObject *obj);
85  void AddFirst(TObject *obj, Option_t *opt);
86  void AddLast(TObject *obj);
87  void AddLast(TObject *obj, Option_t *opt);
88  void AddAt(TObject *obj, Int_t idx);
89  void AddAfter(const TObject *after, TObject *obj);
90  void AddAfter(TObjLink *after, TObject *obj);
91  void AddBefore(const TObject *before, TObject *obj);
92  void AddBefore(TObjLink *before, TObject *obj);
93 
94  void RecursiveRemove(TObject *obj);
95  TObject *Remove(TObject *obj);
96  TObject *Remove(TObjLink *lnk);
97 
98  void Load();
99  void Unload();
100  void Unload(TFunction *func);
101 
102  ClassDef(TListOfFunctions,0); // List of TFunctions for a class
103 };
104 
105 //////////////////////////////////////////////////////////////////////////
106 // //
107 // TListOfFunctionsIter //
108 // //
109 // Iterator of TListOfFunctions. //
110 // //
111 //////////////////////////////////////////////////////////////////////////
113 {
114 public:
116 
117  using TListIter::operator=;
118 
119  TObject *Next();
120 
122 };
123 
124 
125 #endif // ROOT_TListOfFunctions
ULong64_t fLastLoadMarker
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
const char Option_t
Definition: RtypesCore.h:62
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual TObjLink * LastLink() const
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'...
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
virtual Int_t GetSize() const
const void * DeclId_t
Definition: TDictionary.h:205
TObject * Remove(TObject *obj)
Remove object from the list.
Iterator abstract base class.
Definition: TIterator.h:30
Iterator of linked list.
Definition: TList.h:197
virtual void Clear(Option_t *option)
Remove all objects from the list.
void AddFirst(TObject *obj)
Add object at the beginning of the list.
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:35
virtual Int_t GetLast() const
Returns index of last object in collection.
#define ClassDef(name, id)
Definition: Rtypes.h:320
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
void AddAt(TObject *obj, Int_t idx)
Insert object at location idx in the list.
virtual void Delete(Option_t *option="")
Delete all TFunction object files.
const Bool_t kIterForward
Definition: TCollection.h:40
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
A doubly linked list.
Definition: TList.h:44
Iterator for TListOfFunctions.
TList * GetListForObjectNonConst(const char *name)
Return the set of overloads for this name, collecting all available ones.
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
virtual TObjLink * FirstLink() const
~TListOfFunctions()
Destructor.
void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
void AddLast(TObject *obj)
Add object at the end of the list.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
void Unload()
Mark &#39;all func&#39; as being unloaded.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
TListOfFunctions & operator=(const TListOfFunctions &)
TListOfFunctions(const TListOfFunctions &)
Mother of all ROOT objects.
Definition: TObject.h:37
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:28
THashTable fOverloads
void Load()
Load all the functions known to the interpreter for the scope &#39;fClass&#39; into this collection.
TDictionary::DeclId_t DeclId_t
auto * l
Definition: textangle.C:4
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
THashList * fUnloaded
void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
virtual TList * GetListForObject(const char *name) const
Return the set of overloads for this name, collecting all available ones.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
virtual TObject ** GetObjectRef(const TObject *obj) const
Return address of pointer to obj.
char name[80]
Definition: TGX11.cxx:109
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
void UnmapObject(TObject *obj)
Remove a pair<id, object> from the map of functions and their ids.