|
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) |
|
template<class TKey, class TDat, class THashFunc = TDefaultHashFunc<TKey>>
class TKeyDatFl< TKey, TDat, THashFunc >
Definition at line 10 of file shash.h.
template<class TKey , class TDat , class THashFunc = TDefaultHashFunc<TKey>>
static void TKeyDatFl< TKey, TDat, THashFunc >::LoadDatV |
( |
TSIn & |
SIn, |
|
|
TVec< TDat > & |
DatV, |
|
|
int |
LoadN = -1 |
|
) |
| |
|
inlinestatic |
Definition at line 49 of file shash.h.
References TVec< TVal, TSizeTy >::Add(), TStr::CStr(), TKeyDatFl< TKey, TDat, THashFunc >::ElemCnt, TVec< TVal, TSizeTy >::Gen(), and TSBase::GetSNm().
52 printf(
"Loading %s: %d elements ... ", SIn.
GetSNm().
CStr(), LoadN); DatV.
Gen(LoadN, 0);
53 for (
int i = 0; i < LoadN; i++) { TKey(SIn); DatV.
Add(TDat(SIn)); }
54 printf(
" [%ds]\n",
int((clock()-Start)/CLOCKS_PER_SEC));
virtual TStr GetSNm() const
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
template<class TKey , class TDat , class THashFunc = TDefaultHashFunc<TKey>>
static void TKeyDatFl< TKey, TDat, THashFunc >::LoadHash |
( |
TSIn & |
SIn, |
|
|
THash< TKey, TDat, THashFunc > & |
Hash, |
|
|
int |
LoadN = -1 |
|
) |
| |
|
inlinestatic |
Definition at line 35 of file shash.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TStr::CStr(), TKeyDatFl< TKey, TDat, THashFunc >::ElemCnt, THash< TKey, TDat, THashFunc >::Gen(), and TSBase::GetSNm().
38 printf(
"Loading %s: %d elements ... ", SIn.
GetSNm().
CStr(), LoadN); Hash.
Gen(LoadN);
39 for (
int i = 0; i < LoadN; i++) { Hash.
AddDat(TKey(SIn)).Load(SIn); }
40 printf(
" [%ds]\n",
int((clock()-Start)/CLOCKS_PER_SEC));
void Gen(const int &ExpectVals)
virtual TStr GetSNm() const
TDat & AddDat(const TKey &Key)
template<class TKey , class TDat , class THashFunc = TDefaultHashFunc<TKey>>
static void TKeyDatFl< TKey, TDat, THashFunc >::LoadKeyV |
( |
TSIn & |
SIn, |
|
|
TVec< TKey > & |
KeyV, |
|
|
int |
LoadN = -1 |
|
) |
| |
|
inlinestatic |
Definition at line 42 of file shash.h.
References TVec< TVal, TSizeTy >::Add(), TStr::CStr(), TKeyDatFl< TKey, TDat, THashFunc >::ElemCnt, TVec< TVal, TSizeTy >::Gen(), and TSBase::GetSNm().
45 printf(
"Loading %s: %d elements ... ", SIn.
GetSNm().
CStr(), LoadN); KeyV.
Gen(LoadN, 0);
46 for (
int i = 0; i < LoadN; i++) { KeyV.
Add(TKey(SIn)); TDat D(SIn); }
47 printf(
" [%ds]\n",
int((clock()-Start)/CLOCKS_PER_SEC));
virtual TStr GetSNm() const
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
template<class TKey , class TDat , class THashFunc = TDefaultHashFunc<TKey>>
static void TKeyDatFl< TKey, TDat, THashFunc >::Save |
( |
TSOut & |
SOut, |
|
|
const THash< TKey, TDat, THashFunc > & |
Hash |
|
) |
| |
|
inlinestatic |
Definition at line 28 of file shash.h.
References THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), THash< TKey, TDat, THashFunc >::GetKey(), THash< TKey, TDat, THashFunc >::Len(), THash< TKey, TDat, THashFunc >::Save(), and TSOut::Save().
31 Hash.
GetKey(k).Save(SOut); Hash[k].
Save(SOut); }
void Save(TSOut &SOut) const
bool FNextKeyId(int &KeyId) const
void Save(const bool &Bool)
const TKey & GetKey(const int &KeyId) const