ROOT logo
ROOT » CORE » CONT » THashList

class THashList: public TList


THashList

THashList implements a hybrid collection class consisting of a
hash table and a list to store TObject's. The hash table is used for
quick access and lookup of objects while the list allows the objects
to be ordered. 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.

/* */


Function Members (Methods)

public:
THashList(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
THashList(TObject* parent, Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
virtual~THashList()
voidTObject::AbstractMethod(const char* method) const
virtual voidTList::Add(TObject* obj)
virtual voidTList::Add(TObject* obj, Option_t* opt)
virtual voidAddAfter(const TObject* after, TObject* obj)
virtual voidAddAfter(TObjLink* after, TObject* obj)
virtual voidTCollection::AddAll(const TCollection* col)
virtual voidAddAt(TObject* obj, Int_t idx)
virtual voidAddBefore(const TObject* before, TObject* obj)
virtual voidAddBefore(TObjLink* before, TObject* obj)
virtual voidAddFirst(TObject* obj)
virtual voidAddFirst(TObject* obj, Option_t* opt)
virtual voidAddLast(TObject* obj)
virtual voidAddLast(TObject* obj, Option_t* opt)
voidTCollection::AddVector(TObject* obj1)
virtual TObject*TList::After(const TObject* obj) const
virtual voidTObject::AppendPad(Option_t* option = "")
Bool_tTCollection::AssertClass(TClass* cl) const
virtual TObject*TList::At(Int_t idx) const
Float_tAverageCollisions() const
virtual TObject*TList::Before(const TObject* obj) 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*TCollection::Clone(const char* newname = "") 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() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
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
virtual TObject*TList::First() const
virtual TObjLink*TList::FirstLink() 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
virtual Int_tTSeqCollection::GetLast() 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**TList::GetObjectRef(const TObject* obj) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual Int_tTCollection::GetSize() 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 Int_tTSeqCollection::IndexOf(const TObject* obj) 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() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTCollection::IsArgNull(const char* where, const TObject* obj) const
Bool_tTList::IsAscending()
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
virtual Bool_tTSeqCollection::IsSorted() const
Bool_tTObject::IsZombie() const
virtual TObject*TList::Last() const
Int_tTSeqCollection::LastIndex() const
virtual TObjLink*TList::LastLink() const
virtual voidTCollection::ls(Option_t* option = "") const
virtual TIterator*TList::MakeIterator(Bool_t dir = kIterForward) const
virtual TIterator*TCollection::MakeReverseIterator() const
voidTObject::MayNotUse(const char* method) const
Long64_tTSeqCollection::Merge(TCollection* list)
virtual Bool_tTObject::Notify()
static Int_tTSeqCollection::ObjCompare(TObject* a, TObject* b)
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
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* option = "") const
virtual voidTCollection::Print(Option_t* option, Int_t recurse) const
virtual voidTCollection::Print(Option_t* option, const char* wildcard, Int_t recurse = 1) const
virtual voidTCollection::Print(Option_t* option, TPRegexp& regexp, Int_t recurse = 1) const
static voidTSeqCollection::QSort(TObject** a, Int_t first, Int_t last)
static voidTSeqCollection::QSort(TObject** a, TObject** b, Int_t first, Int_t last)
static voidTSeqCollection::QSort(TObject** a, Int_t nBs, TObject*** b, Int_t first, Int_t last)
virtual Int_tTObject::Read(const char* name)
virtual voidRecursiveRemove(TObject* obj)
voidRehash(Int_t newCapacity)
virtual TObject*Remove(TObject* obj)
virtual TObject*Remove(TObjLink* lnk)
virtual voidTSeqCollection::RemoveAfter(TObject* after)
voidTCollection::RemoveAll()
virtual voidTCollection::RemoveAll(TCollection* col)
virtual TObject*TSeqCollection::RemoveAt(Int_t idx)
virtual voidTSeqCollection::RemoveBefore(TObject* before)
virtual voidTSeqCollection::RemoveFirst()
virtual voidTList::RemoveLast()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
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 = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidTCollection::SetName(const char* name)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTCollection::SetOwner(Bool_t enable = kTRUE)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidTList::Sort(Bool_t order = kSortAscending)
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
voidTSeqCollection::UnSort()
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 voidTSeqCollection::Changed()
virtual voidTList::DeleteLink(TObjLink* lnk)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
TObjLink**TList::DoSort(TObjLink** head, Int_t n)
TObjLink*TList::FindLink(const TObject* obj, Int_t& idx) const
virtual const char*TCollection::GetCollectionEntryName(TObject* entry) const
TObjLink*TList::LinkAt(Int_t idx) const
Bool_tTList::LnkCompare(TObjLink* l1, TObjLink* l2)
voidTObject::MakeZombie()
virtual TObjLink*TList::NewLink(TObject* obj, TObjLink* prev = NULL)
virtual TObjLink*TList::NewOptLink(TObject* obj, Option_t* opt, TObjLink* prev = NULL)
virtual voidTCollection::PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const
virtual voidTCollection::PrintCollectionHeader(Option_t* option) const
private:
THashList(const THashList&)
THashList&operator=(const THashList&)

Data Members

protected:
Bool_tTList::fAscending! sorting order (when calling Sort() or for TSortedList)
TObjLink*TList::fCache! cache to speedup sequential calling of Before() and After() functions
TObjLink*TList::fFirst! pointer to first entry in linked list
TObjLink*TList::fLast! pointer to last entry in linked list
TStringTCollection::fNamename of the collection
Int_tTCollection::fSizenumber of elements in collection
Bool_tTSeqCollection::fSortedtrue if collection has been sorted
THashTable*fTableHashtable used for quick lookup of objects

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

THashList(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
 Create a THashList object. Capacity is the initial hashtable capacity
 (i.e. number of slots), by default kInitHashTableCapacity = 17, and
 rehash 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 rehash
 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 rehash=0 the table will
 NOT automatically be rehashed. Use Rehash() for manual rehashing.
 WARNING !!!
 If the name of an object in the HashList is modified, The hashlist
 must be Rehashed
THashList(TObject* parent, Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
 For backward compatibility only. Use other ctor.
~THashList()
 Delete a hashlist. Objects are not deleted unless the THashList is the
 owner (set via SetOwner()).
void AddFirst(TObject* obj)
 Add object at the beginning of the list.
void AddFirst(TObject* obj, Option_t* opt)
 Add object at the beginning of the list and also store option.
 Storing an option is useful when one wants to change the behaviour
 of an object a little without having to create a complete new
 copy of the object. This feature is used, for example, by the Draw()
 method. It allows the same object to be drawn in different ways.
void AddLast(TObject* obj)
 Add object at the end of the list.
void AddLast(TObject* obj, Option_t* opt)
 Add object at the end of the list and also store option.
 Storing an option is useful when one wants to change the behaviour
 of an object a little without having to create a complete new
 copy of the object. This feature is used, for example, by the Draw()
 method. It allows the same object to be drawn in different ways.
void AddBefore(const TObject* before, TObject* obj)
 Insert object before object before in the list.
void AddBefore(TObjLink* before, TObject* obj)
 Insert object before object before in the list.
void AddAfter(const TObject* after, TObject* obj)
 Insert object after object after in the list.
void AddAfter(TObjLink* after, TObject* obj)
 Insert object after object after in the list.
void AddAt(TObject* obj, Int_t idx)
 Insert object at location idx in the list.
Float_t AverageCollisions() const
 Return the average collision rate. The higher the number the longer
 the linked lists in the hashtable, the slower the lookup. If the number
 is high, or lookup noticeably too slow, perfrom a Rehash().
void Clear(Option_t* option = "")
 Remove all objects from the list. Does not delete the objects unless
 the THashList is the owner (set via SetOwner()).
void Delete(Option_t* option = "")
 Remove all objects from the list AND delete all heap based objects.
 If option="slow" then keep list consistent during delete. This allows
 recursive list operations during the delete (e.g. during the dtor
 of an object in this list one can still access the list to search for
 other not yet deleted objects).
TObject * FindObject(const char* name) const
 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) const
 Find object using its hash value (returned by its Hash() member).
TList * GetListForObject(const char* name) const
 Return the THashTable's list (bucket) in which obj can be found based on
 its hash; see THashTable::GetListForObject().
TList * GetListForObject(const TObject* obj) const
 Return the THashTable's list (bucket) in which obj can be found based on
 its hash; see THashTable::GetListForObject().
void RecursiveRemove(TObject* obj)
 Remove object from this collection and recursively remove the object
 from all other objects (and collections).
 This function overrides TCollection::RecursiveRemove that calls
 the Remove function. THashList::Remove cannot be called because
 it uses the hash value of the hash table. This hash value
 is not available anymore when RecursiveRemove is called from
 the TObject destructor.
void Rehash(Int_t newCapacity)
 Rehash the hashlist. 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.
TObject * Remove(TObject* obj)
 Remove object from the list.
TObject * Remove(TObjLink* lnk)
 Remove object via its objlink from the list.
THashList(const THashList& )
THashList& operator=(const THashList& )