Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/THashList.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/cont:$Id$
0002 // Author: Fons Rademakers   10/08/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_THashList
0013 #define ROOT_THashList
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // THashList                                                            //
0019 //                                                                      //
0020 // THashList implements a hybrid collection class consisting of a       //
0021 // hash table and a list to store TObject's. The hash table is used for //
0022 // quick access and lookup of objects while the list allows the objects //
0023 // to be ordered. The hash value is calculated using the value returned //
0024 // by the TObject's Hash() function. Each class inheriting from TObject //
0025 // can override Hash() as it sees fit.                                  //
0026 //                                                                      //
0027 //////////////////////////////////////////////////////////////////////////
0028 
0029 #include "TList.h"
0030 
0031 class THashTable;
0032 
0033 
0034 class THashList : public TList {
0035 
0036 protected:
0037    THashTable   *fTable;    //Hashtable used for quick lookup of objects
0038 
0039 private:
0040    THashList(const THashList&) = delete;
0041    THashList& operator=(const THashList&) = delete;
0042 
0043 public:
0044    THashList(Int_t capacity=TCollection::kInitHashTableCapacity, Int_t rehash=0);
0045    THashList(TObject *parent, Int_t capacity=TCollection::kInitHashTableCapacity, Int_t rehash=0);
0046    virtual    ~THashList();
0047    Float_t    AverageCollisions() const;
0048    void       Clear(Option_t *option="") override;
0049    void       Delete(Option_t *option="") override;
0050 
0051    TObject   *FindObject(const char *name) const override;
0052    TObject   *FindObject(const TObject *obj) const override;
0053 
0054    const TList *GetListForObject(const char *name) const;
0055    const TList *GetListForObject(const TObject *obj) const;
0056 
0057    void       AddFirst(TObject *obj) override;
0058    void       AddFirst(TObject *obj, Option_t *opt) override;
0059    void       AddLast(TObject *obj) override;
0060    void       AddLast(TObject *obj, Option_t *opt) override;
0061    void       AddAt(TObject *obj, Int_t idx) override;
0062    void       AddAfter(const TObject *after, TObject *obj) override;
0063    void       AddAfter(TObjLink *after, TObject *obj) override;
0064    void       AddBefore(const TObject *before, TObject *obj) override;
0065    void       AddBefore(TObjLink *before, TObject *obj) override;
0066    void       RecursiveRemove(TObject *obj) override;
0067    void       Rehash(Int_t newCapacity);
0068    TObject   *Remove(TObject *obj) override;
0069    TObject   *Remove(TObjLink *lnk) override;
0070    bool       UseRWLock(Bool_t enable = true) override;
0071 
0072    ClassDefOverride(THashList,0)  //Doubly linked list with hashtable for lookup
0073 };
0074 
0075 #endif