SNAP Library 6.0, Developer Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <shash.h>
Public Types | |
typedef TSHashKeyDat< TKey, TDat > | THashKeyDat |
typedef TSparseTable< THashKeyDat, GroupSize >::TIter | TIter |
typedef TSparseTable< THashKeyDat, GroupSize >::TSGroup | TSGroup |
Public Member Functions | |
TSparseHash (const int &WantedVals=0) | |
TSparseHash (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
TSparseHash & | operator= (const TSparseHash &SHT) |
bool | operator== (const TSparseHash &SHT) const |
bool | operator< (const TSparseHash &SHT) const |
::TSize | GetMemUsed () const |
TIter | BegI () const |
TIter | EndI () const |
TIter | GetI (const TKey &Key) const |
bool | Empty () const |
int | Len () const |
int | Reserved () const |
uint | GetDiskSz () const |
void | Reserve (const int &MxVals) |
void | Clr (const bool &DoDel=true) |
void | Swap (TSparseHash &HT) |
int | AddKey (const TKey &Key) |
TDat & | AddDat (const TKey &Key) |
TDat & | AddDat (const TKey &Key, const TDat &Dat) |
const TKey & | GetKey (const int &KeyId) const |
int | GetKeyId (const TKey &Key) const |
bool | IsKey (const TKey &Key) const |
bool | IsKey (const TKey &Key, int &KeyId) const |
bool | IsKeyId (const int &KeyId) const |
int | GetRndKeyId (TRnd &Rnd=TInt::Rnd) const |
const TDat & | GetDat (const TKey &Key) const |
TDat & | GetDat (const TKey &Key) |
const TDat & | GetDatKeyId (const int &KeyId) const |
TDat & | GetDatKeyId (const int &KeyId) |
void | GetKeyDat (const int &KeyId, TKey &Key, TDat &Dat) const |
bool | IsKeyGetDat (const TKey &Key, TDat &Dat) const |
void | GetKeyV (TVec< TKey > &KeyV) const |
void | GetDatV (TVec< TDat > &DatV) const |
void | GetKeyDatPrV (TVec< TPair< TKey, TDat > > &KeyDatPrV) const |
void | GetDatKeyPrV (TVec< TPair< TDat, TKey > > &DatKeyPrV) const |
Static Public Attributes | |
static const float | MxOccupancy = 0.8f |
static const float | MnOccupancy = 0.4f * 0.8f |
static const int | MinBuckets = 32 |
Private Member Functions | |
void | ResetThresh () |
int | GetMinSize (const int &CurVals, const int &WantedVals) const |
void | CopyFrom (const TSparseHash &HT, const int &MnWanted) |
void | MoveFrom (TSparseHash &HT, const int &MnWanted) |
void | ResizeDelta (const int &ValsToAdd, const int &MnWanted=0) |
void | FindPos (const TKey &Key, int &Pos, int &PosToIns) const |
Private Attributes | |
TInt | ShrinkThresh |
TInt | ExpandThresh |
TSparseTable< THashKeyDat, GroupSize > | Table |
typedef TSHashKeyDat<TKey, TDat> TSparseHash< TKey, TDat, GroupSize >::THashKeyDat |
typedef TSparseTable<THashKeyDat, GroupSize>::TIter TSparseHash< TKey, TDat, GroupSize >::TIter |
typedef TSparseTable<THashKeyDat, GroupSize>::TSGroup TSparseHash< TKey, TDat, GroupSize >::TSGroup |
|
inline |
Definition at line 494 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::ResetThresh().
|
inline |
TDat & TSparseHash< TKey, TDat, GroupSize >::AddDat | ( | const TKey & | Key | ) |
Definition at line 687 of file shash.h.
Referenced by TBigNet< TNodeData, IsDir >::GetSubGraph().
TDat & TSparseHash< TKey, TDat, GroupSize >::AddDat | ( | const TKey & | Key, |
const TDat & | Dat | ||
) |
Definition at line 696 of file shash.h.
int TSparseHash< TKey, TDat, GroupSize >::AddKey | ( | const TKey & | Key | ) |
Definition at line 676 of file shash.h.
|
inline |
Definition at line 504 of file shash.h.
References TSparseTable< TVal, GroupSize >::BegI().
|
inline |
Definition at line 514 of file shash.h.
References TSparseTable< TVal, GroupSize >::Clr(), and TSparseHash< TKey, TDat, GroupSize >::ResetThresh().
|
private |
Definition at line 568 of file shash.h.
References Assert, TSparseGroup< TVal, GroupSize >::Len(), TSparseGroup< TVal, GroupSize >::Offset(), TSparseHash< TKey, TDat, GroupSize >::Reserved(), and TSparseHash< TKey, TDat, GroupSize >::Table.
|
inline |
Definition at line 508 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::Len().
|
inline |
Definition at line 505 of file shash.h.
References TSparseTable< TVal, GroupSize >::EndI().
|
private |
Definition at line 631 of file shash.h.
References Assert.
Referenced by TSparseHash< TKey, TDat, GroupSize >::GetKeyId().
const TDat & TSparseHash< TKey, TDat, GroupSize >::GetDat | ( | const TKey & | Key | ) | const |
Definition at line 705 of file shash.h.
References Assert.
TDat & TSparseHash< TKey, TDat, GroupSize >::GetDat | ( | const TKey & | Key | ) |
Definition at line 713 of file shash.h.
References Assert.
|
inline |
Definition at line 534 of file shash.h.
References TSHashKeyDat< TKey, TDat >::Dat, and TSparseTable< TVal, GroupSize >::Get().
|
inline |
Definition at line 535 of file shash.h.
References TSHashKeyDat< TKey, TDat >::Dat, and TSparseTable< TVal, GroupSize >::Set().
void TSparseHash< TKey, TDat, GroupSize >::GetDatKeyPrV | ( | TVec< TPair< TDat, TKey > > & | DatKeyPrV | ) | const |
void TSparseHash< TKey, TDat, GroupSize >::GetDatV | ( | TVec< TDat > & | DatV | ) | const |
Definition at line 746 of file shash.h.
References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().
|
inline |
Definition at line 511 of file shash.h.
References TSparseTable< TVal, GroupSize >::GetDiskSz().
|
inline |
Definition at line 506 of file shash.h.
References Assert, TSparseTable< TVal, GroupSize >::GetI(), TSparseHash< TKey, TDat, GroupSize >::GetKeyId(), and TSparseHash< TKey, TDat, GroupSize >::IsKey().
|
inline |
Definition at line 521 of file shash.h.
References TSparseTable< TVal, GroupSize >::Get(), and TSHashKeyDat< TKey, TDat >::Key.
void TSparseHash< TKey, TDat, GroupSize >::GetKeyDat | ( | const int & | KeyId, |
TKey & | Key, | ||
TDat & | Dat | ||
) | const |
Definition at line 721 of file shash.h.
References Assert, TSHashKeyDat< TKey, TDat >::Dat, and TSHashKeyDat< TKey, TDat >::Key.
void TSparseHash< TKey, TDat, GroupSize >::GetKeyDatPrV | ( | TVec< TPair< TKey, TDat > > & | KeyDatPrV | ) | const |
|
inline |
Definition at line 522 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::FindPos().
Referenced by TSparseHash< TKey, TDat, GroupSize >::GetI(), and TSparseHash< TKey, TDat, GroupSize >::IsKey().
void TSparseHash< TKey, TDat, GroupSize >::GetKeyV | ( | TVec< TKey > & | KeyV | ) | const |
Definition at line 738 of file shash.h.
References TVec< TVal, TSizeTy >::Add(), and TVec< TVal, TSizeTy >::Gen().
|
inline |
Definition at line 502 of file shash.h.
References TSparseTable< TVal, GroupSize >::GetMemUsed().
|
private |
|
inline |
Definition at line 528 of file shash.h.
References Assert, TSparseHash< TKey, TDat, GroupSize >::IsKeyId(), TSparseHash< TKey, TDat, GroupSize >::Len(), and TSparseHash< TKey, TDat, GroupSize >::Reserved().
|
inline |
Definition at line 524 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::GetKeyId().
Referenced by TSparseHash< TKey, TDat, GroupSize >::GetI().
|
inline |
Definition at line 525 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::GetKeyId().
bool TSparseHash< TKey, TDat, GroupSize >::IsKeyGetDat | ( | const TKey & | Key, |
TDat & | Dat | ||
) | const |
|
inline |
Definition at line 527 of file shash.h.
References TSparseTable< TVal, GroupSize >::IsEmpty().
Referenced by TSparseHash< TKey, TDat, GroupSize >::GetRndKeyId().
|
inline |
Definition at line 509 of file shash.h.
References TSparseTable< TVal, GroupSize >::Len().
Referenced by TSparseHash< TKey, TDat, GroupSize >::Empty(), TSparseHash< TKey, TDat, GroupSize >::GetRndKeyId(), and TSparseHash< TKey, TDat, GroupSize >::Reserve().
|
inline |
Definition at line 496 of file shash.h.
References TSparseTable< TVal, GroupSize >::Load(), and TInt::Load().
|
private |
Definition at line 591 of file shash.h.
References Assert, TSparseGroup< TVal, GroupSize >::Clr(), TSparseGroup< TVal, GroupSize >::Len(), TSparseGroup< TVal, GroupSize >::Offset(), TSparseHash< TKey, TDat, GroupSize >::Reserved(), and TSparseHash< TKey, TDat, GroupSize >::Table.
Referenced by TSparseHash< TKey, TDat, GroupSize >::ResizeDelta().
bool TSparseHash< TKey, TDat, GroupSize >::operator< | ( | const TSparseHash< TKey, TDat, GroupSize > & | SHT | ) | const |
TSparseHash< TKey, TDat, GroupSize > & TSparseHash< TKey, TDat, GroupSize >::operator= | ( | const TSparseHash< TKey, TDat, GroupSize > & | SHT | ) |
Definition at line 649 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::ExpandThresh, TSparseHash< TKey, TDat, GroupSize >::ShrinkThresh, and TSparseHash< TKey, TDat, GroupSize >::Table.
bool TSparseHash< TKey, TDat, GroupSize >::operator== | ( | const TSparseHash< TKey, TDat, GroupSize > & | SHT | ) | const |
|
inline |
Definition at line 513 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::Len(), and TSparseHash< TKey, TDat, GroupSize >::ResizeDelta().
|
inline |
Definition at line 510 of file shash.h.
References TSparseTable< TVal, GroupSize >::Reserved().
Referenced by TSparseHash< TKey, TDat, GroupSize >::CopyFrom(), TSparseHash< TKey, TDat, GroupSize >::GetRndKeyId(), and TSparseHash< TKey, TDat, GroupSize >::MoveFrom().
|
private |
Definition at line 555 of file shash.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::Clr(), TSparseHash< TKey, TDat, GroupSize >::ResizeDelta(), and TSparseHash< TKey, TDat, GroupSize >::TSparseHash().
|
private |
Definition at line 618 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::MoveFrom(), TSparseHash< TKey, TDat, GroupSize >::ResetThresh(), and Swap().
Referenced by TSparseHash< TKey, TDat, GroupSize >::Reserve().
|
inline |
Definition at line 497 of file shash.h.
References TSparseTable< TVal, GroupSize >::Save(), and TInt::Save().
void TSparseHash< TKey, TDat, GroupSize >::Swap | ( | TSparseHash< TKey, TDat, GroupSize > & | HT | ) |
Definition at line 669 of file shash.h.
References TSparseHash< TKey, TDat, GroupSize >::ExpandThresh, TSparseHash< TKey, TDat, GroupSize >::ShrinkThresh, Swap(), and TSparseHash< TKey, TDat, GroupSize >::Table.
|
private |
Definition at line 491 of file shash.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::operator=(), and TSparseHash< TKey, TDat, GroupSize >::Swap().
|
static |
|
static |
|
static |
|
private |
Definition at line 491 of file shash.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::operator=(), and TSparseHash< TKey, TDat, GroupSize >::Swap().
|
private |
Definition at line 492 of file shash.h.
Referenced by TSparseHash< TKey, TDat, GroupSize >::CopyFrom(), TSparseHash< TKey, TDat, GroupSize >::MoveFrom(), TSparseHash< TKey, TDat, GroupSize >::operator<(), TSparseHash< TKey, TDat, GroupSize >::operator=(), TSparseHash< TKey, TDat, GroupSize >::operator==(), and TSparseHash< TKey, TDat, GroupSize >::Swap().