|
| TStrHash () |
|
| TStrHash (const PStringPool &StrPool) |
|
| TStrHash (const int &Ports, const bool &_AutoSizeP=false, const PStringPool &StrPool=PStringPool()) |
|
| TStrHash (const TStrHash &Hash) |
|
| TStrHash (TSIn &SIn, bool PoolToo=true) |
|
void | Load (TSIn &SIn, bool PoolToo=true) |
|
void | LoadShM (TShMIn &ShMIn, bool SharedPool=true) |
| Load hash from shared memory. If shared pool is true load pool from shared memory. More...
|
|
void | Save (TSOut &SOut, bool PoolToo=true) const |
|
void | SetPool (const PStringPool &StrPool) |
|
PStringPool | GetPool () const |
|
TStrHash & | operator= (const TStrHash &Hash) |
|
bool | Empty () const |
|
int | Len () const |
|
int | Reserved () const |
|
int | GetPorts () const |
|
bool | IsAutoSize () const |
|
int | GetMxKeyIds () const |
|
bool | IsKeyIdEqKeyN () const |
|
int | AddKey (const char *Key) |
|
int | AddKey (const TStr &Key) |
|
int | AddKey (const TChA &Key) |
|
int | AddDat (const char *Key, const TDat &Dat) |
|
int | AddDat (const TStr &Key, const TDat &Dat) |
|
int | AddDat (const TChA &Key, const TDat &Dat) |
|
TDat & | AddDat (const char *Key) |
|
TDat & | AddDat (const TStr &Key) |
|
TDat & | AddDat (const TChA &Key) |
|
TDat & | AddDatId (const char *Key) |
|
TDat & | AddDatId (const TStr &Key) |
|
TDat & | AddDatId (const TChA &Key) |
|
const TDat & | operator[] (const int &KeyId) const |
|
TDat & | operator[] (const int &KeyId) |
|
const TDat & | operator() (const char *Key) const |
|
::TSize | GetMemUsed () const |
|
const TDat & | GetDat (const char *Key) const |
|
const TDat & | GetDat (const TStr &Key) const |
|
TDat & | GetDat (const char *Key) |
|
const TDat & | GetDat (const TStr &Key) |
|
const TDat & | GetDat (const TChA &Key) |
|
TDat & | GetDatId (const int &KeyId) |
|
const TDat & | GetDatId (const int &KeyId) const |
|
void | GetKeyDat (const int &KeyId, int &KeyO, TDat &Dat) const |
|
void | GetKeyDat (const int &KeyId, const char *&Key, TDat &Dat) const |
|
void | GetKeyDat (const int &KeyId, TStr &Key, TDat &Dat) const |
|
void | GetKeyDat (const int &KeyId, TChA &Key, TDat &Dat) const |
|
int | GetKeyId (const char *Key) const |
|
int | GetKeyId (const TStr &Key) const |
|
const char * | GetKey (const int &KeyId) const |
|
int | GetKeyOfs (const int &KeyId) const |
|
const char * | KeyFromOfs (const int &KeyO) const |
|
bool | IsKey (const char *Key) const |
|
bool | IsKey (const TStr &Key) const |
|
bool | IsKey (const TChA &Key) const |
|
bool | IsKey (const char *Key, int &KeyId) const |
|
bool | IsKeyGetDat (const char *Key, TDat &Dat) const |
|
bool | IsKeyGetDat (const TStr &Key, TDat &Dat) const |
|
bool | IsKeyGetDat (const TChA &Key, TDat &Dat) const |
|
bool | IsKeyId (const int &KeyId) const |
|
int | FFirstKeyId () const |
|
bool | FNextKeyId (int &KeyId) const |
|
void | GetKeyV (TVec< TStr > &KeyV) const |
|
void | GetStrIdV (TIntV &StrIdV) const |
|
void | GetDatV (TVec< TDat > &DatV) const |
|
void | GetKeyDatPrV (TVec< TPair< TStr, TDat > > &KeyDatPrV) const |
|
void | GetDatKeyPrV (TVec< TPair< TDat, TStr > > &DatKeyPrV) const |
|
void | Pack () |
|
template<class TDat, class TStringPool = TStrPool, class THashFunc = TDefaultHashFunc<TStr>>
class TStrHash< TDat, TStringPool, THashFunc >
Definition at line 781 of file hash.h.
template<class TDat , class TStringPool , class THashFunc >
int TStrHash< TDat, TStringPool, THashFunc >::AddKey |
( |
const char * |
Key | ) |
|
Definition at line 968 of file hash.h.
References TVec< TVal, TSizeTy >::Add(), TBigStrPool::AddStr(), TBigStrPool::Cmp(), TPt< TRec >::Empty(), TVec< TVal, TSizeTy >::Empty(), and TVec< TVal, TSizeTy >::Len().
Referenced by TStrHash< TInt, TBigStrPool >::AddDat(), TStrHash< TInt, TBigStrPool >::AddDatId(), TTableContext::AddStr(), TTable::AddStrVal(), TTable::ChangeContext(), TTable::ColConcat(), TTable::ColConcatConst(), TCoda::DumpMemberships(), TSnap::LoadEdgeListStr(), TAGMUtil::LoadEdgeListStr(), TTimeNENet::LoadEdgeTm(), and TTable::StoreStrCol().
971 const int PortN = abs(THashFunc::GetPrimHashCd(Key) %
PortV.
Len());
972 const int HashCd = abs(THashFunc::GetSecHashCd(Key));
974 int KeyId =
PortV[PortN];
975 while (KeyId != -1 && ! (
KeyDatV[KeyId].HashCd == HashCd &&
Pool->Cmp(
KeyDatV[KeyId].Key, Key) == 0)) {
976 PrevKeyId = KeyId; KeyId =
KeyDatV[KeyId].Next; }
978 const int StrId =
Pool->AddStr(Key);
987 if (PrevKeyId == -1)
PortV[PortN] = KeyId;
988 else KeyDatV[PrevKeyId].Next = KeyId;
TSizeTy Len() const
Returns the number of elements in the vector.
bool Empty() const
Tests whether the vector is empty.
THashKeyDat< TInt, TDat > THKeyDat
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
template<class TDat , class TStringPool , class THashFunc >
int TStrHash< TDat, TStringPool, THashFunc >::GetKeyId |
( |
const char * |
Key | ) |
const |
Definition at line 994 of file hash.h.
References TBigStrPool::Cmp(), TVec< TVal, TSizeTy >::Empty(), and TVec< TVal, TSizeTy >::Len().
Referenced by TStrHash< TInt, TBigStrPool >::GetDat(), TStrHash< TInt, TBigStrPool >::IsKey(), TStrHash< TInt, TBigStrPool >::IsKeyGetDat(), TAGMUtil::LoadCmtyVV(), TCesnaUtil::LoadNIDAttrHFromNIDKH(), and TTable::StoreStrCol().
996 const int PortN = abs(THashFunc::GetPrimHashCd(Key) %
PortV.
Len());
997 const int Hc = abs(THashFunc::GetSecHashCd(Key));
998 int KeyId =
PortV[PortN];
999 while (KeyId != -1 && ! (
KeyDatV[KeyId].HashCd == Hc &&
Pool->Cmp(
KeyDatV[KeyId].Key, Key) == 0))
TSizeTy Len() const
Returns the number of elements in the vector.
bool Empty() const
Tests whether the vector is empty.
template<class TDat , class TStringPool , class THashFunc >
TStrHash< TDat, TStringPool, THashFunc > & TStrHash< TDat, TStringPool, THashFunc >::operator= |
( |
const TStrHash< TDat, TStringPool, THashFunc > & |
Hash | ) |
|
Definition at line 954 of file hash.h.
References TStrHash< TDat, TStringPool, THashFunc >::AutoSizeP, TPt< TRec >::Empty(), TStrHash< TDat, TStringPool, THashFunc >::FFreeKeyId, TStrHash< TDat, TStringPool, THashFunc >::FreeKeys, TStrHash< TDat, TStringPool, THashFunc >::KeyDatV, TStrHash< TDat, TStringPool, THashFunc >::Pool, and TStrHash< TDat, TStringPool, THashFunc >::PortV.
TPt< TStringPool > PStringPool
template<class TDat , class TStringPool , class THashFunc >
void TStrHash< TDat, TStringPool, THashFunc >::Resize |
( |
| ) |
|
|
private |
Definition at line 931 of file hash.h.
References TVec< TVal, TSizeTy >::Empty(), TVec< TVal, TSizeTy >::Gen(), TBigStrPool::GetCStr(), THashKeyDat< TKey, TDat >::HashCd, THashKeyDat< TKey, TDat >::Key, TVec< TVal, TSizeTy >::Len(), THashKeyDat< TKey, TDat >::Next, and TVec< TVal, TSizeTy >::PutAll().
945 if (KeyDat.HashCd != -1) {
946 const int Port = abs(THashFunc::GetPrimHashCd(
Pool->GetCStr(KeyDat.Key)) % NPorts);
947 KeyDat.Next =
PortV[Port];
TSizeTy Len() const
Returns the number of elements in the vector.
bool Empty() const
Tests whether the vector is empty.
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
uint GetNextPrime(const uint &Val) const
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
THashKeyDat< TInt, TDat > THKeyDat