SNAP Library, User Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
THash< TKey, TDat, THashFunc > Class Template Reference

List of all members.

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)
THashoperator= (const THash &Hash)
bool operator== (const THash &Hash) const
bool operator< (const THash &Hash) const
const TDat & operator[] (const int &KeyId) const
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)
void 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.
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).
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)
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]

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
class THash< TKey, TDat, THashFunc >


Member Typedef Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
typedef THashKeyDatI<TKey, TDat> THash< TKey, TDat, THashFunc >::TIter

Member Enumeration Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
anonymous enum
Enumerator:
HashPrimes 

Constructor & Destructor Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( ) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( const THash< TKey, TDat, THashFunc > &  Hash) [inline]
template<class TKey , class TDat , class THashFunc >
THash< TKey, TDat, THashFunc >::THash ( const int &  ExpectVals,
const bool &  _AutoSizeP = false 
) [explicit]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash< TKey, TDat, THashFunc >::THash ( TSIn SIn) [inline, explicit]

Member Function Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDat ( const TKey &  Key) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDat ( const TKey &  Key,
const TDat &  Dat 
) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::AddDatId ( const TKey &  Key) [inline]
template<class TKey, class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::AddKey ( const TKey &  Key)
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::BegI ( ) const [inline]
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Clr ( const bool &  DoDel = true,
const int &  NoDelLim = -1,
const bool &  ResetDat = true 
)
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Defrag ( )
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::DelIfKey ( const TKey &  Key) [inline]
template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::DelKey ( const TKey &  Key)
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::DelKeyId ( const int &  KeyId) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::DelKeyIdV ( const TIntV KeyIdV) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::Empty ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::EndI ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::FFirstKeyId ( ) const [inline]
template<class TKey , class TDat , class THashFunc >
bool THash< TKey, TDat, THashFunc >::FNextKeyId ( int &  KeyId) const
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Gen ( const int &  ExpectVals) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TDat& THash< TKey, TDat, THashFunc >::GetDat ( const TKey &  Key) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::GetDat ( const TKey &  Key) [inline]
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatKeyKdV ( TVec< TKeyDat< TDat, TKey > > &  DatKeyKdV) const
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatKeyPrV ( TVec< TPair< TDat, TKey > > &  DatKeyPrV) const
template<class TKey , class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetDatV ( TVec< TDat > &  DatV) const
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TIter THash< TKey, TDat, THashFunc >::GetI ( const TKey &  Key) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TKey& THash< TKey, TDat, THashFunc >::GetKey ( const int &  KeyId) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::GetKeyDat ( const int &  KeyId,
TKey &  Key,
TDat &  Dat 
) const [inline]
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyDatKdV ( TVec< TKeyDat< TKey, TDat > > &  KeyDatKdV) const
template<class TKey, class TDat, class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyDatPrV ( TVec< TPair< TKey, TDat > > &  KeyDatPrV) const
template<class TKey, class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::GetKeyId ( const TKey &  Key) const
template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::GetKeyV ( TVec< TKey > &  KeyV) const
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
::TSize THash< TKey, TDat, THashFunc >::GetMemUsed ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetMxKeyIds ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetPorts ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::GetReservedKeyIds ( ) const [inline]
template<class TKey , class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::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.

template<class TKey , class TDat , class THashFunc >
int THash< TKey, TDat, THashFunc >::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).

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsAutoSize ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKey ( const TKey &  Key) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKey ( const TKey &  Key,
int &  KeyId 
) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyGetDat ( const TKey &  Key,
TDat &  Dat 
) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyId ( const int &  KeyId) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::IsKeyIdEqKeyN ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
int THash< TKey, TDat, THashFunc >::Len ( ) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Load ( TSIn SIn) [inline]
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::LoadXml ( const PXmlTok &  XmlTok,
const TStr Nm = "" 
)
template<class TKey, class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::MarkDelKey ( const TKey &  Key)
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::MarkDelKeyId ( const int &  KeyId) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::operator() ( const TKey &  Key) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
bool THash< TKey, TDat, THashFunc >::operator< ( const THash< TKey, TDat, THashFunc > &  Hash) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
THash& THash< TKey, TDat, THashFunc >::operator= ( const THash< TKey, TDat, THashFunc > &  Hash) [inline]
template<class TKey , class TDat , class THashFunc >
bool THash< TKey, TDat, THashFunc >::operator== ( const THash< TKey, TDat, THashFunc > &  Hash) const
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const TDat& THash< TKey, TDat, THashFunc >::operator[] ( const int &  KeyId) const [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
TDat& THash< TKey, TDat, THashFunc >::operator[] ( const int &  KeyId) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Pack ( ) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::Save ( TSOut SOut) const [inline]
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::SaveXml ( TSOut SOut,
const TStr Nm 
)
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Sort ( const bool &  CmpKey,
const bool &  Asc 
)
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::SortByDat ( const bool &  Asc = true) [inline]
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
void THash< TKey, TDat, THashFunc >::SortByKey ( const bool &  Asc = true) [inline]
template<class TKey , class TDat , class THashFunc >
void THash< TKey, TDat, THashFunc >::Swap ( THash< TKey, TDat, THashFunc > &  Hash)

Member Data Documentation

template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
const unsigned int THash< TKey, TDat, THashFunc >::HashPrimeT [static]
Initial value:
{
  3ul, 5ul, 11ul, 23ul,
  53ul,         97ul,         193ul,       389ul,       769ul,
  1543ul,       3079ul,       6151ul,      12289ul,     24593ul,
  49157ul,      98317ul,      196613ul,    393241ul,    786433ul,
  1572869ul,    3145739ul,    6291469ul,   12582917ul,  25165843ul,
  50331653ul,   100663319ul,  201326611ul, 402653189ul, 805306457ul,
  1610612741ul, 3221225473ul, 4294967291ul
}

The documentation for this class was generated from the following files: