SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TFHash< TKey, TFDat, TVDat > Class Template Reference

#include <fds.h>

Collaboration diagram for TFHash< TKey, TFDat, TVDat >:

Public Member Functions

 TFHash (const TStr &HashFNm, const TFAccess &_Access, const int &Ports, const int &MxMemUsed)
 
 ~TFHash ()
 
 TFHash (TSIn &)
 
void Save (TSOut &)
 
TFHashoperator= (const TFHash &)
 
int GetMemUsed ()
 
void CacheFlushAndClr ()
 
bool Empty () const
 
int Len () const
 
TBlobPt AddFDat (const TKey &Key, const TFDat &FDat)
 
TBlobPt AddVDat (const TKey &Key, const TVDat &VDat)
 
TBlobPt AddFVDat (const TKey &Key, const TFDat &FDat, const TVDat &VDat)
 
void DelKey (const TKey &Key)
 
void DelKeyId (const TBlobPt &KeyId)
 
void GetKey (const TBlobPt &KeyId, TKey &Key)
 
TBlobPt GetKeyId (const TKey &Key)
 
bool IsKey (const TKey &Key)
 
bool IsKey (const TKey &Key, TBlobPt &KeyId)
 
TBlobPt GetFDat (const TKey &Key, TFDat &FDat)
 
TBlobPt GetVDat (const TKey &Key, TVDat &VDat)
 
TBlobPt GetFVDat (const TKey &Key, TFDat &FDat, TVDat &VDat)
 
void GetKeyFDat (const TBlobPt &KeyId, TKey &Key, TFDat &FDat)
 
void GetKeyFVDat (const TBlobPt &KeyId, TKey &Key, TFDat &FDat, TVDat &VDat)
 
TBlobPt FFirstKeyId ()
 
bool FNextKeyId (TBlobPt &TrvBlobPt, TBlobPt &KeyId)
 

Static Public Member Functions

static PFHash Load (TSIn &)
 

Private Types

typedef TPt< TFHash< TKey,
TFDat, TVDat > > 
PFHash
 
typedef TFHashKey< TKey, TFDat,
TVDat > 
THashKey
 
typedef TPt< THashKeyPHashKey
 

Private Member Functions

void * GetVoidThis () const
 
PBlobBs GetHashBBs ()
 
PHashKey GetFHashKey (const TBlobPt &KeyId)
 
void GetKeyInfo (const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
 
void GetKeyInfo (const TKey &Key, TBlobPt &KeyId, PHashKey &FHashKey)
 
TBlobPt AddKey (const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDatBPt, const TBlobPt &VDatBPt)
 
TBlobPt AddDat (const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDat, const TVDat &VDat)
 

Private Attributes

TCRef CRef
 
TFAccess Access
 
PBlobBs HashBBs
 
TBlobPtV PortV
 
TInt Keys
 
TCache< TBlobPt, PHashKeyFHashKeyCache
 

Friends

class TFHashKey< TKey, TFDat, TVDat >
 
class TPt< TFHash< TKey, TFDat, TVDat > >
 

Detailed Description

template<class TKey, class TFDat, class TVDat>
class TFHash< TKey, TFDat, TVDat >

Definition at line 4 of file fds.h.

Member Typedef Documentation

template<class TKey , class TFDat , class TVDat >
typedef TPt<TFHash<TKey, TFDat, TVDat> > TFHash< TKey, TFDat, TVDat >::PFHash
private

Definition at line 73 of file fds.h.

template<class TKey , class TFDat , class TVDat >
typedef TPt<THashKey> TFHash< TKey, TFDat, TVDat >::PHashKey
private

Definition at line 75 of file fds.h.

template<class TKey , class TFDat , class TVDat >
typedef TFHashKey<TKey, TFDat, TVDat> TFHash< TKey, TFDat, TVDat >::THashKey
private

Definition at line 74 of file fds.h.

Constructor & Destructor Documentation

template<class TKey , class TFDat , class TVDat >
TFHash< TKey, TFDat, TVDat >::TFHash ( const TStr HashFNm,
const TFAccess _Access,
const int &  Ports,
const int &  MxMemUsed 
)

Definition at line 180 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::Access, faCreate, faRdOnly, faUpdate, TVec< TVal, TSizeTy >::Gen(), TBlobBs::GetBlob(), TBlobBs::GetFirstBlobPt(), TMOut::GetSIn(), TFHash< TKey, TFDat, TVDat >::HashBBs, IAssert, TFHash< TKey, TFDat, TVDat >::Keys, TFHash< TKey, TFDat, TVDat >::PortV, TBlobBs::PutBlob(), TVec< TVal, TSizeTy >::Save(), and TInt::Save().

182  :
183  Access(_Access), HashBBs(), PortV(), Keys(0),
184  FHashKeyCache(MxMemUsed, 100003, GetVoidThis()){
185  if (Access==faCreate){
186  IAssert(Ports>0);
187  // create blob-base
188  HashBBs=PBlobBs(new TGBlobBs(HashFNm, faCreate));
189  // save initial no. of keys and port-vector
190  PortV.Gen(Ports);
191  TMOut HdSOut; Keys.Save(HdSOut); PortV.Save(HdSOut);
192  HashBBs->PutBlob(HdSOut.GetSIn());
193  } else {
195  IAssert(Ports==-1);
196  // open blob-base
197  HashBBs=PBlobBs(new TGBlobBs(HashFNm, Access));
198  // load initial no. of keys and port-vector
199  TBlobPt HdBPt=HashBBs->GetFirstBlobPt();
200  PSIn HdSIn=HashBBs->GetBlob(HdBPt);
201  Keys=TInt(*HdSIn);
202  PortV=TBlobPtV(*HdSIn);
203  }
204 }
#define IAssert(Cond)
Definition: bd.h:262
virtual TBlobPt GetFirstBlobPt()=0
Definition: fl.h:347
void Save(TSOut &SOut) const
Definition: dt.h:1057
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:666
TVec< TBlobPt > TBlobPtV
Definition: blobbs.h:5
void Save(TSOut &SOut) const
Definition: ds.h:885
TFAccess Access
Definition: fds.h:76
Definition: fl.h:347
TBlobPtV PortV
Definition: fds.h:78
Definition: dt.h:1041
Definition: fl.h:417
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
virtual TBlobPt PutBlob(const PSIn &SIn)=0
TPt< TBlobBs > PBlobBs
Definition: blobbs.h:89
Definition: bd.h:196
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:486
TInt Keys
Definition: fds.h:79
void * GetVoidThis() const
Definition: fds.h:82
Definition: fl.h:347
virtual PSIn GetBlob(const TBlobPt &BlobPt)=0

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
TFHash< TKey, TFDat, TVDat >::~TFHash ( )

Definition at line 207 of file fds.h.

References faCreate, faUpdate, TMOut::GetSIn(), and TSOut::Save().

207  {
208  if ((Access==faCreate)||(Access==faUpdate)){
209  // flush hash-key cache
210  FHashKeyCache.Flush();
211  // save port-vector
212  TBlobPt HdBPt=HashBBs->GetFirstBlobPt();
213  TMOut HdSOut; Keys.Save(HdSOut); PortV.Save(HdSOut);
214  HashBBs->PutBlob(HdBPt, HdSOut.GetSIn());
215  }
216 }
virtual TBlobPt GetFirstBlobPt()=0
Definition: fl.h:347
void Save(TSOut &SOut) const
Definition: dt.h:1057
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:666
void Save(TSOut &SOut) const
Definition: ds.h:885
TFAccess Access
Definition: fds.h:76
TBlobPtV PortV
Definition: fds.h:78
Definition: fl.h:417
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
virtual TBlobPt PutBlob(const PSIn &SIn)=0
TInt Keys
Definition: fds.h:79
Definition: fl.h:347

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
TFHash< TKey, TFDat, TVDat >::TFHash ( TSIn )
inline

Definition at line 112 of file fds.h.

References Fail.

112 {Fail;}
#define Fail
Definition: bd.h:238

Member Function Documentation

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::AddDat ( const TKey &  Key,
const bool &  ChangeFDat,
const TFDat &  FDat,
const bool &  ChangeVDat,
const TVDat &  VDat 
)
private

Definition at line 258 of file fds.h.

References TBlobPt::Empty(), fhbtVDat, TMOut::GetSIn(), and TInt::Save().

Referenced by TFHash< TKey, TFDat, TVDat >::AddFVDat(), and TFHash< TKey, TFDat, TVDat >::AddVDat().

261  {
262  // prepare key info
263  TBlobPt KeyId; PHashKey FHashKey;
264  GetKeyInfo(Key, KeyId, FHashKey);
265 
266  // prepare new variable-data blob-pointer
267  TBlobPt VDatBPt;
268  if (ChangeVDat){
269  // save variable-data
270  TMOut VDatMOut;
271  TInt(int(fhbtVDat)).Save(VDatMOut); VDat.Save(VDatMOut);
272  if (KeyId.Empty()){
273  VDatBPt=HashBBs->PutBlob(VDatMOut.GetSIn());
274  } else {
275  VDatBPt=HashBBs->PutBlob(FHashKey->VDatBPt, VDatMOut.GetSIn());
276  }
277  }
278 
279  // save the data
280  KeyId=AddKey(Key, ChangeFDat, FDat, ChangeVDat, VDatBPt);
281  return KeyId;
282 }
Definition: fds.h:6
void Save(TSOut &SOut) const
Definition: dt.h:1057
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:666
TPt< THashKey > PHashKey
Definition: fds.h:75
TBlobPt AddKey(const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDatBPt, const TBlobPt &VDatBPt)
Definition: fds.h:219
Definition: dt.h:1041
Definition: fl.h:417
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
bool Empty() const
Definition: blobbs.h:49
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
virtual TBlobPt PutBlob(const PSIn &SIn)=0

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::AddFDat ( const TKey &  Key,
const TFDat &  FDat 
)
inline

Definition at line 124 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::AddKey().

124  {
125  return AddKey(Key, true, FDat, false, TBlobPt());}
TBlobPt AddKey(const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDatBPt, const TBlobPt &VDatBPt)
Definition: fds.h:219
Definition: blobbs.h:5

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::AddFVDat ( const TKey &  Key,
const TFDat &  FDat,
const TVDat &  VDat 
)
inline

Definition at line 128 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::AddDat().

128  {
129  return AddDat(Key, true, FDat, true, VDat);}
TBlobPt AddDat(const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDat, const TVDat &VDat)
Definition: fds.h:258

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::AddKey ( const TKey &  Key,
const bool &  ChangeFDat,
const TFDat &  FDat,
const bool &  ChangeVDatBPt,
const TBlobPt VDatBPt 
)
private

Definition at line 219 of file fds.h.

References TBlobPt::Empty(), fhbtKey, TMOut::GetSIn(), TPt< TRec >::Save(), and TInt::Save().

Referenced by TFHash< TKey, TFDat, TVDat >::AddFDat().

222  {
223  // prepare key info
224  int PortN=-1; TBlobPt PrevKeyId; TBlobPt KeyId; PHashKey FHashKey;
225  GetKeyInfo(Key, PortN, PrevKeyId, KeyId, FHashKey);
226 
227  if (KeyId.Empty()){
228  // generate key
229  FHashKey=PHashKey(new THashKey(TBlobPt(), Key, FDat, VDatBPt));
230  // save key to blob-base
231  TMOut FHashKeyMOut;
232  TInt(int(fhbtKey)).Save(FHashKeyMOut); FHashKey->Save(FHashKeyMOut);
233  TBlobPt FHashKeyBPt=HashBBs->PutBlob(FHashKeyMOut.GetSIn());
234  // save key to key-cache
235  FHashKeyCache.Put(FHashKeyBPt, FHashKey);
236  FHashKey->PutModified(false);
237  // connect key to the structure
238  KeyId=FHashKeyBPt;
239  Keys++;
240  if (PrevKeyId.Empty()){
241  PortV[PortN]=KeyId;
242  } else {
243  PHashKey PrevFHashKey=GetFHashKey(PrevKeyId);
244  PrevFHashKey->Next=KeyId;
245  PrevFHashKey->PutModified(true);
246  }
247  } else {
248  // update the data
249  if (ChangeFDat){FHashKey->FDat=FDat;}
250  if (ChangeVDatBPt){FHashKey->VDatBPt=VDatBPt;}
251  if (ChangeFDat||ChangeVDatBPt){
252  FHashKey->PutModified(true);}
253  }
254  return KeyId;
255 }
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
void Save(TSOut &SOut) const
Definition: dt.h:1057
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:666
TFHashKey< TKey, TFDat, TVDat > THashKey
Definition: fds.h:74
TBlobPtV PortV
Definition: fds.h:78
TPt< THashKey > PHashKey
Definition: fds.h:75
Definition: dt.h:1041
Definition: fl.h:417
Definition: fds.h:6
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
bool Empty() const
Definition: blobbs.h:49
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
virtual TBlobPt PutBlob(const PSIn &SIn)=0
TInt Keys
Definition: fds.h:79

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::AddVDat ( const TKey &  Key,
const TVDat &  VDat 
)
inline

Definition at line 126 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::AddDat().

126  {
127  return AddDat(Key, false, TFDat(), true, VDat);}
TBlobPt AddDat(const TKey &Key, const bool &ChangeFDat, const TFDat &FDat, const bool &ChangeVDat, const TVDat &VDat)
Definition: fds.h:258

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::CacheFlushAndClr ( )
inline

Definition at line 119 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::FHashKeyCache.

119 {FHashKeyCache.FlushAndClr();}
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::DelKey ( const TKey &  Key)

Definition at line 285 of file fds.h.

References TBlobPt::Empty(), TPt< TRec >::Empty(), and IAssert.

Referenced by TFHash< TKey, TFDat, TVDat >::DelKeyId().

285  {
286  // prepare key info
287  int PortN=-1; TBlobPt PrevKeyId; TBlobPt KeyId; PHashKey FHashKey;
288  GetKeyInfo(Key, PortN, PrevKeyId, KeyId, FHashKey);
289 
290  // disconnect key
291  IAssert(!KeyId.Empty());
292  if (PrevKeyId.Empty()){
293  PortV[PortN]=FHashKey->Next;
294  } else {
295  PHashKey PrevFHashKey=GetFHashKey(PrevKeyId);
296  PrevFHashKey->Next=FHashKey->Next;
297  PrevFHashKey->PutModified(true);
298  }
299  // delete variable data
300  if (!FHashKey->VDatBPt.Empty()){
301  HashBBs->DelBlob(FHashKey->VDatBPt);}
302  // delete key/fixed data
303  HashBBs->DelBlob(KeyId);
304  FHashKeyCache.Del(KeyId, false);
305 }
#define IAssert(Cond)
Definition: bd.h:262
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
TBlobPtV PortV
Definition: fds.h:78
TPt< THashKey > PHashKey
Definition: fds.h:75
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
bool Empty() const
Definition: blobbs.h:49
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
virtual void DelBlob(const TBlobPt &BlobPt)=0

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::DelKeyId ( const TBlobPt KeyId)
inline

Definition at line 132 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::DelKey(), and TFHash< TKey, TFDat, TVDat >::GetKey().

132  {
133  TKey Key; GetKey(KeyId, Key); DelKey(Key);}
void GetKey(const TBlobPt &KeyId, TKey &Key)
Definition: fds.h:135
void DelKey(const TKey &Key)
Definition: fds.h:285

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
bool TFHash< TKey, TFDat, TVDat >::Empty ( ) const
inline

Definition at line 121 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::Keys.

121 {return Keys==0;}
TInt Keys
Definition: fds.h:79
template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::FFirstKeyId ( )

Definition at line 372 of file fds.h.

372  {
373  return HashBBs->FFirstBlobPt();
374 }
virtual TBlobPt FFirstBlobPt()=0
PBlobBs HashBBs
Definition: fds.h:77
template<class TKey , class TFDat , class TVDat >
bool TFHash< TKey, TFDat, TVDat >::FNextKeyId ( TBlobPt TrvBlobPt,
TBlobPt KeyId 
)

Definition at line 377 of file fds.h.

References fhbtKey.

378  {
379  PSIn SIn;
380  while (HashBBs->FNextBlobPt(TrvBlobPt, KeyId, SIn)){
381  TFHashBlobType Type=TFHashBlobType(int(TInt(*SIn)));
382  if (Type==fhbtKey){return true;}
383  }
384  return false;
385 }
virtual bool FNextBlobPt(TBlobPt &TrvBlobPt, TBlobPt &BlobPt, PSIn &BlobSIn)=0
TFHashBlobType
Definition: fds.h:6
Definition: dt.h:1041
Definition: fds.h:6
PBlobBs HashBBs
Definition: fds.h:77
Definition: bd.h:196
template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::GetFDat ( const TKey &  Key,
TFDat &  FDat 
)

Definition at line 308 of file fds.h.

309  {
310  // prepare key info
311  TBlobPt KeyId; PHashKey FHashKey;
312  GetKeyInfo(Key, KeyId, FHashKey);
313  // get fixed data
314  FDat=FHashKey->FDat;
315  return KeyId;
316 }
TPt< THashKey > PHashKey
Definition: fds.h:75
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
Definition: blobbs.h:5
template<class TKey , class TFDat , class TVDat >
PHashKey TFHash< TKey, TFDat, TVDat >::GetFHashKey ( const TBlobPt KeyId)
inlineprivate

Definition at line 84 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::FHashKeyCache, fhbtKey, TBlobBs::GetBlob(), TFHash< TKey, TFDat, TVDat >::HashBBs, and IAssert.

Referenced by TFHash< TKey, TFDat, TVDat >::GetKey().

84  {
85  PHashKey FHashKey;
86  if (!FHashKeyCache.Get(KeyId, FHashKey)){ // if the key is in cache
87  // read the key from blob-base
88  PSIn SIn=HashBBs->GetBlob(KeyId);
89  TFHashBlobType Type=TFHashBlobType(int(TInt(*SIn))); IAssert(Type==fhbtKey);
90  FHashKey=PHashKey(new THashKey(*SIn));
91  }
92  FHashKeyCache.Put(KeyId, FHashKey); // refresh/put key in cache
93  return FHashKey;
94  }
#define IAssert(Cond)
Definition: bd.h:262
TFHashBlobType
Definition: fds.h:6
TFHashKey< TKey, TFDat, TVDat > THashKey
Definition: fds.h:74
TPt< THashKey > PHashKey
Definition: fds.h:75
Definition: dt.h:1041
Definition: fds.h:6
PBlobBs HashBBs
Definition: fds.h:77
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80
Definition: bd.h:196
virtual PSIn GetBlob(const TBlobPt &BlobPt)=0

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::GetFVDat ( const TKey &  Key,
TFDat &  FDat,
TVDat &  VDat 
)

Definition at line 331 of file fds.h.

References fhbtVDat, and IAssert.

332  {
333  // prepare key info
334  TBlobPt KeyId; PHashKey FHashKey;
335  GetKeyInfo(Key, KeyId, FHashKey);
336  // get fixed data
337  FDat=FHashKey->FDat;
338  // get variable data
339  PSIn SIn=HashBBs->GetBlob(FHashKey->VDatBPt);
340  TFHashBlobType Type=TFHashBlobType(int(TInt(*SIn))); IAssert(Type==fhbtVDat);
341  VDat=TVDat(*SIn);
342  return KeyId;
343 }
Definition: fds.h:6
#define IAssert(Cond)
Definition: bd.h:262
TFHashBlobType
Definition: fds.h:6
TPt< THashKey > PHashKey
Definition: fds.h:75
Definition: dt.h:1041
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
Definition: bd.h:196
virtual PSIn GetBlob(const TBlobPt &BlobPt)=0
template<class TKey , class TFDat , class TVDat >
PBlobBs TFHash< TKey, TFDat, TVDat >::GetHashBBs ( )
inlineprivate

Definition at line 83 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::HashBBs.

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

83 {return HashBBs;}
PBlobBs HashBBs
Definition: fds.h:77

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::GetKey ( const TBlobPt KeyId,
TKey &  Key 
)
inline

Definition at line 135 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::GetFHashKey().

Referenced by TFHash< TKey, TFDat, TVDat >::DelKeyId().

135  {
136  PHashKey FHashKey=GetFHashKey(KeyId); Key=FHashKey->Key;}
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
TPt< THashKey > PHashKey
Definition: fds.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::GetKeyFDat ( const TBlobPt KeyId,
TKey &  Key,
TFDat &  FDat 
)

Definition at line 346 of file fds.h.

347  {
348  // prepare key info
349  PHashKey FHashKey=GetFHashKey(KeyId);
350  // get key
351  Key=FHashKey->Key;
352  // get fixed data
353  FDat=FHashKey->FDat;
354 }
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
TPt< THashKey > PHashKey
Definition: fds.h:75
template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::GetKeyFVDat ( const TBlobPt KeyId,
TKey &  Key,
TFDat &  FDat,
TVDat &  VDat 
)

Definition at line 357 of file fds.h.

References fhbtVDat, and IAssert.

358  {
359  // prepare key info
360  PHashKey FHashKey=GetFHashKey(KeyId);
361  // get key
362  Key=FHashKey->Key;
363  // get fixed data
364  FDat=FHashKey->FDat;
365  // get variable data
366  PSIn SIn=HashBBs->GetBlob(FHashKey->VDatBPt);
367  TFHashBlobType Type=TFHashBlobType(int(TInt(*SIn))); IAssert(Type==fhbtVDat);
368  VDat=TVDat(*SIn);
369 }
Definition: fds.h:6
#define IAssert(Cond)
Definition: bd.h:262
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
TFHashBlobType
Definition: fds.h:6
TPt< THashKey > PHashKey
Definition: fds.h:75
Definition: dt.h:1041
PBlobBs HashBBs
Definition: fds.h:77
Definition: bd.h:196
virtual PSIn GetBlob(const TBlobPt &BlobPt)=0
template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::GetKeyId ( const TKey &  Key)
inline

Definition at line 137 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::GetKeyInfo().

Referenced by TFHash< TKey, TFDat, TVDat >::IsKey().

137  {
138  TBlobPt KeyId; PHashKey FHashKey; GetKeyInfo(Key, KeyId, FHashKey);
139  return KeyId;}
TPt< THashKey > PHashKey
Definition: fds.h:75
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
Definition: blobbs.h:5

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::GetKeyInfo ( const TKey &  Key,
int &  PortN,
TBlobPt PrevKeyId,
TBlobPt KeyId,
PHashKey FHashKey 
)
private

Definition at line 160 of file fds.h.

References TBlobPt::Clr(), and TBlobPt::Empty().

Referenced by TFHash< TKey, TFDat, TVDat >::GetKeyId(), and TFHash< TKey, TFDat, TVDat >::GetKeyInfo().

162  {
163  // prepare key data
164  PortN=abs(Key.GetPrimHashCd())%PortV.Len();
165  PrevKeyId.Clr();
166  KeyId=PortV[PortN];
167 
168  // test if the key exists
169  if (!KeyId.Empty()){
170  FHashKey=GetFHashKey(KeyId);
171  while ((!KeyId.Empty())&&(FHashKey->Key!=Key)){
172  PrevKeyId=KeyId;
173  KeyId=FHashKey->Next;
174  if (!KeyId.Empty()){FHashKey=GetFHashKey(KeyId);}
175  }
176  }
177 }
PHashKey GetFHashKey(const TBlobPt &KeyId)
Definition: fds.h:84
void Clr()
Definition: blobbs.h:50
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
TBlobPtV PortV
Definition: fds.h:78
bool Empty() const
Definition: blobbs.h:49

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::GetKeyInfo ( const TKey &  Key,
TBlobPt KeyId,
PHashKey FHashKey 
)
inlineprivate

Definition at line 97 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::GetKeyInfo().

97  {
98  int PortN=-1; TBlobPt PrevKeyId;
99  GetKeyInfo(Key, PortN, PrevKeyId, KeyId, FHashKey);}
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
Definition: blobbs.h:5

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
int TFHash< TKey, TFDat, TVDat >::GetMemUsed ( )
inline

Definition at line 117 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::FHashKeyCache, TVec< TVal, TSizeTy >::GetMemUsed(), and TFHash< TKey, TFDat, TVDat >::PortV.

117  {
118  return PortV.GetMemUsed()+(int)FHashKeyCache.GetMemUsed();} //TODO:64bit
TSizeTy GetMemUsed() const
Returns the memory footprint (the number of bytes) of the vector.
Definition: ds.h:474
TBlobPtV PortV
Definition: fds.h:78
TCache< TBlobPt, PHashKey > FHashKeyCache
Definition: fds.h:80

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
TBlobPt TFHash< TKey, TFDat, TVDat >::GetVDat ( const TKey &  Key,
TVDat &  VDat 
)

Definition at line 319 of file fds.h.

References fhbtVDat, and IAssert.

319  {
320  // prepare key info
321  TBlobPt KeyId; PHashKey FHashKey;
322  GetKeyInfo(Key, KeyId, FHashKey);
323  // get variable data
324  PSIn SIn=HashBBs->GetBlob(FHashKey->VDatBPt);
325  TFHashBlobType Type=TFHashBlobType(int(TInt(*SIn))); IAssert(Type==fhbtVDat);
326  VDat=TVDat(*SIn);
327  return KeyId;
328 }
Definition: fds.h:6
#define IAssert(Cond)
Definition: bd.h:262
TFHashBlobType
Definition: fds.h:6
TPt< THashKey > PHashKey
Definition: fds.h:75
Definition: dt.h:1041
void GetKeyInfo(const TKey &Key, int &PortN, TBlobPt &PrevKeyId, TBlobPt &KeyId, PHashKey &FHashKey)
Definition: fds.h:160
Definition: blobbs.h:5
PBlobBs HashBBs
Definition: fds.h:77
Definition: bd.h:196
virtual PSIn GetBlob(const TBlobPt &BlobPt)=0
template<class TKey , class TFDat , class TVDat >
void* TFHash< TKey, TFDat, TVDat >::GetVoidThis ( ) const
inlineprivate

Definition at line 82 of file fds.h.

82 {return (void*)this;}
template<class TKey , class TFDat , class TVDat >
bool TFHash< TKey, TFDat, TVDat >::IsKey ( const TKey &  Key)
inline

Definition at line 140 of file fds.h.

References TBlobPt::Empty(), and TFHash< TKey, TFDat, TVDat >::GetKeyId().

140  {
141  return !GetKeyId(Key).Empty();}
TBlobPt GetKeyId(const TKey &Key)
Definition: fds.h:137
bool Empty() const
Definition: blobbs.h:49

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
bool TFHash< TKey, TFDat, TVDat >::IsKey ( const TKey &  Key,
TBlobPt KeyId 
)
inline

Definition at line 142 of file fds.h.

References TBlobPt::Empty(), and TFHash< TKey, TFDat, TVDat >::GetKeyId().

142  {
143  KeyId=GetKeyId(Key); return !KeyId.Empty();}
TBlobPt GetKeyId(const TKey &Key)
Definition: fds.h:137
bool Empty() const
Definition: blobbs.h:49

Here is the call graph for this function:

template<class TKey , class TFDat , class TVDat >
int TFHash< TKey, TFDat, TVDat >::Len ( ) const
inline

Definition at line 122 of file fds.h.

References TFHash< TKey, TFDat, TVDat >::Keys.

122 {return Keys;}
TInt Keys
Definition: fds.h:79
template<class TKey , class TFDat , class TVDat >
static PFHash TFHash< TKey, TFDat, TVDat >::Load ( TSIn )
inlinestatic

Definition at line 113 of file fds.h.

References Fail.

113 {Fail; return NULL;}
#define Fail
Definition: bd.h:238
template<class TKey , class TFDat , class TVDat >
TFHash& TFHash< TKey, TFDat, TVDat >::operator= ( const TFHash< TKey, TFDat, TVDat > &  )
inline

Definition at line 116 of file fds.h.

References Fail.

116 {Fail; return *this;}
#define Fail
Definition: bd.h:238
template<class TKey , class TFDat , class TVDat >
void TFHash< TKey, TFDat, TVDat >::Save ( TSOut )
inline

Definition at line 114 of file fds.h.

References Fail.

114 {Fail;}
#define Fail
Definition: bd.h:238

Friends And Related Function Documentation

template<class TKey , class TFDat , class TVDat >
friend class TFHashKey< TKey, TFDat, TVDat >
friend

Definition at line 154 of file fds.h.

template<class TKey , class TFDat , class TVDat >
friend class TPt< TFHash< TKey, TFDat, TVDat > >
friend

Definition at line 155 of file fds.h.

Member Data Documentation

template<class TKey , class TFDat , class TVDat >
TFAccess TFHash< TKey, TFDat, TVDat >::Access
private

Definition at line 76 of file fds.h.

Referenced by TFHash< TKey, TFDat, TVDat >::TFHash().

template<class TKey , class TFDat , class TVDat >
TCRef TFHash< TKey, TFDat, TVDat >::CRef
private

Definition at line 71 of file fds.h.

template<class TKey , class TFDat , class TVDat >
TCache<TBlobPt, PHashKey> TFHash< TKey, TFDat, TVDat >::FHashKeyCache
private
template<class TKey , class TFDat , class TVDat >
PBlobBs TFHash< TKey, TFDat, TVDat >::HashBBs
private
template<class TKey , class TFDat , class TVDat >
TInt TFHash< TKey, TFDat, TVDat >::Keys
private
template<class TKey , class TFDat , class TVDat >
TBlobPtV TFHash< TKey, TFDat, TVDat >::PortV
private

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