46 Warning(
"THashTable",
"capacity (%d) < 0", capacity);
48 }
else if (capacity == 0)
57 if (rehashlevel < 2) rehashlevel = 0;
84 fCont[slot]->Add(obj);
124 fCont[slot]->AddBefore(before,obj);
126 fCont[slot]->Add(obj);
171 for (
int i = 0; i <
fSize; i++) {
176 fCont[i]->SetOwner();
177 fCont[i]->Clear(option);
197 if (
fCont[slot])
return fCont[slot]->GetSize();
207 if (
IsArgNull(
"Collisions", obj))
return 0;
213 if (
fCont[slot])
return fCont[slot]->GetSize();
224 for (
int i = 0; i <
fSize; i++)
253 if (
IsArgNull(
"FindObject", obj))
return nullptr;
259 if (
fCont[slot])
return fCont[slot]->FindObject(obj);
284 if (
IsArgNull(
"GetListForObject", obj))
return nullptr;
298 if (
IsArgNull(
"GetObjectRef", obj))
return nullptr;
304 if (
fCont[slot])
return fCont[slot]->GetObjectRef(obj);
330 if (strstr(option,
"details")==
nullptr) {
342 printf(
"Slot #%d:\n",cursor);
344 fCont[cursor]->Print();
377 while ((obj = next()))
381 while ((obj = next()))
392 "During the rehash of %p one or more element was added or removed. The initalize size was %d and now it is %d",
447 for (
int i = 0; i <
fSize; i++) {
490 fListCursor = (TListIter *)iter.fListCursor->GetCollection()->MakeIterator();
492 fListCursor->operator=(*iter.fListCursor);
555 if (slot == -1)
return nullptr;
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
const char Option_t
Option string (const char).
#define R__COLLECTION_READ_LOCKGUARD(mutex)
const Bool_t kIterForward
#define R__COLLECTION_WRITE_LOCKGUARD(mutex)
externTObjectTable * gObjectTable
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
Bool_t IsArgNull(const char *where, const TObject *obj) const
Returns true if object is a null pointer.
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
virtual Int_t GetEntries() const
virtual void PrintCollectionHeader(Option_t *option) const
Print the collection header.
TCollection(const TCollection &)=delete
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
Bool_t operator!=(const TIterator &aIter) const override
This operator compares two TIterator objects.
const THashTable * fTable
~THashTableIter()
Delete hashtable iterator.
void Reset() override
Reset the hashtable iterator.
TObject * operator*() const override
Return pointer to current object or nullptr.
TObject * Next() override
Return next object in hashtable. Returns 0 when no more objects in table.
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator.
Int_t NextSlot()
Returns index of next slot in table containing list to be iterated.
THashTable implements a hash table to store TObject's.
Float_t AverageCollisions() const
void Add(TObject *obj) override
Add object to the hash table.
friend class THashTableIter
const TList * GetListForObject(const char *name) const
Return the TList corresponding to object's name based hash value.
void AddImpl(Int_t slot, TObject *object)
Helper function doing the actual add to the table give a slot and object.
TObject * Remove(TObject *obj) override
Remove object from the hashtable.
void Rehash(Int_t newCapacity, Bool_t checkObjValidity=kTRUE)
Rehash the hashtable.
TObject * RemoveSlow(TObject *obj)
Remove object from the hashtable without using the hash value.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Returns a hash table iterator.
TObject ** GetObjectRef(const TObject *obj) const override
Return address of pointer to obj.
THashTable(const THashTable &)=delete
void AddBefore(const TObject *before, TObject *obj)
Add object to the hash table.
void AddAll(const TCollection *col) override
Add all objects from collection col to this collection.
TObject * FindObject(const char *name) const override
Find object using its name.
Int_t GetSize() const override
Return the capacity of the collection, i.e.
void Clear(Option_t *option="") override
Remove all objects from the table.
Int_t Collisions(const char *name) const
Returns the number of collisions for an object with a certain name (i.e.
void Print(Option_t *option, Int_t recurse) const override
Print the collection header and its elements.
void Delete(Option_t *option="") override
Remove all objects from the table AND delete all heap based objects.
virtual ~THashTable()
Delete a hashtable.
Int_t GetCheckedHashValue(TObject *obj) const
Int_t GetHashValue(const TObject *obj) const
Iterator abstract base class.
virtual TClass * IsA() const
const TCollection * GetCollection() const override
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
static Bool_t GetObjectStat()
Get status of object stat flag.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
TObject()
TObject constructor.
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Long_t NextPrime(Long_t x)
TMath Base functions.
externTVirtualRWMutex * gCoreMutex