|
SNAP Library, User Reference
2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
|
#include <shash.h>
Public Member Functions | |
| TKeyDatFl (const TStr &FNm) | |
| int | Len () const |
| bool | Next () |
| const TKey & | GetKey () const |
| TKey & | GetKey () |
| const TDat & | GetDat () const |
| TDat & | GetDat () |
Static Public Member Functions | |
| static void | Save (const TStr &OutFNm, const THash< TKey, TDat, THashFunc > &Hash) |
| static void | Save (TSOut &SOut, const THash< TKey, TDat, THashFunc > &Hash) |
| static void | LoadHash (const TStr &InFNm, THash< TKey, TDat, THashFunc > &Hash, const int &LoadN=-1) |
| static void | LoadHash (TSIn &SIn, THash< TKey, TDat, THashFunc > &Hash, int LoadN=-1) |
| static void | LoadKeyV (TSIn &SIn, TVec< TKey > &KeyV, int LoadN=-1) |
| static void | LoadDatV (TSIn &SIn, TVec< TDat > &DatV, int LoadN=-1) |
Private Attributes | |
| TInt | ElemCnt |
| TFIn | FIn |
| TKey | Key |
| TDat | Dat |
| static void TKeyDatFl< TKey, TDat, THashFunc >::LoadDatV | ( | TSIn & | SIn, |
| TVec< TDat > & | DatV, | ||
| int | LoadN = -1 |
||
| ) | [inline, static] |
Definition at line 49 of file shash.h.
{
TInt ElemCnt(SIn); const int Start=clock();
if (ElemCnt < LoadN || LoadN == -1) { LoadN = ElemCnt; }
printf("Loading %s: %d elements ... ", SIn.GetSNm().CStr(), LoadN); DatV.Gen(LoadN, 0);
for (int i = 0; i < LoadN; i++) { TKey(SIn); DatV.Add(TDat(SIn)); }
printf(" [%ds]\n", int((clock()-Start)/CLOCKS_PER_SEC));
}
| static void TKeyDatFl< TKey, TDat, THashFunc >::LoadHash | ( | TSIn & | SIn, |
| THash< TKey, TDat, THashFunc > & | Hash, | ||
| int | LoadN = -1 |
||
| ) | [inline, static] |
Definition at line 35 of file shash.h.
{
TInt ElemCnt(SIn); const int Start=clock();
if (ElemCnt < LoadN || LoadN == -1) { LoadN = ElemCnt; }
printf("Loading %s: %d elements ... ", SIn.GetSNm().CStr(), LoadN); Hash.Gen(LoadN);
for (int i = 0; i < LoadN; i++) { Hash.AddDat(TKey(SIn)).Load(SIn); }
printf(" [%ds]\n", int((clock()-Start)/CLOCKS_PER_SEC));
}
| static void TKeyDatFl< TKey, TDat, THashFunc >::LoadKeyV | ( | TSIn & | SIn, |
| TVec< TKey > & | KeyV, | ||
| int | LoadN = -1 |
||
| ) | [inline, static] |
Definition at line 42 of file shash.h.
{
TInt ElemCnt(SIn); const int Start=clock();
if (ElemCnt < LoadN || LoadN == -1) { LoadN = ElemCnt; }
printf("Loading %s: %d elements ... ", SIn.GetSNm().CStr(), LoadN); KeyV.Gen(LoadN, 0);
for (int i = 0; i < LoadN; i++) { KeyV.Add(TKey(SIn)); TDat D(SIn); }
printf(" [%ds]\n", int((clock()-Start)/CLOCKS_PER_SEC));
}
| static void TKeyDatFl< TKey, TDat, THashFunc >::Save | ( | TSOut & | SOut, |
| const THash< TKey, TDat, THashFunc > & | Hash | ||
| ) | [inline, static] |
Definition at line 28 of file shash.h.
{
SOut.Save(Hash.Len());
for (int k = Hash.FFirstKeyId(); Hash.FNextKeyId(k); ) {
Hash.GetKey(k).Save(SOut); Hash[k].Save(SOut); }
}