35 if (mapSize < 4) mapSize = 5;
39 case 5:
fSize = 5;
break;
40 case 503:
fSize = 503;
break;
92 if (!
fTable[slot].InUse()) {
100 Error(
"Add",
"key %lld is not unique", key);
120 if (!
fTable[slot].InUse()) {
142 Error(
"operator()",
"fTable==0, should never happen");
147 if (!
fTable[slot].InUse()) {
179 Int_t firstSlot = slot;
181 if (!
fTable[slot].InUse())
return 0;
183 if (++slot == fSize) slot = 0;
184 }
while (firstSlot != slot);
186 Error(
"GetValue",
"table full");
198 if (!
fTable) { slot = 0;
return 0; }
204 if (!
fTable[slot].InUse())
return 0;
206 if (++slot == (
UInt_t)fSize) slot = 0;
207 }
while (firstSlot != slot);
209 Error(
"GetValue",
"table full");
223 Error(
"Remove",
"key %lld not found at %d", key, i);
242 Int_t firstSlot = slot;
244 if (!
fTable[slot].InUse())
return slot;
245 if (key ==
fTable[slot].fKey)
return slot;
246 if (++slot == fSize) slot = 0;
247 }
while (firstSlot != slot);
249 Error(
"FindElement",
"table full");
258 Int_t oldIndex, nextIndex;
261 for (oldIndex = index+1; ;oldIndex++) {
262 if (oldIndex >=
fSize)
264 nextObject =
fTable[oldIndex];
265 if (!nextObject.
InUse())
268 if (nextIndex != oldIndex) {
269 fTable[nextIndex] = nextObject;
286 for (i = newSize; --i >= 0;) {
291 for (i = 0; i < oldsize; i++)
292 if (oldTable[i].InUse()) {
294 if (!
fTable[slot].InUse())
295 fTable[slot] = oldTable[i];
297 Error(
"Expand",
"slot %d not empty (should never happen)", slot);
312 TObject::Streamer(b);
323 for (i = 0; i < tally; ++i) {
334 }
else if (R__v >= 2) {
343 for (i = 0; i < tally; ++i) {
360 for (i = 0; i <
n; i++) {
364 Add(hash, key, value);
371 TObject::Streamer(b);
375 for (i=0; i <
fSize; i++) {
376 if (!
fTable[i].InUse())
continue;
433 return Next(hash, key, value);
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
void Remove(ULong64_t hash, Long64_t key)
Remove entry with specified key from the TExMap.
Int_t FindElement(ULong64_t hash, Long64_t key)
Find an entry with specified hash and key in the TExMap.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
TExMapIter(const TExMap *map)
Create TExMap iterator.
void SetHash(ULong64_t h)
ULong64_t GetHash() const
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Long64_t & operator()(ULong64_t hash, Long64_t key)
Return a reference to the value belonging to the key with the specified hash value.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
void Delete(Option_t *opt="")
Delete all entries stored in the TExMap.
TExMap & operator=(const TExMap &)
Assignment operator.
void FixCollisions(Int_t index)
Rehash the map in case an entry has been removed.
TExMapIter & operator=(const TExMapIter &)
Overloaded assignment operator.
unsigned long long ULong64_t
Mother of all ROOT objects.
Long_t NextPrime(Long_t x)
TMath Base functionsDefine the functions Min, Max, Abs, Sign, Range for all types.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
TExMap(Int_t mapSize=100)
Create a TExMap.
This class stores a (key,value) pair using an external hash.
void Expand(Int_t newsize)
Expand the TExMap.
void AddAt(UInt_t slot, ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0