Logo ROOT   6.08/07
Reference Guide
THashList.h
Go to the documentation of this file.
1 // @(#)root/cont:$Id$
2 // Author: Fons Rademakers 10/08/95
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_THashList
13 #define ROOT_THashList
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // THashList //
19 // //
20 // THashList implements a hybrid collection class consisting of a //
21 // hash table and a list to store TObject's. The hash table is used for //
22 // quick access and lookup of objects while the list allows the objects //
23 // to be ordered. The hash value is calculated using the value returned //
24 // by the TObject's Hash() function. Each class inheriting from TObject //
25 // can override Hash() as it sees fit. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #ifndef ROOT_TList
30 #include "TList.h"
31 #endif
32 
33 class THashTable;
34 
35 
36 class THashList : public TList {
37 
38 protected:
39  THashTable *fTable; //Hashtable used for quick lookup of objects
40 
41 private:
42  THashList(const THashList&); // not implemented
43  THashList& operator=(const THashList&); // not implemented
44 
45 public:
48  virtual ~THashList();
49  Float_t AverageCollisions() const;
50  void Clear(Option_t *option="");
51  void Delete(Option_t *option="");
52 
53  TObject *FindObject(const char *name) const;
54  TObject *FindObject(const TObject *obj) const;
55 
56  const TList *GetListForObject(const char *name) const;
57  const TList *GetListForObject(const TObject *obj) const;
58 
59  void AddFirst(TObject *obj);
60  void AddFirst(TObject *obj, Option_t *opt);
61  void AddLast(TObject *obj);
62  void AddLast(TObject *obj, Option_t *opt);
63  void AddAt(TObject *obj, Int_t idx);
64  void AddAfter(const TObject *after, TObject *obj);
65  void AddAfter(TObjLink *after, TObject *obj);
66  void AddBefore(const TObject *before, TObject *obj);
67  void AddBefore(TObjLink *before, TObject *obj);
68  void RecursiveRemove(TObject *obj);
69  void Rehash(Int_t newCapacity);
70  TObject *Remove(TObject *obj);
71  TObject *Remove(TObjLink *lnk);
72 
73  ClassDef(THashList,0) //Doubly linked list with hashtable for lookup
74 };
75 
76 #endif
void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: THashList.cxx:68
void AddLast(TObject *obj)
Add object at the end of the list.
Definition: THashList.cxx:90
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: THashList.cxx:184
Float_t AverageCollisions() const
Return the average collision rate.
Definition: THashList.cxx:159
int Int_t
Definition: RtypesCore.h:41
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:213
THashList & operator=(const THashList &)
void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: THashList.cxx:253
THashTable * fTable
Definition: THashList.h:39
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
const TList * GetListForObject(const char *name) const
Return the THashTable's list (bucket) in which obj can be found based on its hash; see THashTable::Ge...
Definition: THashList.cxx:230
A doubly linked list.
Definition: TList.h:47
THashList(const THashList &)
void Clear(Option_t *option="")
Remove all objects from the list.
Definition: THashList.cxx:168
void AddAt(TObject *obj, Int_t idx)
Insert object at location idx in the list.
Definition: THashList.cxx:148
TObject * Remove(TObject *obj)
Remove object from the list.
Definition: THashList.cxx:285
void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
Definition: THashList.cxx:130
void Rehash(Int_t newCapacity)
Rehash the hashlist.
Definition: THashList.cxx:277
virtual ~THashList()
Delete a hashlist.
Definition: THashList.cxx:59
void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
Definition: THashList.cxx:112
Mother of all ROOT objects.
Definition: TObject.h:37
char name[80]
Definition: TGX11.cxx:109