SNAP Library, Developer 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
hash.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  THashKeyDat< TKey, TDat >
class  THashKeyDatI< TKey, TDat >
class  TDefaultHashFunc< TKey >
class  THash< TKey, TDat, THashFunc >
class  THash< TKey, TDat, THashFunc >::THashKeyDatCmp
class  PHash< TKey, TDat >
class  TStrHash< TDat, TStringPool, THashFunc >
class  TCache< TKey, TDat, THashFunc >
class  TStrHashF_OldGLib
class  TStrHashF_Md5
class  TStrHashF_DJB

Typedefs

typedef THash< TCh, TChTChChH
typedef THash< TChTr, TIntTChTrIntH
typedef THash< TInt, TIntTIntH
typedef THash< TUInt64, TIntTUInt64H
typedef THash< TInt, TBoolTIntBoolH
typedef THash< TInt, TIntTIntIntH
typedef THash< TInt, TUInt64TIntUInt64H
typedef THash< TInt, TIntFltPrTIntIntFltPrH
typedef THash< TInt, TIntVTIntIntVH
typedef THash< TInt, TIntHTIntIntHH
typedef THash< TInt, TFltTIntFltH
typedef THash< TInt, TFltPrTIntFltPrH
typedef THash< TInt, TFltTrTIntFltTrH
typedef THash< TInt, TFltVTIntFltVH
typedef THash< TInt, TStrTIntStrH
typedef THash< TInt, TStrVTIntStrVH
typedef THash< TInt, TIntPrTIntIntPrH
typedef THash< TInt, TIntPrVTIntIntPrVH
typedef THash< TUInt64, TStrVTUInt64StrVH
typedef THash< TIntPr, TIntTIntPrIntH
typedef THash< TIntPr, TIntVTIntPrIntVH
typedef THash< TIntPr, TIntPrVTIntPrIntPrVH
typedef THash< TIntTr, TIntTIntTrIntH
typedef THash< TIntV, TIntTIntVIntH
typedef THash< TUInt, TUIntTUIntH
typedef THash< TIntPr, TFltTIntPrFltH
typedef THash< TIntTr, TFltTIntTrFltH
typedef THash< TIntPr, TStrTIntPrStrH
typedef THash< TIntPr, TStrVTIntPrStrVH
typedef THash< TIntStrPr, TIntTIntStrPrIntH
typedef THash< TFlt, TFltTFltFltH
typedef THash< TStr, TIntTStrH
typedef THash< TStr, TBoolTStrBoolH
typedef THash< TStr, TIntTStrIntH
typedef THash< TStr, TIntPrTStrIntPrH
typedef THash< TStr, TIntVTStrIntVH
typedef THash< TStr, TUInt64VTStrUInt64VH
typedef THash< TStr, TIntPrVTStrIntPrVH
typedef THash< TStr, TFltTStrFltH
typedef THash< TStr, TFltVTStrFltVH
typedef THash< TStr, TStrTStrStrH
typedef THash< TStr, TStrPrTStrStrPrH
typedef THash< TStr, TStrVTStrStrVH
typedef THash< TStr, TStrPrVTStrStrPrVH
typedef THash< TStr, TStrKdVTStrStrKdVH
typedef THash< TStr, TIntFltPrTStrIntFltPrH
typedef THash< TStr, TStrIntPrVTStrStrIntPrVH
typedef THash< TStr, TStrIntKdVTStrStrIntKdVH
typedef THash< TDbStr, TIntTDbStrIntH
typedef THash< TDbStr, TStrTDbStrStrH
typedef THash< TStrPr, TBoolTStrPrBoolH
typedef THash< TStrPr, TIntTStrPrIntH
typedef THash< TStrPr, TFltTStrPrFltH
typedef THash< TStrPr, TStrTStrPrStrH
typedef THash< TStrPr, TStrVTStrPrStrVH
typedef THash< TStrTr, TIntTStrTrIntH
typedef THash< TStrIntPr, TIntTStrIntPrIntH
typedef THash< TStrV, TIntTStrVH
typedef THash< TStrV, TIntTStrVIntH
typedef THash< TStrV, TIntVTStrVIntVH
typedef THash< TStrV, TStrTStrVStrH
typedef THash< TStrV, TStrVTStrVStrVH
typedef TStrHash< TIntTStrSH
typedef TStrHash< TIntTStrIntSH
typedef TStrHash< TIntVTStrToIntVSH

Functions

void Resize (TSize _MxBfL)
 TBigStrPool (TSize MxBfLen=0, uint _GrowBy=16 *1024 *1024)
 TBigStrPool (TSIn &SIn, bool LoadCompact=true)
 TBigStrPool (const TBigStrPool &Pool)
 ~TBigStrPool ()
static PBigStrPool New (TSize _MxBfLen=0, uint _GrowBy=16 *1024 *1024)
static PBigStrPool New (TSIn &SIn)
static PBigStrPool New (const TStr &fileName)
static PBigStrPool Load (TSIn &SIn, bool LoadCompacted=true)
void Save (TSOut &SOut) const
void Save (const TStr &fileName)
int GetStrs () const
TSize Len () const
TSize Size () const
bool Empty () const
char * operator() () const
TBigStrPooloperator= (const TBigStrPool &Pool)
int AddStr (const char *Str, uint Len)
int AddStr (const char *Str)
int AddStr (const TStr &Str)
TStr GetStr (const int &StrId) const
const char * GetCStr (const int &StrId) const
TStr GetStrFromOffset (const TSize &Offset) const
const char * GetCStrFromOffset (const TSize &Offset) const
void Clr (bool DoDel=false)
int Cmp (const int &StrId, const char *Str) const
static int GetPrimHashCd (const char *CStr)
static int GetSecHashCd (const char *CStr)
int GetPrimHashCd (const int &StrId)
int GetSecHashCd (const int &StrId)

Variables

ClassTP(TBigStrPool,
PBigStrPool) private uint 
GrowBy
char * Bf
TVec< TSizeIdOffV

Typedef Documentation

typedef THash<TCh, TCh> TChChH

Definition at line 555 of file hash.h.

Definition at line 556 of file hash.h.

Definition at line 605 of file hash.h.

Definition at line 606 of file hash.h.

typedef THash<TFlt, TFlt> TFltFltH

Definition at line 587 of file hash.h.

Definition at line 559 of file hash.h.

typedef THash<TInt, TFlt> TIntFltH

Definition at line 565 of file hash.h.

Definition at line 566 of file hash.h.

Definition at line 567 of file hash.h.

Definition at line 568 of file hash.h.

typedef THash<TInt, TInt> TIntH

Definition at line 557 of file hash.h.

Definition at line 562 of file hash.h.

typedef THash<TInt, TInt> TIntIntH

Definition at line 560 of file hash.h.

Definition at line 564 of file hash.h.

Definition at line 571 of file hash.h.

Definition at line 572 of file hash.h.

Definition at line 563 of file hash.h.

Definition at line 582 of file hash.h.

typedef THash< TIntPr, TInt > TIntPrIntH

Definition at line 574 of file hash.h.

Definition at line 576 of file hash.h.

Definition at line 575 of file hash.h.

Definition at line 584 of file hash.h.

Definition at line 585 of file hash.h.

typedef THash<TInt, TStr> TIntStrH

Definition at line 569 of file hash.h.

Definition at line 586 of file hash.h.

Definition at line 570 of file hash.h.

Definition at line 583 of file hash.h.

Definition at line 577 of file hash.h.

Definition at line 561 of file hash.h.

Definition at line 578 of file hash.h.

Definition at line 589 of file hash.h.

typedef THash<TStr, TFlt> TStrFltH

Definition at line 595 of file hash.h.

Definition at line 596 of file hash.h.

typedef THash<TStr, TInt> TStrH

Definition at line 588 of file hash.h.

Definition at line 602 of file hash.h.

typedef THash<TStr, TInt> TStrIntH

Definition at line 590 of file hash.h.

Definition at line 591 of file hash.h.

Definition at line 613 of file hash.h.

Definition at line 594 of file hash.h.

Definition at line 956 of file hash.h.

Definition at line 592 of file hash.h.

Definition at line 607 of file hash.h.

Definition at line 609 of file hash.h.

Definition at line 608 of file hash.h.

Definition at line 610 of file hash.h.

Definition at line 611 of file hash.h.

typedef TStrHash<TInt> TStrSH

Definition at line 955 of file hash.h.

typedef THash<TStr, TStr> TStrStrH

Definition at line 597 of file hash.h.

Definition at line 604 of file hash.h.

Definition at line 603 of file hash.h.

Definition at line 601 of file hash.h.

Definition at line 598 of file hash.h.

Definition at line 600 of file hash.h.

Definition at line 599 of file hash.h.

Definition at line 957 of file hash.h.

Definition at line 612 of file hash.h.

Definition at line 593 of file hash.h.

typedef THash<TStrV, TInt> TStrVH

Definition at line 614 of file hash.h.

Definition at line 615 of file hash.h.

Definition at line 616 of file hash.h.

Definition at line 617 of file hash.h.

Definition at line 618 of file hash.h.

Definition at line 558 of file hash.h.

Definition at line 573 of file hash.h.

typedef THash<TUInt, TUInt> TUIntH

Definition at line 579 of file hash.h.


Function Documentation

int AddStr ( const char *  Str,
uint  Len 
)
int AddStr ( const char *  Str)

Definition at line 683 of file hash.h.

References AddStr().

{ return AddStr(Str, uint(strlen(Str)) + 1); }

Here is the call graph for this function:

int AddStr ( const TStr Str)

Definition at line 684 of file hash.h.

References AddStr(), TStr::CStr(), and TStr::Len().

{ return AddStr(Str.CStr(), Str.Len() + 1); }

Here is the call graph for this function:

void Clr ( bool  DoDel = false)

Definition at line 696 of file hash.h.

References Bf.

{ BfL = 0; if (DoDel && Bf) { free(Bf); Bf = 0; MxBfL = 0; } }
int Cmp ( const int &  StrId,
const char *  Str 
) const

Definition at line 697 of file hash.h.

References Assert, Bf, GetStrs(), and IdOffV.

                                                   { Assert(StrId < GetStrs());
    if (StrId != 0) return strcmp(Bf + (TSize)IdOffV[StrId], Str); else return strcmp("", Str); }

Here is the call graph for this function:

bool Empty ( ) const

Definition at line 678 of file hash.h.

References Len().

{ return ! Len(); }

Here is the call graph for this function:

const char* GetCStr ( const int &  StrId) const

Definition at line 688 of file hash.h.

References Assert, Bf, TStr::CStr(), TStr::GetNullStr(), GetStrs(), and IdOffV.

                                              { Assert(StrId < GetStrs());
    if (StrId == 0) return TStr::GetNullStr().CStr(); else return (Bf + (TSize)IdOffV[StrId]); }

Here is the call graph for this function:

const char* GetCStrFromOffset ( const TSize Offset) const

Definition at line 693 of file hash.h.

References Assert, Bf, TStr::CStr(), and TStr::GetNullStr().

                                                           { Assert(Offset < BfL);
    if (Offset == 0) return TStr::GetNullStr().CStr(); else return Bf + Offset; }

Here is the call graph for this function:

static int GetPrimHashCd ( const char *  CStr) [static]
int GetPrimHashCd ( const int &  StrId)

Definition at line 702 of file hash.h.

References Assert, Bf, GetPrimHashCd(), GetStrs(), and IdOffV.

                                      { Assert(StrId < GetStrs());
    if (StrId != 0) return GetPrimHashCd(Bf + (TSize)IdOffV[StrId]); else return GetPrimHashCd(""); }

Here is the call graph for this function:

static int GetSecHashCd ( const char *  CStr) [static]
int GetSecHashCd ( const int &  StrId)

Definition at line 704 of file hash.h.

References Assert, Bf, GetSecHashCd(), GetStrs(), and IdOffV.

                                     { Assert(StrId < GetStrs());
    if (StrId != 0) return GetSecHashCd(Bf + (TSize)IdOffV[StrId]); else return GetSecHashCd(""); }

Here is the call graph for this function:

TStr GetStr ( const int &  StrId) const

Definition at line 686 of file hash.h.

References Assert, Bf, TStr::GetNullStr(), GetStrs(), and IdOffV.

                                      { Assert(StrId < GetStrs());
    if (StrId == 0) return TStr::GetNullStr(); else return TStr(Bf + (TSize)IdOffV[StrId]); }

Here is the call graph for this function:

TStr GetStrFromOffset ( const TSize Offset) const

Definition at line 691 of file hash.h.

References Assert, Bf, and TStr::GetNullStr().

                                                   { Assert(Offset < BfL);
    if (Offset == 0) return TStr::GetNullStr(); else return TStr(Bf + Offset); }

Here is the call graph for this function:

int GetStrs ( ) const

Definition at line 675 of file hash.h.

References IdOffV.

Referenced by Cmp(), GetCStr(), GetPrimHashCd(), GetSecHashCd(), and GetStr().

{ return IdOffV.Len(); }

Here is the caller graph for this function:

TSize Len ( ) const

Definition at line 676 of file hash.h.

{ return BfL; }
static PBigStrPool Load ( TSIn SIn,
bool  LoadCompacted = true 
) [static]

Definition at line 671 of file hash.h.

References TBigStrPool().

{ return PBigStrPool(new TBigStrPool(SIn, LoadCompacted)); }

Here is the call graph for this function:

static PBigStrPool New ( TSize  _MxBfLen = 0,
uint  _GrowBy = 16*1024*1024 
) [static]

Definition at line 668 of file hash.h.

References TBigStrPool().

{ return PBigStrPool(new TBigStrPool(_MxBfLen, _GrowBy)); }

Here is the call graph for this function:

static PBigStrPool New ( TSIn SIn) [static]

Definition at line 669 of file hash.h.

References TBigStrPool().

{ return new TBigStrPool(SIn); }

Here is the call graph for this function:

static PBigStrPool New ( const TStr fileName) [static]

Definition at line 670 of file hash.h.

References TFIn::New(), and TBigStrPool().

{ PSIn SIn = TFIn::New(fileName); return new TBigStrPool(*SIn); }

Here is the call graph for this function:

char* operator() ( ) const

Definition at line 679 of file hash.h.

References Bf.

{ return Bf; }
TBigStrPool& operator= ( const TBigStrPool Pool)
void Resize ( TSize  _MxBfL) [private]
void Save ( TSOut SOut) const

Definition at line 330 of file bits.h.

References Addr, B4T, Bf, DecileV, DefP, Fail, Flt, FSet1, FSet2, FSet3, LastB4Mask, Mean, Median, Mn, Mx, PercentileV, Quart1, Quart3, TSOut::Save(), TB8Set::Save(), TVec< TVal >::Save(), TStr::Save(), TBool::Save(), TInt::Save(), TFlt::Save(), TAscFlt::Save(), TSOut::SaveBf(), SDev, Seg, SErr, Str, SumW, UnusableVal, UsableP, ValL, Vals, ValSumW, ValType, ValV, ValWgtV, and Vari.

Referenced by TFHashKey< TKey, TFDat, TVDat >::OnDelFromCache(), and Save().

                               {
    SOut.Save(B4s); SOut.Save(Bits);
    SOut.SaveBf(&LastB4Mask, sizeof(TB4Def::TB4));
    SOut.SaveBf(B4T, B4s*sizeof(TB4Def::TB4));}

Here is the call graph for this function:

Here is the caller graph for this function:

void Save ( const TStr fileName)

Definition at line 673 of file hash.h.

References Save().

{ TFOut FOut(fileName); Save(FOut); }

Here is the call graph for this function:

TSize Size ( ) const

Definition at line 677 of file hash.h.

{ return MxBfL; }
TBigStrPool::TBigStrPool ( TSize  MxBfLen = 0,
uint  _GrowBy = 16*1024*1024 
)

Definition at line 18 of file hash.cpp.

References AddStr(), Bf, and IAssert.

Referenced by Load(), and New().

                                                    : MxBfL(MxBfLen), BfL(0), GrowBy(_GrowBy), Bf(0) {
  //IAssert(MxBfL >= 0); IAssert(GrowBy >= 0);
  if (MxBfL > 0) { Bf = (char *) malloc(MxBfL);  IAssert(Bf); }
  AddStr(""); // add empty string
}

Here is the call graph for this function:

Here is the caller graph for this function:

TBigStrPool::TBigStrPool ( TSIn SIn,
bool  LoadCompact = true 
)

Definition at line 24 of file hash.cpp.

References Bf, GrowBy, IAssert, IdOffV, TSIn::Load(), TSIn::LoadBf(), TSIn::LoadCs(), and TSizeMx.

                                                    : MxBfL(0), BfL(0), GrowBy(0), Bf(0) {
  uint64 Tmp;
  SIn.Load(Tmp); IAssert(Tmp <= uint64(TSizeMx)); MxBfL=TSize(Tmp);
  SIn.Load(Tmp); IAssert(Tmp <= uint64(TSizeMx)); BfL=TSize(Tmp);
  SIn.Load(GrowBy);
  IAssert(MxBfL >= BfL);  IAssert(BfL >= 0);  IAssert(GrowBy >= 0);
  if (LoadCompact) MxBfL = BfL;
  if (MxBfL > 0) { Bf = (char *) malloc(MxBfL); IAssert(Bf); }
  if (BfL > 0) { SIn.LoadBf(Bf, BfL); }
  SIn.LoadCs();
  int NStr=0;  SIn.Load(NStr);
  IdOffV.Gen(NStr, 0);
  for (int i = 0; i < NStr; i++) {
    SIn.Load(Tmp);
    IAssert(Tmp <= uint64(TSizeMx));
    IdOffV.Add(TSize(Tmp));
  }
}

Here is the call graph for this function:

TBigStrPool ( const TBigStrPool Pool)

Definition at line 664 of file hash.h.

References IAssert.

                                       : MxBfL(Pool.MxBfL), BfL(Pool.BfL), GrowBy(Pool.GrowBy) {
    Bf = (char *) malloc(Pool.MxBfL); IAssert(Bf); memcpy(Bf, Pool.Bf, Pool.BfL); }

Definition at line 666 of file hash.h.

References Bf, and IAssert.

{ if (Bf) free(Bf); else IAssert(MxBfL == 0);  MxBfL = 0; BfL = 0; }

Variable Documentation

char* Bf

Definition at line 657 of file hash.h.

Definition at line 658 of file hash.h.

Referenced by Cmp(), GetCStr(), GetPrimHashCd(), GetSecHashCd(), GetStr(), GetStrs(), and TBigStrPool().