/usr/include/root/TExMap.h is in libroot-core-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | // @(#)root/cont:$Id$
// Author: Fons Rademakers 26/05/99
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TExMap
#define ROOT_TExMap
//////////////////////////////////////////////////////////////////////////
// //
// TExMap //
// //
// This class stores a (key,value) pair using an external hash. //
// The (key,value) are Long64_t's and therefore can contain object //
// pointers or any longs. The map uses an open addressing hashing //
// method (linear probing). //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TObject
#include "TObject.h"
#endif
class TExMapIter;
class TExMap : public TObject {
friend class TExMapIter;
private:
struct Assoc_t {
private:
ULong64_t fHash;
public:
Long64_t fKey;
Long64_t fValue;
void SetHash(ULong64_t h) { fHash = (h | 1); } // bit(0) is "1" when in use
ULong64_t GetHash() const { return fHash; }
Bool_t InUse() const { return fHash & 1; }
void Clear() { fHash = 0x0; }
};
Assoc_t *fTable;
Int_t fSize;
Int_t fTally;
Bool_t HighWaterMark() { return (Bool_t) (fTally >= ((3*fSize)/4)); }
Int_t FindElement(ULong64_t hash, Long64_t key);
void FixCollisions(Int_t index);
public:
TExMap(Int_t mapSize = 100);
TExMap(const TExMap &map);
TExMap& operator=(const TExMap&);
~TExMap();
void Add(ULong64_t hash, Long64_t key, Long64_t value);
void Add(Long64_t key, Long64_t value) { Add(key, key, value); }
void AddAt(UInt_t slot, ULong64_t hash, Long64_t key, Long64_t value);
void Delete(Option_t *opt = "");
Int_t Capacity() const { return fSize; }
void Expand(Int_t newsize);
Int_t GetSize() const { return fTally; }
Long64_t GetValue(ULong64_t hash, Long64_t key);
Long64_t GetValue(Long64_t key) { return GetValue(key, key); }
Long64_t GetValue(ULong64_t hash, Long64_t key, UInt_t &slot);
void Remove(ULong64_t hash, Long64_t key);
void Remove(Long64_t key) { Remove(key, key); }
Long64_t &operator()(ULong64_t hash, Long64_t key);
Long64_t &operator()(Long64_t key) { return operator()(key, key); }
ClassDef(TExMap,3) //Map with external hash
};
class TExMapIter {
private:
const TExMap *fMap;
Int_t fCursor;
public:
TExMapIter(const TExMap *map);
TExMapIter(const TExMapIter& tei) : fMap(tei.fMap), fCursor(tei.fCursor) { }
TExMapIter& operator=(const TExMapIter&);
virtual ~TExMapIter() { }
const TExMap *GetCollection() const { return fMap; }
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value);
Bool_t Next(Long64_t &key, Long64_t &value);
void Reset() { fCursor = 0; }
ClassDef(TExMapIter,0) // TExMap iterator
};
#endif
|