ROOT  6.06/09
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 #ifndef ROOT_THastList
26 #include "THashList.h"
27 #endif
28 
29 #ifndef ROOT_THastTable
30 #include "THashTable.h"
31 #endif
32 
33 #ifndef ROOT_TDictionary
34 #include "TDictionary.h"
35 #endif
36 
37 class TExMap;
38 class TFunction;
39 
41 {
42 private:
43  TClass *fClass; // Context of this list. Not owned.
44 
45  TExMap *fIds; // Map from DeclId_t to TFunction*
46  THashList *fUnloaded; // Holder of TFunction for unloaded functions.
47  THashTable fOverloads; // TLists of overloads.
48  ULong64_t fLastLoadMarker; // Represent interpreter state when we last did a full load.
49 
50  TListOfFunctions(const TListOfFunctions&); // not implemented
51  TListOfFunctions& operator=(const TListOfFunctions&); // not implemented
52  TList *GetListForObjectNonConst(const char* name);
53 
54  void MapObject(TObject *obj);
55  void UnmapObject(TObject *obj);
56 
57 public:
59 
62 
63  virtual void Clear(Option_t *option);
64  virtual void Delete(Option_t *option="");
65 
66  virtual TObject *FindObject(const TObject* obj) const;
67  virtual TObject *FindObject(const char *name) const;
68  virtual TList *GetListForObject(const char* name) const;
69  virtual TList *GetListForObject(const TObject* obj) const;
70  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const;
71 
72  virtual TObject *At(Int_t idx) const;
73  virtual TObject *After(const TObject *obj) const;
74  virtual TObject *Before(const TObject *obj) const;
75  virtual TObject *First() const;
76  virtual TObjLink *FirstLink() const;
77  virtual TObject **GetObjectRef(const TObject *obj) const;
78  virtual TObject *Last() const;
79  virtual TObjLink *LastLink() const;
80 
81  virtual Int_t GetLast() const;
82  virtual Int_t IndexOf(const TObject *obj) const;
83 
84  virtual Int_t GetSize() const;
85 
86 
87  TFunction *Find(DeclId_t id) const;
88  TFunction *Get(DeclId_t id);
89 
90  void AddFirst(TObject *obj);
91  void AddFirst(TObject *obj, Option_t *opt);
92  void AddLast(TObject *obj);
93  void AddLast(TObject *obj, Option_t *opt);
94  void AddAt(TObject *obj, Int_t idx);
95  void AddAfter(const TObject *after, TObject *obj);
96  void AddAfter(TObjLink *after, TObject *obj);
97  void AddBefore(const TObject *before, TObject *obj);
98  void AddBefore(TObjLink *before, TObject *obj);
99 
100  void RecursiveRemove(TObject *obj);
102  TObject *Remove(TObjLink *lnk);
103 
104  void Load();
105  void Unload();
106  void Unload(TFunction *func);
107 
108  ClassDef(TListOfFunctions,0); // List of TFunctions for a class
109 };
110 
111 //////////////////////////////////////////////////////////////////////////
112 // //
113 // TListOfFunctionsIter //
114 // //
115 // Iterator of TListOfFunctions. //
116 // //
117 //////////////////////////////////////////////////////////////////////////
119 {
120 public:
122 
123  using TListIter::operator=;
124 
125  TObject *Next();
126 
128 };
129 
130 
131 #endif // ROOT_TListOfFunctions
virtual TObject * FindObject(const TObject *obj) const
Find object using its hash value (returned by its Hash() member).
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
ULong64_t fLastLoadMarker
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
const char Option_t
Definition: RtypesCore.h:62
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
virtual Int_t GetSize() const
virtual TObject ** GetObjectRef(const TObject *obj) const
Return address of pointer to obj.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t GetLast() const
Returns index of last object in collection.
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
virtual TObjLink * LastLink() const
const void * DeclId_t
Definition: TDictionary.h:209
TObject * Remove(TObject *obj)
Remove object from the list.
Iterator abstract base class.
Definition: TIterator.h:32
Iterator of linked list.
Definition: TList.h:187
virtual void Clear(Option_t *option)
Remove all objects from the list.
void AddFirst(TObject *obj)
Add object at the beginning of the list.
virtual TObjLink * FirstLink() const
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:39
#define ClassDef(name, id)
Definition: Rtypes.h:254
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
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:43
virtual Int_t IndexOf(const TObject *obj) const
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
A doubly linked list.
Definition: TList.h:47
Iterator for TListOfFunctions.
TList * GetListForObjectNonConst(const char *name)
Return the set of overloads for this name, collecting all available ones.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
TListOfFunctionsIter(const TListOfFunctions *l, Bool_t dir=kIterForward)
~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.
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
ClassDef(TListOfFunctions, 0)
void MapObject(TObject *obj)
Add pair to the map of functions and their ids.
TFunction * Find(DeclId_t id) const
Return the TMethod or TFunction describing the function corresponding to the Decl 'id'...
void Unload()
Mark 'all func' as being unloaded.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
double func(double *x, double *p)
Definition: stressTF1.cxx:213
TListOfFunctions & operator=(const TListOfFunctions &)
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
TListOfFunctions(const TListOfFunctions &)
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual TList * GetListForObject(const char *name) const
Return the set of overloads for this name, collecting all available ones.
Mother of all ROOT objects.
Definition: TObject.h:58
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
THashTable fOverloads
void Load()
Load all the functions known to the interpreter for the scope 'fClass' into this collection.
TDictionary::DeclId_t DeclId_t
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 TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
TObject * obj
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35
void UnmapObject(TObject *obj)
Remove a pair from the map of functions and their ids.