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
31class TExMap;
32class TFunction;
33
35{
36private:
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
48
49 void MapObject(TObject *obj);
50 void UnmapObject(TObject *obj);
51
52public:
54
57
58 void Clear(Option_t *option="") override;
59 void Delete(Option_t *option="") override;
60
61 TObject *FindObject(const TObject* obj) const override;
62 TObject *FindObject(const char *name) const override;
63 virtual TList *GetListForObject(const char* name) const;
64 virtual TList *GetListForObject(const TObject* obj) const;
65 TIterator *MakeIterator(Bool_t dir = kIterForward) const override;
66
67 TObject *At(Int_t idx) const override;
68 TObject *After(const TObject *obj) const override;
69 TObject *Before(const TObject *obj) const override;
70 TObject *First() const override;
71 TObjLink *FirstLink() const override;
72 TObject **GetObjectRef(const TObject *obj) const override;
73 TObject *Last() const override;
74 TObjLink *LastLink() const override;
75
76 Int_t GetLast() const override;
77 Int_t IndexOf(const TObject *obj) const override;
78
79 Int_t GetSize() const override;
80
81 TFunction *Find(DeclId_t id) const;
83
84 void AddFirst(TObject *obj) override;
85 void AddFirst(TObject *obj, Option_t *opt) override;
86 void AddLast(TObject *obj) override;
87 void AddLast(TObject *obj, Option_t *opt) override;
88 void AddAt(TObject *obj, Int_t idx) override;
89 void AddAfter(const TObject *after, TObject *obj) override;
90 void AddAfter(TObjLink *after, TObject *obj) override;
91 void AddBefore(const TObject *before, TObject *obj) override;
92 void AddBefore(TObjLink *before, TObject *obj) override;
93
94 void RecursiveRemove(TObject *obj) override;
95 TObject *Remove(TObject *obj) override;
96 TObject *Remove(TObjLink *lnk) override;
97
98 void Load();
99 void Unload();
100 void Unload(TFunction *func);
101
102 ClassDefOverride(TListOfFunctions,0); // List of TFunctions for a class
103};
104
105//////////////////////////////////////////////////////////////////////////
106// //
107// TListOfFunctionsIter //
108// //
109// Iterator of TListOfFunctions. //
110// //
111//////////////////////////////////////////////////////////////////////////
113{
114public:
116
117 using TListIter::operator=;
118
119 TObject *Next() override;
120
122};
123
124
125#endif // ROOT_TListOfFunctions
unsigned long long ULong64_t
Definition: RtypesCore.h:81
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
const Bool_t kIterForward
Definition: TCollection.h:42
Option_t Option_t option
char name[80]
Definition: TGX11.cxx:110
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:81
const void * DeclId_t
Definition: TDictionary.h:223
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:35
Iterator abstract base class.
Definition: TIterator.h:30
Iterator of linked list.
Definition: TList.h:191
Iterator for TListOfFunctions.
TListOfFunctionsIter(const TListOfFunctions *l, Bool_t dir=kIterForward)
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
THashList * fUnloaded
void Clear(Option_t *option="") override
Remove all objects from the list.
void MapObject(TObject *obj)
Add pair<id, object> to the map of functions and their ids.
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
TObject ** GetObjectRef(const TObject *obj) const override
Return address of pointer to obj.
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Int_t IndexOf(const TObject *obj) const override
Return index of object in collection.
void Delete(Option_t *option="") override
Delete all TFunction object files.
void Load()
Load all the functions known to the interpreter for the scope 'fClass' into this collection.
TListOfFunctions(const TListOfFunctions &)=delete
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * After(const TObject *obj) const override
Returns the object after object obj.
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
TList * GetListForObjectNonConst(const char *name)
Return the set of overloads for this name, collecting all available ones.
~TListOfFunctions()
Destructor.
void UnmapObject(TObject *obj)
Remove a pair<id, object> from 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'.
TListOfFunctions & operator=(const TListOfFunctions &)=delete
THashTable fOverloads
void AddAt(TObject *obj, Int_t idx) override
Insert object at location idx in the list.
virtual TList * GetListForObject(const char *name) const
Return the set of overloads for this name, collecting all available ones.
TDictionary::DeclId_t DeclId_t
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
TObjLink * FirstLink() const override
void Unload()
Mark 'all func' as being unloaded.
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
TObject * Before(const TObject *obj) const override
Returns the object before object obj.
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
void AddLast(TObject *obj) override
Add object at the end of the list.
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
Int_t GetSize() const override
Return the capacity of the collection, i.e.
TObjLink * LastLink() const override
ULong64_t fLastLoadMarker
Int_t GetLast() const override
Returns index of last object in collection.
TObject * FindObject(const TObject *obj) const override
Find object using its hash value (returned by its Hash() member).
A doubly linked list.
Definition: TList.h:38
Mother of all ROOT objects.
Definition: TObject.h:41
TLine l
Definition: textangle.C:4