library: libCore #include "TExMap.h" |
TExMap
class description - source file - inheritance tree (.pdf)
private:
void Expand(Int_t newsize)
Int_t FindElement(ULong_t hash, Long_t key)
void FixCollisions(Int_t index)
Bool_t HighWaterMark()
public:
TExMap(Int_t mapSize = 100)
TExMap(const TExMap& map)
~TExMap()
void Add(ULong_t hash, Long_t key, Long_t value)
void Add(Long_t key, Long_t value)
void AddAt(UInt_t slot, ULong_t hash, Long_t key, Long_t value)
Int_t Capacity() const
static TClass* Class()
virtual void Delete(Option_t* opt = "")
Int_t GetSize() const
Long_t GetValue(ULong_t hash, Long_t key)
Long_t GetValue(Long_t key)
Long_t GetValue(ULong_t hash, Long_t key, UInt_t& slot)
virtual TClass* IsA() const
Long_t& operator()(ULong_t hash, Long_t key)
Long_t& operator()(Long_t key)
TExMap& operator=(const TExMap&)
void Remove(ULong_t hash, Long_t key)
void Remove(Long_t key)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
private:
TExMap::Assoc_t* fTable
Int_t fSize
Int_t fTally
TExMap
This class stores a (key,value) pair using an external hash.
The (key,value) are Long_t's and therefore can contain object
pointers or any longs. The map uses an open addressing hashing
method (linear probing).
TExMap(Int_t mapSize)
Create a TExMap.
TExMap(const TExMap &map) : TObject(map)
Copy constructor.
~TExMap()
Delete TExMap.
void Add(ULong_t hash, Long_t key, Long_t value)
Add an (key,value) pair to the table. The key should be unique.
void AddAt(UInt_t slot, ULong_t hash, Long_t key, Long_t value)
Add an (key,value) pair to the table. The key should be unique.
If the 'slot' is open, use it to store the value,
otherwise revert to Add(hash,key,value)
This is usually used in conjuction with GetValue wiht 3 parameters:
if ((idx = (ULong_t)fMap->GetValue(hash, key, slot)) != 0) {
...
} else {
fMap->AddAt(slot,hash,key,value);
}
void Delete(Option_t *)
Delete all entries stored in the TExMap.
Long_t GetValue(ULong_t hash, Long_t key)
Return the value belonging to specified key and hash value. If key not
found return 0.
Long_t GetValue(ULong_t hash, Long_t key, UInt_t &slot)
Return the value belonging to specified key and hash value. If key not
found return 0.
In 'slot', return the index of the slot used or the first empty slot.
(to be used with AddAt).
void Remove(ULong_t hash, Long_t key)
Remove entry with specified key from the TExMap.
Int_t FindElement(ULong_t hash, Long_t key)
Find an entry with specified hash and key in the TExMap.
Returns the slot of the key or the next empty slot.
void FixCollisions(Int_t index)
Rehash the map in case an entry has been removed.
void Expand(Int_t newSize)
Expand the TExMap.
void Streamer(TBuffer &b)
Stream all objects in the collection to or from the I/O buffer.
Inline Functions
Bool_t HighWaterMark()
void Add(Long_t key, Long_t value)
Int_t Capacity() const
Int_t GetSize() const
Long_t GetValue(ULong_t hash, Long_t key, UInt_t& slot)
void Remove(Long_t key)
Long_t& operator()(ULong_t hash, Long_t key)
Long_t& operator()(Long_t key)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void StreamerNVirtual(TBuffer& b)
TExMap& operator=(const TExMap&)
Author: Fons Rademakers 26/05/99
Last update: root/cont:$Name: $:$Id: TExMap.cxx,v 1.10 2005/12/22 19:09:01 pcanal Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
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.