library: libCore #include "TExMap.h" |
TExMap
class description - header file - 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).
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);
}
Long_t & operator()(ULong_t hash, Long_t key)
Return a reference to the value belonging to the key with the
specified hash value. If the key does not exist it will be added.
NOTE: the reference will be invalidated an Expand() triggered by
an Add() or another operator() call.
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 Streamer(TBuffer &b)
Stream all objects in the collection to or from the I/O buffer.
Author: Fons Rademakers 26/05/99
Last update: root/cont:$Name: $:$Id: TExMap.cxx,v 1.12 2006/05/24 14:34:00 brun 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.