SNAP Library 3.0, User Reference
2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <hash.h>
Classes | |
class | THashKeyDatCmp |
Public Types | |
enum | { HashPrimes =32 } |
typedef THashKeyDatI< TKey, TDat > | TIter |
Public Member Functions | |
THash () | |
THash (const THash &Hash) | |
THash (const int &ExpectVals, const bool &_AutoSizeP=false) | |
THash (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm="") |
void | SaveXml (TSOut &SOut, const TStr &Nm) |
THash & | operator= (const THash &Hash) |
bool | operator== (const THash &Hash) const |
bool | operator< (const THash &Hash) const |
const TDat & | operator[] (const int &KeyId) const |
The [] operator takes KeyId, use GetDat() if you need value access via the key. More... | |
TDat & | operator[] (const int &KeyId) |
TDat & | operator() (const TKey &Key) |
::TSize | GetMemUsed () const |
TIter | BegI () const |
TIter | EndI () const |
TIter | GetI (const TKey &Key) const |
void | Gen (const int &ExpectVals) |
void | Clr (const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true) |
bool | Empty () const |
int | Len () const |
int | GetPorts () const |
bool | IsAutoSize () const |
int | GetMxKeyIds () const |
int | GetReservedKeyIds () const |
bool | IsKeyIdEqKeyN () const |
int | AddKey (const TKey &Key) |
TDat & | AddDatId (const TKey &Key) |
TDat & | AddDat (const TKey &Key) |
TDat & | AddDat (const TKey &Key, const TDat &Dat) |
void | DelKey (const TKey &Key) |
bool | DelIfKey (const TKey &Key) |
void | DelKeyId (const int &KeyId) |
void | DelKeyIdV (const TIntV &KeyIdV) |
void | MarkDelKey (const TKey &Key) |
void | MarkDelKeyId (const int &KeyId) |
const TKey & | GetKey (const int &KeyId) const |
int | GetKeyId (const TKey &Key) const |
int | GetRndKeyId (TRnd &Rnd) const |
Get an index of a random element. If the hash table has many deleted keys, this may take a long time. More... | |
int | GetRndKeyId (TRnd &Rnd, const double &EmptyFrac) |
Get an index of a random element. If the hash table has many deleted keys, defrag the hash table first (that's why the function is non-const). More... | |
bool | IsKey (const TKey &Key) const |
bool | IsKey (const TKey &Key, int &KeyId) const |
bool | IsKeyId (const int &KeyId) const |
const TDat & | GetDat (const TKey &Key) const |
TDat & | GetDat (const TKey &Key) |
TDat | GetDatWithDefault (const TKey &Key, TDat DefaultValue) |
void | GetKeyDat (const int &KeyId, TKey &Key, TDat &Dat) const |
bool | IsKeyGetDat (const TKey &Key, TDat &Dat) const |
int | FFirstKeyId () const |
bool | FNextKeyId (int &KeyId) 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 |
void | GetKeyDatKdV (TVec< TKeyDat< TKey, TDat > > &KeyDatKdV) const |
void | GetDatKeyKdV (TVec< TKeyDat< TDat, TKey > > &DatKeyKdV) const |
void | Swap (THash &Hash) |
void | Defrag () |
void | Pack () |
void | Sort (const bool &CmpKey, const bool &Asc) |
void | SortByKey (const bool &Asc=true) |
void | SortByDat (const bool &Asc=true) |
Static Public Attributes | |
static const unsigned int | HashPrimeT [HashPrimes] |
Private Types | |
typedef THashKeyDat< TKey, TDat > | THKeyDat |
typedef TPair< TKey, TDat > | TKeyDatP |
Private Member Functions | |
THKeyDat & | GetHashKeyDat (const int &KeyId) |
const THKeyDat & | GetHashKeyDat (const int &KeyId) const |
uint | GetNextPrime (const uint &Val) const |
void | Resize () |
Private Attributes | |
TIntV | PortV |
TVec< THKeyDat > | KeyDatV |
TBool | AutoSizeP |
TInt | FFreeKeyId |
TInt | FreeKeys |
|
private |
typedef THashKeyDatI<TKey, TDat> THash< TKey, TDat, THashFunc >::TIter |
anonymous enum |
|
inline |
|
inline |
|
explicit |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
int THash< TKey, TDat, THashFunc >::AddKey | ( | const TKey & | Key | ) |
|
inline |
void THash< TKey, TDat, THashFunc >::Clr | ( | const bool & | DoDel = true , |
const int & | NoDelLim = -1 , |
||
const bool & | ResetDat = true |
||
) |
void THash< TKey, TDat, THashFunc >::Defrag | ( | ) |
|
inline |
void THash< TKey, TDat, THashFunc >::DelKey | ( | const TKey & | Key | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool THash< TKey, TDat, THashFunc >::FNextKeyId | ( | int & | KeyId | ) | const |
|
inline |
|
inline |
|
inline |
void THash< TKey, TDat, THashFunc >::GetDatKeyKdV | ( | TVec< TKeyDat< TDat, TKey > > & | DatKeyKdV | ) | const |
void THash< TKey, TDat, THashFunc >::GetDatKeyPrV | ( | TVec< TPair< TDat, TKey > > & | DatKeyPrV | ) | const |
void THash< TKey, TDat, THashFunc >::GetDatV | ( | TVec< TDat > & | DatV | ) | const |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
void THash< TKey, TDat, THashFunc >::GetKeyDatKdV | ( | TVec< TKeyDat< TKey, TDat > > & | KeyDatKdV | ) | const |
void THash< TKey, TDat, THashFunc >::GetKeyDatPrV | ( | TVec< TPair< TKey, TDat > > & | KeyDatPrV | ) | const |
int THash< TKey, TDat, THashFunc >::GetKeyId | ( | const TKey & | Key | ) | const |
void THash< TKey, TDat, THashFunc >::GetKeyV | ( | TVec< TKey > & | KeyV | ) | const |
|
inline |
|
inline |
|
private |
|
inline |
|
inline |
int THash< TKey, TDat, THashFunc >::GetRndKeyId | ( | TRnd & | Rnd | ) | const |
int THash< TKey, TDat, THashFunc >::GetRndKeyId | ( | TRnd & | Rnd, |
const double & | EmptyFrac | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void THash< TKey, TDat, THashFunc >::LoadXml | ( | const PXmlTok & | XmlTok, |
const TStr & | Nm = "" |
||
) |
void THash< TKey, TDat, THashFunc >::MarkDelKey | ( | const TKey & | Key | ) |
|
inline |
|
inline |
|
inline |
bool THash< TKey, TDat, THashFunc >::operator== | ( | const THash< TKey, TDat, THashFunc > & | Hash | ) | const |
|
inline |
|
inline |
|
inline |
|
private |
|
inline |
void THash< TKey, TDat, THashFunc >::SaveXml | ( | TSOut & | SOut, |
const TStr & | Nm | ||
) |
void THash< TKey, TDat, THashFunc >::Sort | ( | const bool & | CmpKey, |
const bool & | Asc | ||
) |
|
inline |
|
inline |
void THash< TKey, TDat, THashFunc >::Swap | ( | THash< TKey, TDat, THashFunc > & | Hash | ) |
|
static |