SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
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
TGBlobBs Class Reference

#include <blobbs.h>

Inheritance diagram for TGBlobBs:
Collaboration diagram for TGBlobBs:

Public Member Functions

 TGBlobBs (const TStr &BlobBsFNm, const TFAccess &_Access=faRdOnly, const int &_MxSegLen=-1)
 
 ~TGBlobBs ()
 
TGBlobBsoperator= (const TGBlobBs &)
 
TStr GetVersionStr () const
 
TBlobPt PutBlob (const PSIn &SIn)
 
TBlobPt PutBlob (const TBlobPt &BlobPt, const PSIn &SIn)
 
PSIn GetBlob (const TBlobPt &BlobPt)
 
void DelBlob (const TBlobPt &BlobPt)
 
TBlobPt GetFirstBlobPt ()
 
TBlobPt FFirstBlobPt ()
 
bool FNextBlobPt (TBlobPt &TrvBlobPt, TBlobPt &BlobPt, PSIn &BlobSIn)
 
- Public Member Functions inherited from TBlobBs
 UndefCopyAssign (TBlobBs)
 
 TBlobBs ()
 
virtual ~TBlobBs ()
 
 TBlobBs (TSIn &)
 
void Save (TSOut &) const
 
void PutVersionStr (const PFRnd &FBlobBs)
 
void AssertVersionStr (const PFRnd &FBlobBs)
 
TStr GetBlobBsStateStr (const TBlobBsState &BlobBsState)
 
int GetStateStrLen ()
 
void PutBlobBsStateStr (const PFRnd &FBlobBs, const TBlobBsState &State)
 
void AssertBlobBsStateStr (const PFRnd &FBlobBs, const TBlobBsState &State)
 
void PutMxSegLen (const PFRnd &FBlobBs, const int &MxSegLen)
 
int GetMxSegLen (const PFRnd &FBlobBs)
 
void GenBlockLenV (TIntV &BlockLenV)
 
void PutBlockLenV (const PFRnd &FBlobBs, const TIntV &BlockLenV)
 
void GetBlockLenV (const PFRnd &FBlobBs, TIntV &BlockLenV)
 
void GenFFreeBlobPtV (const TIntV &BlockLenV, TBlobPtV &FFreeBlobPtV)
 
void PutFFreeBlobPtV (const PFRnd &FBlobBs, const TBlobPtV &FFreeBlobPtV)
 
void GetFFreeBlobPtV (const PFRnd &FBlobBs, TBlobPtV &FFreeBlobPtV)
 
void GetAllocInfo (const int &BfL, const TIntV &BlockLenV, int &MxBfL, int &FFreeBlobPtN)
 
uint GetBeginBlobTag ()
 
uint GetEndBlobTag ()
 
void PutBlobTag (const PFRnd &FBlobBs, const TBlobTag &BlobTag)
 
void AssertBlobTag (const PFRnd &FBlobBs, const TBlobTag &BlobTag)
 
void PutBlobState (const PFRnd &FBlobBs, const TBlobState &State)
 
TBlobState GetBlobState (const PFRnd &FBlobBs)
 
void AssertBlobState (const PFRnd &FBlobBs, const TBlobState &State)
 
void AssertBfCsEqFlCs (const TCs &BfCs, const TCs &FCs)
 
TBlobPt PutBlob (const TStr &Str)
 
bool FNextBlobPt (TBlobPt &TrvBlobPt, PSIn &BlobSIn)
 

Static Public Member Functions

static PBlobBs New (const TStr &BlobBsFNm, const TFAccess &Access=faRdOnly, const int &MxSegLen=-1)
 
static bool Exists (const TStr &BlobBsFNm)
 
- Static Public Member Functions inherited from TBlobBs
static PBlobBs Load (TSIn &)
 

Static Private Member Functions

static TStr GetNrBlobBsFNm (const TStr &BlobBsFNm)
 

Private Attributes

PFRnd FBlobBs
 
TFAccess Access
 
int MxSegLen
 
TIntV BlockLenV
 
TBlobPtV FFreeBlobPtV
 
TBlobPt FirstBlobPt
 

Additional Inherited Members

- Static Public Attributes inherited from TBlobBs
static const int MnBlobBfL =16
 
static const int MxBlobFLen =1000000000
 
static const TStr MxSegLenVNm ="MxSegLen"
 
static const TStr BlockLenVNm ="BlockLenV"
 
static const TStr FFreeBlobPtVNm ="FFreeBlobPtV"
 

Detailed Description

Definition at line 154 of file blobbs.h.

Constructor & Destructor Documentation

TGBlobBs::TGBlobBs ( const TStr BlobBsFNm,
const TFAccess _Access = faRdOnly,
const int &  _MxSegLen = -1 
)

Definition at line 220 of file blobbs.cpp.

References Access, TBlobBs::AssertBlobBsStateStr(), TBlobBs::AssertVersionStr(), bbsClosed, bbsOpened, BlockLenV, TFRnd::Empty(), faCreate, Fail, faRdOnly, faRestore, faUpdate, FBlobBs, FFreeBlobPtV, FirstBlobPt, TFRnd::Flush(), TBlobBs::GenBlockLenV(), TBlobBs::GenFFreeBlobPtV(), TBlobBs::GetBlockLenV(), TBlobBs::GetFFreeBlobPtV(), TFRnd::GetFPos(), TBlobBs::GetMxSegLen(), GetNrBlobBsFNm(), TBlobBs::MxBlobFLen, MxSegLen, TFRnd::New(), TBlobBs::PutBlobBsStateStr(), TBlobBs::PutBlockLenV(), TBlobBs::PutFFreeBlobPtV(), TBlobBs::PutMxSegLen(), TBlobBs::PutVersionStr(), and TFRnd::SetFPos().

Referenced by New().

221  :
222  TBlobBs(), FBlobBs(), Access(_Access), MxSegLen(_MxSegLen),
224  if (MxSegLen==-1){MxSegLen=MxBlobFLen;}
225  TStr NrBlobBsFNm=GetNrBlobBsFNm(BlobBsFNm);
226  switch (Access){
227  case faCreate:
228  FBlobBs=TFRnd::New(NrBlobBsFNm, faCreate, true); break;
229  case faUpdate:
230  case faRdOnly:
231  case faRestore:
232  FBlobBs=TFRnd::New(NrBlobBsFNm, faUpdate, true); break;
233  default: Fail;
234  }
235  if (FBlobBs->Empty()){
236  FBlobBs->SetFPos(0);
244  } else {
245  FBlobBs->SetFPos(0);
247  int FPos=FBlobBs->GetFPos();
248  if (Access!=faRestore){
250  if (Access!=faRdOnly){
251  FBlobBs->SetFPos(FPos);
253  }
257  }
259  FBlobBs->Flush();
260 }
TFAccess Access
Definition: blobbs.h:157
static PFRnd New(const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo=true, const int &HdLen=-1, const int &RecLen=-1)
Definition: fl.h:583
void GenFFreeBlobPtV(const TIntV &BlockLenV, TBlobPtV &FFreeBlobPtV)
Definition: blobbs.cpp:148
void AssertVersionStr(const PFRnd &FBlobBs)
Definition: blobbs.cpp:68
Definition: fl.h:347
void GetFFreeBlobPtV(const PFRnd &FBlobBs, TBlobPtV &FFreeBlobPtV)
Definition: blobbs.cpp:160
void Flush()
Definition: fl.cpp:1066
#define Fail
Definition: bd.h:238
void PutVersionStr(const PFRnd &FBlobBs)
Definition: blobbs.cpp:64
void AssertBlobBsStateStr(const PFRnd &FBlobBs, const TBlobBsState &State)
Definition: blobbs.cpp:90
Definition: fl.h:347
void PutMxSegLen(const PFRnd &FBlobBs, const int &MxSegLen)
Definition: blobbs.cpp:102
TBlobBs()
Definition: blobbs.h:95
int MxSegLen
Definition: blobbs.h:158
void PutFFreeBlobPtV(const PFRnd &FBlobBs, const TBlobPtV &FFreeBlobPtV)
Definition: blobbs.cpp:152
TBlobPt FirstBlobPt
Definition: blobbs.h:161
static TStr GetNrBlobBsFNm(const TStr &BlobBsFNm)
Definition: blobbs.cpp:213
Definition: fl.h:347
PFRnd FBlobBs
Definition: blobbs.h:156
void GenBlockLenV(TIntV &BlockLenV)
Definition: blobbs.cpp:114
void GetBlockLenV(const PFRnd &FBlobBs, TIntV &BlockLenV)
Definition: blobbs.cpp:138
TIntV BlockLenV
Definition: blobbs.h:159
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
void PutBlobBsStateStr(const PFRnd &FBlobBs, const TBlobBsState &State)
Definition: blobbs.cpp:86
void PutBlockLenV(const PFRnd &FBlobBs, const TIntV &BlockLenV)
Definition: blobbs.cpp:130
Definition: dt.h:412
Definition: blobbs.h:5
int GetFPos()
Definition: fl.cpp:1019
int GetMxSegLen(const PFRnd &FBlobBs)
Definition: blobbs.cpp:107
static const int MxBlobFLen
Definition: blobbs.h:92
Definition: fl.h:347
static const int B4Bits
Definition: bits.h:54
bool Empty()
Definition: fl.h:597
TBlobPtV FFreeBlobPtV
Definition: blobbs.h:160

Here is the call graph for this function:

Here is the caller graph for this function:

TGBlobBs::~TGBlobBs ( )

Definition at line 262 of file blobbs.cpp.

References Access, bbsClosed, BlockLenV, faRdOnly, FBlobBs, FFreeBlobPtV, TFRnd::Flush(), MxSegLen, TBlobBs::PutBlobBsStateStr(), TBlobBs::PutBlockLenV(), TBlobBs::PutFFreeBlobPtV(), TBlobBs::PutMxSegLen(), TBlobBs::PutVersionStr(), and TFRnd::SetFPos().

262  {
263  if (Access!=faRdOnly){
264  FBlobBs->SetFPos(0);
270  }
271  FBlobBs->Flush();
272  FBlobBs=NULL;
273 }
TFAccess Access
Definition: blobbs.h:157
void Flush()
Definition: fl.cpp:1066
void PutVersionStr(const PFRnd &FBlobBs)
Definition: blobbs.cpp:64
void PutMxSegLen(const PFRnd &FBlobBs, const int &MxSegLen)
Definition: blobbs.cpp:102
int MxSegLen
Definition: blobbs.h:158
void PutFFreeBlobPtV(const PFRnd &FBlobBs, const TBlobPtV &FFreeBlobPtV)
Definition: blobbs.cpp:152
Definition: fl.h:347
PFRnd FBlobBs
Definition: blobbs.h:156
TIntV BlockLenV
Definition: blobbs.h:159
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
void PutBlobBsStateStr(const PFRnd &FBlobBs, const TBlobBsState &State)
Definition: blobbs.cpp:86
void PutBlockLenV(const PFRnd &FBlobBs, const TIntV &BlockLenV)
Definition: blobbs.cpp:130
TBlobPtV FFreeBlobPtV
Definition: blobbs.h:160

Here is the call graph for this function:

Member Function Documentation

void TGBlobBs::DelBlob ( const TBlobPt BlobPt)
virtual

Implements TBlobBs.

Definition at line 353 of file blobbs.cpp.

References Access, TBlobBs::AssertBlobState(), TBlobBs::AssertBlobTag(), BlockLenV, bsActive, bsFree, btBegin, btEnd, EAssert, faCreate, faRestore, faUpdate, FBlobBs, FFreeBlobPtV, TFRnd::Flush(), TBlobPt::GetAddr(), TBlobBs::GetAllocInfo(), TFRnd::GetFPos(), TFRnd::GetInt(), TCh::NullCh, TBlobBs::PutBlobState(), TFRnd::PutCh(), and TFRnd::SetFPos().

Referenced by PutBlob().

353  {
355  FBlobBs->SetFPos(BlobPt.GetAddr());
357  int MxBfL=FBlobBs->GetInt();
358  int FPos=FBlobBs->GetFPos();
360  /*int BfL=*/FBlobBs->GetInt();
361  FBlobBs->SetFPos(FPos);
363  int _MxBfL; int FFreeBlobPtN;
364  GetAllocInfo(MxBfL, BlockLenV, _MxBfL, FFreeBlobPtN);
365  EAssert(MxBfL==_MxBfL);
366  FFreeBlobPtV[FFreeBlobPtN].SaveAddr(FBlobBs);
367  FFreeBlobPtV[FFreeBlobPtN]=BlobPt;
368  FBlobBs->PutCh(TCh::NullCh, MxBfL+sizeof(TCs));
370  FBlobBs->Flush();
371 }
TFAccess Access
Definition: blobbs.h:157
Definition: fl.h:347
Definition: blobbs.h:86
void PutBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:193
Definition: blobbs.h:86
void Flush()
Definition: fl.cpp:1066
static const char NullCh
Definition: dt.h:1033
Definition: fl.h:347
void GetAllocInfo(const int &BfL, const TIntV &BlockLenV, int &MxBfL, int &FFreeBlobPtN)
Definition: blobbs.cpp:168
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:185
uint GetAddr() const
Definition: blobbs.h:54
PFRnd FBlobBs
Definition: blobbs.h:156
TIntV BlockLenV
Definition: blobbs.h:159
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int GetInt()
Definition: fl.h:625
void PutCh(const char &Ch)
Definition: fl.h:619
#define EAssert(Cond)
Definition: bd.h:280
void AssertBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:201
int GetFPos()
Definition: fl.cpp:1019
Definition: blobbs.h:87
Definition: fl.h:11
Definition: fl.h:347
TBlobPtV FFreeBlobPtV
Definition: blobbs.h:160

Here is the call graph for this function:

Here is the caller graph for this function:

bool TGBlobBs::Exists ( const TStr BlobBsFNm)
static

Definition at line 410 of file blobbs.cpp.

References TFile::Exists(), and GetNrBlobBsFNm().

410  {
411  TStr NrBlobBsFNm=GetNrBlobBsFNm(BlobBsFNm);
412  return TFile::Exists(NrBlobBsFNm);
413 }
static bool Exists(const TStr &FNm)
Definition: fl.cpp:1156
static TStr GetNrBlobBsFNm(const TStr &BlobBsFNm)
Definition: blobbs.cpp:213
Definition: dt.h:412

Here is the call graph for this function:

TBlobPt TGBlobBs::FFirstBlobPt ( )
virtual

Implements TBlobBs.

Definition at line 373 of file blobbs.cpp.

References FirstBlobPt.

373  {
374  return FirstBlobPt;
375 }
TBlobPt FirstBlobPt
Definition: blobbs.h:161
bool TGBlobBs::FNextBlobPt ( TBlobPt TrvBlobPt,
TBlobPt BlobPt,
PSIn BlobSIn 
)
virtual

Implements TBlobBs.

Definition at line 377 of file blobbs.cpp.

References TBlobBs::AssertBfCsEqFlCs(), TBlobBs::AssertBlobTag(), bsActive, bsFree, btBegin, btEnd, TBlobPt::Clr(), Fail, FBlobBs, forever, TBlobPt::GetAddr(), TBlobBs::GetBlobState(), TFRnd::GetCs(), TFRnd::GetFLen(), TFRnd::GetFPos(), TFRnd::GetInt(), TFRnd::GetSIn(), TFRnd::MoveFPos(), and TFRnd::SetFPos().

377  {
378  forever {
379  uint TrvBlobAddr=TrvBlobPt.GetAddr();
380  if (TrvBlobAddr>=uint(FBlobBs->GetFLen())){
381  TrvBlobPt.Clr(); BlobPt.Clr(); BlobSIn=NULL;
382  return false;
383  } else {
384  FBlobBs->SetFPos(TrvBlobAddr);
386  int MxBfL=FBlobBs->GetInt();
387  TBlobState BlobState=GetBlobState(FBlobBs);
388  switch (BlobState){
389  case bsActive:{
390  int BfL=FBlobBs->GetInt();
391  TCs BfCs; BlobSIn=FBlobBs->GetSIn(BfL, BfCs);
392  FBlobBs->MoveFPos(MxBfL-BfL);
393  TCs FCs=FBlobBs->GetCs();
395  AssertBfCsEqFlCs(BfCs, FCs);
396  BlobPt=TrvBlobPt;
397  TrvBlobPt=TBlobPt(FBlobBs->GetFPos());
398  return true;}
399  case bsFree:
400  FBlobBs->MoveFPos(sizeof(uint)+MxBfL+sizeof(TCs));
402  TrvBlobPt=TBlobPt(FBlobBs->GetFPos());
403  break;
404  default: Fail; return false;
405  }
406  }
407  }
408 }
void Clr()
Definition: blobbs.h:50
Definition: blobbs.h:86
#define forever
Definition: bd.h:6
Definition: blobbs.h:86
unsigned int uint
Definition: bd.h:11
#define Fail
Definition: bd.h:238
int GetFLen()
Definition: fl.cpp:1025
TBlobState GetBlobState(const PFRnd &FBlobBs)
Definition: blobbs.cpp:197
void AssertBfCsEqFlCs(const TCs &BfCs, const TCs &FCs)
Definition: blobbs.cpp:205
TBlobState
Definition: blobbs.h:87
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:185
uint GetAddr() const
Definition: blobbs.h:54
void MoveFPos(const int &DFPos)
Definition: fl.cpp:1013
PFRnd FBlobBs
Definition: blobbs.h:156
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int GetInt()
Definition: fl.h:625
TCs GetCs()
Definition: fl.h:618
Definition: blobbs.h:5
PSIn GetSIn(const int &SInLen, TCs &Cs)
Definition: fl.cpp:1113
int GetFPos()
Definition: fl.cpp:1019
Definition: blobbs.h:87
Definition: fl.h:11

Here is the call graph for this function:

PSIn TGBlobBs::GetBlob ( const TBlobPt BlobPt)
virtual

Implements TBlobBs.

Definition at line 339 of file blobbs.cpp.

References TBlobBs::AssertBfCsEqFlCs(), TBlobBs::AssertBlobState(), TBlobBs::AssertBlobTag(), bsActive, btBegin, btEnd, FBlobBs, TBlobPt::GetAddr(), TFRnd::GetCs(), TFRnd::GetInt(), TFRnd::GetSIn(), TFRnd::MoveFPos(), and TFRnd::SetFPos().

339  {
340  FBlobBs->SetFPos(BlobPt.GetAddr());
342  int MxBfL=FBlobBs->GetInt();
344  int BfL=FBlobBs->GetInt();
345  TCs BfCs; PSIn SIn=FBlobBs->GetSIn(BfL, BfCs);
346  FBlobBs->MoveFPos(MxBfL-BfL);
347  TCs FCs=FBlobBs->GetCs();
349  AssertBfCsEqFlCs(BfCs, FCs);
350  return SIn;
351 }
Definition: blobbs.h:86
Definition: blobbs.h:86
void AssertBfCsEqFlCs(const TCs &BfCs, const TCs &FCs)
Definition: blobbs.cpp:205
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:185
uint GetAddr() const
Definition: blobbs.h:54
void MoveFPos(const int &DFPos)
Definition: fl.cpp:1013
PFRnd FBlobBs
Definition: blobbs.h:156
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int GetInt()
Definition: fl.h:625
TCs GetCs()
Definition: fl.h:618
PSIn GetSIn(const int &SInLen, TCs &Cs)
Definition: fl.cpp:1113
void AssertBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:201
Definition: fl.h:11

Here is the call graph for this function:

TBlobPt TGBlobBs::GetFirstBlobPt ( )
inlinevirtual

Implements TBlobBs.

Definition at line 179 of file blobbs.h.

References FirstBlobPt.

179 {return FirstBlobPt;}
TBlobPt FirstBlobPt
Definition: blobbs.h:161
TStr TGBlobBs::GetNrBlobBsFNm ( const TStr BlobBsFNm)
staticprivate

Definition at line 213 of file blobbs.cpp.

References TStr::Empty(), and TStr::GetFExt().

Referenced by Exists(), and TGBlobBs().

213  {
214  TStr NrBlobBsFNm=BlobBsFNm;
215  if (NrBlobBsFNm.GetFExt().Empty()){
216  NrBlobBsFNm=NrBlobBsFNm+".gbb";}
217  return NrBlobBsFNm;
218 }
TStr GetFExt() const
Definition: dt.cpp:1421
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TGBlobBs::GetVersionStr ( ) const
inlinevirtual

Implements TBlobBs.

Definition at line 173 of file blobbs.h.

173 {return TStr("General Blob Base Format 1.0");}
Definition: dt.h:412
static PBlobBs TGBlobBs::New ( const TStr BlobBsFNm,
const TFAccess Access = faRdOnly,
const int &  MxSegLen = -1 
)
inlinestatic

Definition at line 166 of file blobbs.h.

References Access, MxSegLen, and TGBlobBs().

Referenced by TMBlobBs::PutBlob(), and TMBlobBs::TMBlobBs().

167  {
168  return PBlobBs(new TGBlobBs(BlobBsFNm, Access, MxSegLen));}
TGBlobBs(const TStr &BlobBsFNm, const TFAccess &_Access=faRdOnly, const int &_MxSegLen=-1)
Definition: blobbs.cpp:220
TFAccess Access
Definition: blobbs.h:157
int MxSegLen
Definition: blobbs.h:158
TPt< TBlobBs > PBlobBs
Definition: blobbs.h:89

Here is the call graph for this function:

Here is the caller graph for this function:

TGBlobBs& TGBlobBs::operator= ( const TGBlobBs )
inline

Definition at line 171 of file blobbs.h.

References Fail.

171 {Fail; return *this;}
#define Fail
Definition: bd.h:238
TBlobPt TGBlobBs::PutBlob ( const PSIn SIn)
virtual

Implements TBlobBs.

Definition at line 275 of file blobbs.cpp.

References Access, TBlobBs::AssertBlobState(), TBlobBs::AssertBlobTag(), BlockLenV, bsActive, bsFree, btBegin, btEnd, EAssert, faCreate, faRestore, faUpdate, FBlobBs, FFreeBlobPtV, TFRnd::Flush(), TBlobPt::GetAddr(), TBlobBs::GetAllocInfo(), TFRnd::GetFLen(), TFRnd::GetFPos(), TFRnd::GetInt(), TSIn::Len(), TBlobPt::LoadAddr(), TBlobBs::MxBlobFLen, MxSegLen, TCh::NullCh, TBlobBs::PutBlobState(), TBlobBs::PutBlobTag(), TFRnd::PutCh(), TFRnd::PutCs(), TFRnd::PutInt(), TFRnd::PutSIn(), and TFRnd::SetFPos().

Referenced by PutBlob().

275  {
277  int BfL=SIn->Len();
278  int MxBfL; int FFreeBlobPtN;
279  GetAllocInfo(BfL, BlockLenV, MxBfL, FFreeBlobPtN);
280  TBlobPt BlobPt; TCs Cs;
281  if (FFreeBlobPtV[FFreeBlobPtN].Empty()){
282  int FLen=FBlobBs->GetFLen();
283  if (FLen<=MxSegLen){
284  EAssert(FLen<=MxBlobFLen);
285  BlobPt=TBlobPt(FLen);
286  FBlobBs->SetFPos(BlobPt.GetAddr());
288  FBlobBs->PutInt(MxBfL);
290  FBlobBs->PutInt(BfL);
291  FBlobBs->PutSIn(SIn, Cs);
292  FBlobBs->PutCh(TCh::NullCh, MxBfL-BfL);
293  FBlobBs->PutCs(Cs);
295  }
296  } else {
297  BlobPt=FFreeBlobPtV[FFreeBlobPtN];
298  FBlobBs->SetFPos(BlobPt.GetAddr());
300  int MxBfL=FBlobBs->GetInt();
301  int FPos=FBlobBs->GetFPos();
303  FFreeBlobPtV[FFreeBlobPtN]=TBlobPt::LoadAddr(FBlobBs);
304  FBlobBs->SetFPos(FPos);
306  FBlobBs->PutInt(BfL);
307  FBlobBs->PutSIn(SIn, Cs);
308  FBlobBs->PutCh(TCh::NullCh, MxBfL-BfL);
309  FBlobBs->PutCs(Cs);
311  }
312  FBlobBs->Flush();
313  return BlobPt;
314 }
TFAccess Access
Definition: blobbs.h:157
Definition: fl.h:347
void PutBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:177
Definition: blobbs.h:86
void PutBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:193
Definition: blobbs.h:86
void Flush()
Definition: fl.cpp:1066
void PutInt(const int &Int)
Definition: fl.h:624
int GetFLen()
Definition: fl.cpp:1025
static const char NullCh
Definition: dt.h:1033
void PutSIn(const PSIn &SIn, TCs &Cs)
Definition: fl.cpp:1104
Definition: fl.h:347
void GetAllocInfo(const int &BfL, const TIntV &BlockLenV, int &MxBfL, int &FFreeBlobPtN)
Definition: blobbs.cpp:168
void PutCs(const TCs &Cs)
Definition: fl.h:617
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:185
int MxSegLen
Definition: blobbs.h:158
uint GetAddr() const
Definition: blobbs.h:54
PFRnd FBlobBs
Definition: blobbs.h:156
TIntV BlockLenV
Definition: blobbs.h:159
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int GetInt()
Definition: fl.h:625
void PutCh(const char &Ch)
Definition: fl.h:619
#define EAssert(Cond)
Definition: bd.h:280
Definition: blobbs.h:5
void AssertBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:201
int GetFPos()
Definition: fl.cpp:1019
static TBlobPt LoadAddr(const PFRnd &FRnd, const uchar &Seg=0)
Definition: blobbs.h:71
virtual int Len() const =0
static const int MxBlobFLen
Definition: blobbs.h:92
Definition: blobbs.h:87
Definition: fl.h:11
Definition: fl.h:347
TBlobPtV FFreeBlobPtV
Definition: blobbs.h:160

Here is the call graph for this function:

Here is the caller graph for this function:

TBlobPt TGBlobBs::PutBlob ( const TBlobPt BlobPt,
const PSIn SIn 
)
virtual

Implements TBlobBs.

Definition at line 316 of file blobbs.cpp.

References Access, TBlobBs::AssertBlobState(), TBlobBs::AssertBlobTag(), bsActive, btBegin, btEnd, DelBlob(), EAssert, faCreate, faRestore, faUpdate, FBlobBs, TFRnd::Flush(), TBlobPt::GetAddr(), TFRnd::GetInt(), TSIn::Len(), TCh::NullCh, PutBlob(), TBlobBs::PutBlobTag(), TFRnd::PutCh(), TFRnd::PutCs(), TFRnd::PutInt(), TFRnd::PutSIn(), and TFRnd::SetFPos().

316  {
318  int BfL=SIn->Len();
319 
320  FBlobBs->SetFPos(BlobPt.GetAddr());
322  int MxBfL=FBlobBs->GetInt();
324  if (BfL>MxBfL){
325  DelBlob(BlobPt);
326  return PutBlob(SIn);
327  } else {
328  TCs Cs;
329  FBlobBs->PutInt(BfL);
330  FBlobBs->PutSIn(SIn, Cs);
331  FBlobBs->PutCh(TCh::NullCh, MxBfL-BfL);
332  FBlobBs->PutCs(Cs);
334  FBlobBs->Flush();
335  return BlobPt;
336  }
337 }
void DelBlob(const TBlobPt &BlobPt)
Definition: blobbs.cpp:353
TFAccess Access
Definition: blobbs.h:157
Definition: fl.h:347
void PutBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:177
Definition: blobbs.h:86
Definition: blobbs.h:86
void Flush()
Definition: fl.cpp:1066
void PutInt(const int &Int)
Definition: fl.h:624
static const char NullCh
Definition: dt.h:1033
void PutSIn(const PSIn &SIn, TCs &Cs)
Definition: fl.cpp:1104
Definition: fl.h:347
void PutCs(const TCs &Cs)
Definition: fl.h:617
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
Definition: blobbs.cpp:185
uint GetAddr() const
Definition: blobbs.h:54
PFRnd FBlobBs
Definition: blobbs.h:156
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int GetInt()
Definition: fl.h:625
void PutCh(const char &Ch)
Definition: fl.h:619
#define EAssert(Cond)
Definition: bd.h:280
TBlobPt PutBlob(const PSIn &SIn)
Definition: blobbs.cpp:275
void AssertBlobState(const PFRnd &FBlobBs, const TBlobState &State)
Definition: blobbs.cpp:201
virtual int Len() const =0
Definition: fl.h:11
Definition: fl.h:347

Here is the call graph for this function:

Member Data Documentation

TFAccess TGBlobBs::Access
private

Definition at line 157 of file blobbs.h.

Referenced by DelBlob(), New(), PutBlob(), TGBlobBs(), and ~TGBlobBs().

TIntV TGBlobBs::BlockLenV
private

Definition at line 159 of file blobbs.h.

Referenced by DelBlob(), PutBlob(), TGBlobBs(), and ~TGBlobBs().

PFRnd TGBlobBs::FBlobBs
private

Definition at line 156 of file blobbs.h.

Referenced by DelBlob(), FNextBlobPt(), GetBlob(), PutBlob(), TGBlobBs(), and ~TGBlobBs().

TBlobPtV TGBlobBs::FFreeBlobPtV
private

Definition at line 160 of file blobbs.h.

Referenced by DelBlob(), PutBlob(), TGBlobBs(), and ~TGBlobBs().

TBlobPt TGBlobBs::FirstBlobPt
private

Definition at line 161 of file blobbs.h.

Referenced by FFirstBlobPt(), GetFirstBlobPt(), and TGBlobBs().

int TGBlobBs::MxSegLen
private

Definition at line 158 of file blobbs.h.

Referenced by New(), PutBlob(), TGBlobBs(), and ~TGBlobBs().


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