|
ROOT
Reference Guide |
|
Go to the documentation of this file.
139 while ((
a = (
TPair *)next()))
140 if (
a->Key() &&
a->Key()->IsOnHeap())
156 while ((
a = (
TPair *)next()))
157 if (
a->Value() &&
a->Value()->IsOnHeap())
173 while ((
a = (
TPair *)next())) {
174 if (
a->Key() &&
a->Key()->IsOnHeap())
176 if (
a->Value() &&
a->Value()->IsOnHeap())
197 if (
IsOwner() &&
a->Key() &&
a->Key()->IsOnHeap())
228 if (
IsArgNull(
"FindObject", key))
return 0;
239 if (
a)
return a->Value();
248 if (
IsArgNull(
"GetValue", key))
return 0;
251 if (
a)
return a->Value();
277 coll->
Print(option, recurse);
372 TObject::Streamer(
b);
376 for (
Int_t i = 0; i < nobjects; i++) {
379 if (obj)
Add(obj, value);
381 b.CheckByteCount(R__s, R__c,TMap::IsA());
383 R__c =
b.WriteVersion(TMap::IsA(),
kTRUE);
384 TObject::Streamer(
b);
389 while ((
a = (
TPair*) next())) {
393 b.SetByteCount(R__c,
kTRUE);
414 while ((
a = (
TPair*) next())) {
416 nbytes +=
a->Key()->Write(
name, option, bsize);
418 nbytes +=
a->Value()->Write(
name, option, bsize);
434 return ((
const TMap*)
this)->Write(
name,option,bsize);
548 if (
a)
return a->Key();
Class used by TMap to store (key,value) pairs.
Int_t Capacity() const
Return number of slots in the hashtable.
Using a TBrowser one can browse all ROOT objects.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
Bool_t IsArgNull(const char *where, const TObject *obj) const
Returns true if object is a null pointer.
void Clear(Option_t *option="")
Remove all (key,value) pairs from the map.
void Add(TObject *obj)
Add object to the hash table.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Int_t Collisions(const char *name) const
Returns the number of collisions for an object with a certain name (i.e.
Int_t Collisions(const char *keyname) const
Returns the number of collisions for a key with a certain name (i.e.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual ~TPair()
TPair destructor.
Bool_t DeleteEntry(TObject *key)
Remove (key,value) pair with key from the map.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
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...
Buffer base class used for serializing objects.
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
void Delete(Option_t *option="")
Remove all objects from the table AND delete all heap based objects.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Create an iterator for TMap.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this map.
Iterator abstract base class.
Float_t AverageCollisions() const
Return the ratio of entries vs occupied slots.
void DeleteValues()
Remove all (key,value) pairs from the map AND delete the values when they are allocated on the heap.
Bool_t IsOwnerValue() const
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
virtual ~TMap()
TMap dtor.
TObject * Next()
Returns the next key from a map.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Float_t AverageCollisions() const
THashTable implements a hash table to store TObject's.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
TObject * FindObject(const char *name) const
Find object using its name.
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
@ kSingleKey
write collection with single key
TObject * Remove(TObject *key)
Remove the (key,value) pair with key from the map.
~TMapIter()
Map iterator dtor.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
void DeleteAll()
Remove all (key,value) pairs from the map AND delete the keys AND values when they are allocated on t...
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
void Rehash(Int_t newCapacity, Bool_t checkObjValidity=kTRUE)
Rehash the underlaying THashTable (see THashTable::Rehash()).
virtual void Browse(TBrowser *b)
Browse the pair.
TObject * Remove(TObject *obj)
Remove object from the hashtable.
TMap(const TMap &map)=delete
void Rehash(Int_t newCapacity, Bool_t checkObjValidity=kTRUE)
Rehash the hashtable.
virtual void SetOwnerValue(Bool_t enable=kTRUE)
Set whether this map is the owner (enable==true) of its values.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void Delete(Option_t *option="")
Remove all (key,value) pairs from the map AND delete the keys when they are allocated on the heap.
Mother of all ROOT objects.
virtual void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const
Print the collection entry.
const TCollection * GetCollection() const
Collection abstract base class.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
TObject * Next()
Return next object in hashtable. Returns 0 when no more objects in table.
void Reset()
Reset the map iterator.
TPair * RemoveEntry(TObject *key)
Remove (key,value) pair with key from the map.
TObject * operator*() const
Return pointer to current object (a TPair) or nullptr.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...