74 return fTable->AverageCollisions();
117 return fTable->Collisions(keyname);
126 return fTable->Collisions(key);
138 while ((
a = (
TPair *)next()))
139 if (
a->Key() &&
a->Key()->IsOnHeap())
155 while ((
a = (
TPair *)next()))
156 if (
a->Value() &&
a->Value()->IsOnHeap())
172 while ((
a = (
TPair *)next())) {
173 if (
a->Key() &&
a->Key()->IsOnHeap())
175 if (
a->Value() &&
a->Value()->IsOnHeap())
195 if (
fTable->Remove(key)) {
196 if (
IsOwner() &&
a->Key() &&
a->Key()->IsOnHeap())
216 return fTable->FindObject(keyname);
227 if (
IsArgNull(
"FindObject", key))
return nullptr;
229 return fTable->FindObject(key);
238 if (
a)
return a->Value();
247 if (
IsArgNull(
"GetValue", key))
return nullptr;
250 if (
a)
return a->Value();
276 coll->
Print(option, recurse);
287 fTable->Rehash(newCapacity, checkObjValidity);
297 if (!key)
return nullptr;
301 if (
fTable->Remove(key)) {
321 if (!key)
return nullptr;
325 if (
fTable->Remove(key)) {
375 for (
Int_t i = 0; i < nobjects; i++) {
378 if (obj)
Add(obj, value);
388 while ((
a = (
TPair*) next())) {
392 b.SetByteCount(R__c,
kTRUE);
413 while ((
a = (
TPair*) next())) {
415 nbytes +=
a->Key()->Write(
name, option, bufsize);
417 nbytes +=
a->Value()->Write(
name, option, bufsize);
433 return ((
const TMap*)
this)->Write(
name,option,bufsize);
487 fCursor = (THashTableIter *)iter.fCursor->GetCollection()->MakeIterator();
489 fCursor->operator=(*iter.fCursor);
546 if (
a)
return a->Key();
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
Using a TBrowser one can browse all ROOT objects.
Buffer base class used for serializing objects.
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.
TCollection(const TCollection &)=delete
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
const TCollection * GetCollection() const override
THashTable implements a hash table to store TObject's.
Iterator abstract base class.
virtual TClass * IsA() const
TObject * operator*() const override
Return pointer to current object (a TPair) or nullptr.
TObject * Next() override
Returns the next key from a map.
~TMapIter()
Map iterator dtor.
Bool_t operator!=(const TIterator &aIter) const override
This operator compares two TIterator objects.
void Reset() override
Reset the map iterator.
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void DeleteAll()
Remove all (key,value) pairs from the map AND delete the keys AND values when they are allocated on t...
TPair * RemoveEntry(TObject *key)
Remove (key,value) pair with key from the map.
virtual ~TMap()
TMap dtor.
void Delete(Option_t *option="") override
Remove all (key,value) pairs from the map AND delete the keys when they are allocated on the heap.
Int_t Collisions(const char *keyname) const
Returns the number of collisions for a key with a certain name (i.e.
void Add(TObject *obj) override
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
TObject * FindObject(const char *keyname) const override
Check if a (key,value) pair exists with keyname as name of the key.
void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const override
Print the collection entry.
Float_t AverageCollisions() const
Return the ratio of entries vs occupied slots.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write all objects in this map.
TObject * Remove(TObject *key) override
Remove the (key,value) pair with key from the map.
void DeleteValues()
Remove all (key,value) pairs from the map AND delete the values when they are allocated on the heap.
Bool_t DeleteEntry(TObject *key)
Remove (key,value) pair with key from the map.
void Clear(Option_t *option="") override
Remove all (key,value) pairs from the map.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Create an iterator for TMap.
void Streamer(TBuffer &) override
Stream all key/value pairs in the map to or from the I/O buffer.
Bool_t IsOwnerValue() const
TClass * IsA() const override
virtual void SetOwnerValue(Bool_t enable=kTRUE)
Set whether this map is the owner (enable==true) of its values.
Int_t Capacity() const
Return number of slots in the hashtable.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
TMap(const TMap &map)=delete
void Rehash(Int_t newCapacity, Bool_t checkObjValidity=kTRUE)
Rehash the underlaying THashTable (see THashTable::Rehash()).
Mother of all ROOT objects.
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
@ kSingleKey
write collection with single key
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
TObject()
TObject constructor.
Class used by TMap to store (key,value) pairs.
void Browse(TBrowser *b) override
Browse the pair.
virtual ~TPair()
TPair destructor.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.