class TMap: public TCollection


TMap

TMap implements an associative array of (key,value) pairs using a
THashTable for efficient retrieval (therefore TMap does not conserve
the order of the entries). The hash value is calculated
using the value returned by the keys Hash() function. Both key and
value need to inherit from TObject.

/* */


Function Members (Methods)

public:
TMap(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
virtual~TMap()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TObject* obj)
voidAdd(TObject* key, TObject* value)
virtual voidTCollection::AddAll(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_tCapacity() 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* keyname) const
Int_tCollisions(TObject* key) 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 = "")
voidDeleteAll()
voidDeleteKeys()
voidDeleteValues()
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* keyname) const
virtual TObject*FindObject(const TObject* key) 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 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
virtual Int_tTCollection::GetSize() const
const THashTable*GetTable() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
TObject*GetValue(const char* keyname) const
TObject*GetValue(const TObject* key) 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*operator()(const char* keyname) const
TObject*operator()(const TObject* key) const
virtual voidTCollection::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* wildcard = "") const
virtual voidPrint(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* key)
voidTCollection::RemoveAll()
virtual voidTCollection::RemoveAll(TCollection* col)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& 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)
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:
TMap(const TMap& map)
TMap&operator=(const TMap& map)

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:
THashTable*fTableHash table used to store TPair's

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TMap(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0)
 TMap ctor. See THashTable for a description of the arguments.
~TMap()
 TMap dtor. Objects are not deleted unless the TMap is the
 owner (set via SetOwner()).
void Add(TObject* obj)
 This function may not be used (but we need to provide it since it is
 a pure virtual in TCollection). Use Add(key,value) instead.
void Add(TObject* key, TObject* value)
 Add a (key,value) pair to the map.
Float_t AverageCollisions()
 Return the ratio of entries vs occupied slots.
Int_t Capacity()
 Return number of slots in the hashtable. Use GetSize() to get the
 number of objects stored in the TMap.
void Clear(Option_t* option = "")
 Remove all (key,value) pairs from the map but DO NOT delete the keys
 and/or values. Key objects are not deleted unless the TMap is the
 owner (set via SetOwner()). To delete only the value objects call
 DeleteValues() and to delete both keys and values use DeleteAll().
Int_t Collisions(const char *keyname)
 Returns the number of collisions for a key 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 *key)
 Returns the number of collisions for a key (i.e. number of objects
 in same slot in the hash table, i.e. length of linked list).
void Delete(Option_t* option = "")
 Remove all (key,value) pairs from the map AND delete the keys
 when they are allocated on the heap.
void DeleteValues()
 Remove all (key,value) pairs from the map AND delete the values
 when they are allocated on the heap.
void DeleteAll()
 Remove all (key,value) pairs from the map AND delete the keys AND
 values when they are allocated on the heap.
TObject * FindObject(const char *keyname)
 Check if a (key,value) pair exists with keyname as name of the key.
 Returns a TPair* (need to downcast from TObject). Use Key() and
 Value() to get the pointers to the key and value, respectively.
 Returns 0 if not found.
TObject * FindObject(const TObject *key)
 Check if a (key,value) pair exists with key as key.
 Returns a TPair* (need to downcast from TObject). Use Key() and
 Value() to get the pointers to the key and value, respectively.
 Returns 0 if not found.
TObject * GetValue(const char *keyname)
 Returns a pointer to the value associated with keyname as name of the key.
TObject * GetValue(const TObject *key)
 Returns a pointer to the value associated with key.
TIterator * MakeIterator(Bool_t dir = kIterForward) const
 Create an iterator for TMap.
void Print(Option_t* wildcard = "") const
 Print all objects in this collection.
 Wildcarding is supported, e.g. wildcard="xxx*" prints only objects
 with names matching xxx*.
void Print(Option_t* wildcard, Option_t* option) const
 Print all objects in this collection, passing option to the
 objects Print() method.
 Wildcarding is supported, e.g. wildcard="xxx*" prints only objects
 with names matching xxx*.
void Rehash(Int_t newCapacity, Bool_t checkObjValidity = kTRUE)
 Rehash the underlaying THashTable (see THashTable::Rehash()).
TObject * Remove(TObject* key)
 Remove the (key,value) pair with key from the map. Returns the key
 object or 0 in case key was not found.
void Streamer(TBuffer& b)
 Stream all key/value pairs in the map to or from the I/O buffer.
TMap(const TMap& map)
TMap& operator=(const TMap& map)
void DeleteKeys()
{ Delete(); }
TObject ** GetObjectRef(const TObject* obj) const
{ return fTable->GetObjectRef(obj); }
const THashTable * GetTable()
{ return fTable; }
TObject * operator()(const char *keyname)
{ return GetValue(keyname); }
TObject * operator()(const TObject *key)
{ return GetValue(key); }

Author: Fons Rademakers 12/11/95
Last update: root/cont:$Id: TMap.h 20882 2007-11-19 11:31:26Z rdm $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

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.