Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

THashList.h

Go to the documentation of this file.
00001 // @(#)root/cont:$Name:  $:$Id: THashList.h,v 1.5 2002/08/07 10:58:31 brun Exp $
00002 // Author: Fons Rademakers   10/08/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_THashList
00013 #define ROOT_THashList
00014 
00015 
00017 //                                                                      //
00018 // THashList                                                            //
00019 //                                                                      //
00020 // THashList implements a hybrid collection class consisting of a       //
00021 // hash table and a list to store TObject's. The hash table is used for //
00022 // quick access and lookup of objects while the list allows the objects //
00023 // to be ordered. The hash value is calculated using the value returned //
00024 // by the TObject's Hash() function. Each class inheriting from TObject //
00025 // can override Hash() as it sees fit.                                  //
00026 //                                                                      //
00028 
00029 #ifndef ROOT_TList
00030 #include "TList.h"
00031 #endif
00032 
00033 class THashTable;
00034 
00035 
00036 class THashList : public TList {
00037 
00038 protected:
00039    THashTable   *fTable;    //Hashtable used for quick lookup of objects
00040 
00041 public:
00042    THashList(Int_t capacity=TCollection::kInitHashTableCapacity, Int_t rehash=0);
00043    THashList(TObject *parent, Int_t capacity=TCollection::kInitHashTableCapacity, Int_t rehash=0);
00044    virtual    ~THashList();
00045    Float_t    AverageCollisions() const;
00046    void       Clear(Option_t *option="");
00047    void       Delete(Option_t *option="");
00048 
00049    TObject   *FindObject(const char *name) const;
00050    TObject   *FindObject(const TObject *obj) const;
00051 
00052    void       AddFirst(TObject *obj);
00053    void       AddFirst(TObject *obj, Option_t *opt);
00054    void       AddLast(TObject *obj);
00055    void       AddLast(TObject *obj, Option_t *opt);
00056    void       AddAt(TObject *obj, Int_t idx);
00057    void       AddAfter(TObject *after, TObject *obj);
00058    void       AddAfter(TObjLink *after, TObject *obj);
00059    void       AddBefore(TObject *before, TObject *obj);
00060    void       AddBefore(TObjLink *before, TObject *obj);
00061    void       RecursiveRemove(TObject *obj);
00062    void       Rehash(Int_t newCapacity);
00063    TObject   *Remove(TObject *obj);
00064    TObject   *Remove(TObjLink *lnk);
00065 
00066    ClassDef(THashList,0)  //Doubly linked list with hashtable for lookup
00067 };
00068 
00069 #endif

Generated on Thu Dec 18 14:52:21 2003 for ROOT by doxygen1.2.16