library: libCore
#include "THashTable.h"

THashTable


class description - header file - source file
viewCVS header - viewCVS source

class THashTable: public TCollection

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
THashTable(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
virtual~THashTable()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TObject* obj)
virtual voidAddAll(const TCollection* col)
voidTCollection::AddVector(TObject* obj1)
virtual voidTObject::AppendPad(Option_t* option = "")
Bool_tTCollection::AssertClass(TClass* cl) const
Float_tAverageCollisions() const
virtual voidTCollection::Browse(TBrowser* b)
Int_tTCollection::Capacity() const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual TObject*TObject::Clone(const char* newname = "") const
Int_tCollisions(const char* name) const
Int_tCollisions(TObject* obj) const
virtual Int_tTCollection::Compare(const TObject* obj) const
Bool_tTCollection::Contains(const char* name) const
Bool_tTCollection::Contains(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidDelete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTCollection::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTCollection::Dump() const
static voidTCollection::EmptyGarbageCollection()
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*FindObject(const char* name) const
virtual TObject*FindObject(const TObject* obj) const
static voidTCollection::GarbageCollect(TObject* obj)
static TCollection*TCollection::GetCurrentCollection()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tTCollection::GetEntries() const
virtual const char*TObject::GetIconName() const
TList*GetListForObject(const char* name) const
TList*GetListForObject(const TObject* obj) const
virtual const char*TCollection::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
virtual TObject**GetObjectRef(const TObject* obj) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tGetRehashLevel() const
virtual Int_tGetSize() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Int_tTCollection::GrowBy(Int_t delta) const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTCollection::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTCollection::IsArgNull(const char* where, const TObject* obj) const
virtual Bool_tTCollection::IsEmpty() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTCollection::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tTCollection::IsOwner() const
virtual Bool_tTCollection::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTCollection::ls(Option_t* option = "") const
virtual TIterator*MakeIterator(Bool_t dir = kIterForward) const
virtual TIterator*TCollection::MakeReverseIterator() const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TObject*TCollection::operator()(const char* name) const
virtual voidTCollection::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTCollection::Print(Option_t* wildcard = "") const
virtual voidTCollection::Print(Option_t* wildcard, Option_t* option) const
virtual Int_tTObject::Read(const char* name)
virtual voidTCollection::RecursiveRemove(TObject* obj)
voidRehash(Int_t newCapacity, Bool_t checkObjValidity = kTRUE)
virtual TObject*Remove(TObject* obj)
voidTCollection::RemoveAll()
virtual voidTCollection::RemoveAll(TCollection* col)
TObject*RemoveSlow(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTCollection::SetCurrentCollection()
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
voidTCollection::SetName(const char* name)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTCollection::SetOwner(Bool_t enable = kTRUE)
voidSetRehashLevel(Int_t rehash)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
static voidTCollection::StartGarbageCollection()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTCollection::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTCollection::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
THashTable(const THashTable&)
Int_tGetHashValue(const TObject* obj) const
Int_tGetHashValue(TString& s) const
Int_tGetHashValue(const char* str) const
THashTable&operator=(const THashTable&)

Data Members

public:
enum TCollection::[unnamed] { kIsOwner
kInitCapacity
kInitHashTableCapacity
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTCollection::fNamename of the collection
Int_tTCollection::fSizenumber of elements in collection
private:
TList**fContHash table (table of lists)
Int_tfEntriesNumber of objects in table
Int_tfUsedSlotsNumber of used slots
Int_tfRehashLevelAverage collision rate which triggers rehash

Class Description

                                                                      
 THashTable                                                           
                                                                      
 THashTable implements a hash table to store TObject's. The hash      
 value is calculated using the value returned by the TObject's        
 Hash() function. Each class inheriting from TObject can override     
 Hash() as it sees fit.                                               
 THashTable does not preserve the insertion order of the objects.     
 If the insertion order is important AND fast retrieval is needed     
 use THashList instead.                                               
/* */
                                                                      

THashTable(Int_t capacity, Int_t rehashlevel)
 Create a THashTable object. Capacity is the initial hashtable capacity
 (i.e. number of slots), by default kInitHashTableCapacity = 17, and
 rehashlevel is the value at which a rehash will be triggered. I.e. when
 the average size of the linked lists at a slot becomes longer than
 rehashlevel then the hashtable will be resized and refilled to reduce
 the collision rate to about 1. The higher the collision rate, i.e. the
 longer the linked lists, the longer lookup will take. If rehashlevel=0
 the table will NOT automatically be rehashed. Use Rehash() for manual
 rehashing.
~THashTable()
 Delete a hashtable. Objects are not deleted unless the THashTable is the
 owner (set via SetOwner()).
void Add(TObject *obj)
 Add object to the hash table. Its position in the table will be
 determined by the value returned by its Hash() function.
void AddAll(const TCollection *col)
 Add all objects from collection col to this collection.
 Implemented for more efficient rehashing.
void Clear(Option_t *option)
 Remove all objects from the table. Does not delete the objects
 unless the THashTable is the owner (set via SetOwner()).
Int_t Collisions(const char *name)
 Returns the number of collisions for an object with a certain name
 (i.e. number of objects in same slot in the hash table, i.e. length
 of linked list).
Int_t Collisions(TObject *obj)
 Returns the number of collisions for an object (i.e. number of objects
 in same slot in the hash table, i.e. length of linked list).
void Delete(Option_t *)
 Remove all objects from the table AND delete all heap based objects.
TObject * FindObject(const char *name)
 Find object using its name. Uses the hash value returned by the
 TString::Hash() after converting name to a TString.
TObject * FindObject(const TObject *obj)
 Find object using its hash value (returned by its Hash() member).
TList * GetListForObject(const char *name)
 Return the TList corresponding to object's name based hash value.
 One can iterate this list "manually" to find, e.g. objects with
 the same name.
TList * GetListForObject(const TObject *obj)
 Return the TList corresponding to object's hash value.
 One can iterate this list "manually" to find, e.g. identical
 objects.
TObject ** GetObjectRef(const TObject *obj)
 Return address of pointer to obj
TIterator * MakeIterator(Bool_t dir)
 Returns a hash table iterator.
void Rehash(Int_t newCapacity, Bool_t checkObjValidity)
 Rehash the hashtable. If the collision rate becomes too high (i.e.
 the average size of the linked lists become too long) then lookup
 efficiency decreases since relatively long lists have to be searched
 every time. To improve performance rehash the hashtable. This resizes
 the table to newCapacity slots and refills the table. Use
 AverageCollisions() to check if you need to rehash. Set checkObjValidity
 to kFALSE if you know that all objects in the table are still valid
 (i.e. have not been deleted from the system in the meanwhile).
TObject * Remove(TObject *obj)
 Remove object from the hashtable.
TObject * RemoveSlow(TObject *obj)
 Remove object from the hashtable without using the hash value.
Float_t AverageCollisions()
Int_t GetHashValue(const TObject *obj)
Int_t GetHashValue(const TObject *obj)
Int_t GetHashValue(TString &s)
{ return s.Hash() % fSize; }
THashTable(const THashTable&)
THashTable& operator=(const THashTable&)
Int_t GetRehashLevel()
{ return fRehashLevel; }
Int_t GetSize()
{ return fEntries; }
void SetRehashLevel(Int_t rehash)
{ fRehashLevel = rehash; }

Author: Fons Rademakers 27/09/95
Last update: root/cont:$Name: $:$Id: THashTable.cxx,v 1.14 2006/10/27 16:03:37 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.