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;
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) {
328 Assoc_t *assoc =
fTable + slot;
331 assoc->fValue = value;
334 }
else if (R__v >= 2) {
343 for (i = 0; i < tally; ++i) {
348 Assoc_t* assoc =
fTable + slot;
351 assoc->fValue = value;
360 for (i = 0; i <
n; i++) {
364 Add(hash, key, value);
367 b.CheckByteCount(R__s, R__c, TExMap::IsA());
369 R__c =
b.WriteVersion(TExMap::IsA(),
kTRUE);
371 TObject::Streamer(
b);
375 for (i=0; i <
fSize; i++) {
376 if (!
fTable[i].InUse())
continue;
382 b.SetByteCount(R__c,
kTRUE);
433 return Next(hash, key, value);
unsigned long long ULong64_t
Buffer base class used for serializing objects.
TExMapIter(const TExMap *map)
Create TExMap iterator.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
TExMapIter & operator=(const TExMapIter &)
Overloaded assignment operator.
This class stores a (key,value) pair using an external hash.
Long64_t & operator()(ULong64_t hash, Long64_t key)
Return a reference to the value belonging to the key with the specified hash value.
void Delete(Option_t *opt="")
Delete all entries stored in the TExMap.
void Expand(Int_t newsize)
Expand the TExMap.
Int_t FindElement(ULong64_t hash, Long64_t key)
Find an entry with specified hash and key in the TExMap.
void Remove(ULong64_t hash, Long64_t key)
Remove entry with specified key from the TExMap.
void FixCollisions(Int_t index)
Rehash the map in case an entry has been removed.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
TExMap & operator=(const TExMap &)
Assignment operator.
TExMap(Int_t mapSize=100)
Create a TExMap.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
void AddAt(UInt_t slot, ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table.
Mother of all ROOT objects.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Long_t NextPrime(Long_t x)
TMath Base functions.
ULong64_t GetHash() const
void SetHash(ULong64_t h)