21 default:
Fail;
return false;
27 case 1:
FSet1=FSet;
break;
28 case 2:
FSet2=FSet;
break;
29 case 3:
FSet3=FSet;
break;
50 for (
int FlagN=0; FlagN<
Flags; FlagN++){
71 TStr TestVersionStr=FBlobBs->
GetStr(CorrVersionStr.
Len(), IsOk);
72 EAssert(IsOk && (CorrVersionStr==TestVersionStr));
95 if (!(IsOk && (CorrStateStr==TestStateStr))) {
104 FBlobBs->
PutInt(MxSegLen);
120 {
for (
int Len=10; Len<100; Len+=10){BlockLenV.
Add(Len);}}
121 {
for (
int Len=100; Len<10000; Len+=100){BlockLenV.
Add(Len);}}
122 {
for (
int Len=10000; Len<100000; Len+=1000){BlockLenV.
Add(Len);}}
123 {
for (
int Len=100000; Len<1000000; Len+=25000){BlockLenV.
Add(Len);}}
124 {
for (
int Len=1000000; Len<10000000; Len+=1000000){BlockLenV.
Add(Len);}}
125 {
for (
int Len=10000000; Len<100000000; Len+=10000000){BlockLenV.
Add(Len);}}
133 for (
int BlockLenN=0; BlockLenN<BlockLenV.
Len(); BlockLenN++){
134 FBlobBs->
PutInt(BlockLenV[BlockLenN]);}
141 for (
int BlockLenN=0; BlockLenN<BlockLenV.
Len(); BlockLenN++){
142 BlockLenV[BlockLenN]=FBlobBs->
GetInt();}
149 FFreeBlobPtV.
Gen(BlockLenV.
Len()+1);
155 for (
int BlockLenN=0; BlockLenN<FFreeBlobPtV.
Len(); BlockLenN++){
156 FFreeBlobPtV[BlockLenN].
Save(FBlobBs);}
163 for (
int FFreeBlobPtN=0; FFreeBlobPtN<FFreeBlobPtV.
Len(); FFreeBlobPtN++){
169 const int& BfL,
const TIntV& BlockLenV,
int& MxBfL,
int& FFreeBlobPtN){
171 while ((BlockLenN<BlockLenV.
Len())&&(BfL>BlockLenV[BlockLenN])){
174 MxBfL=BlockLenV[BlockLenN]; FFreeBlobPtN=BlockLenN;
194 FBlobBs->
PutCh(
char(State));
207 printf(
"[%d:%d]\n", BfCs.
Get(), FCs.
Get());}
214 TStr NrBlobBsFNm=BlobBsFNm;
216 NrBlobBsFNm=NrBlobBsFNm+
".gbb";}
221 const TStr& BlobBsFNm,
const TFAccess& _Access,
const int& _MxSegLen):
222 TBlobBs(), FBlobBs(), Access(_Access), MxSegLen(_MxSegLen),
223 BlockLenV(), FFreeBlobPtV(
TB4Def::B4Bits), FirstBlobPt(){
278 int MxBfL;
int FFreeBlobPtN;
363 int _MxBfL;
int FFreeBlobPtN;
381 TrvBlobPt.
Clr(); BlobPt.
Clr(); BlobSIn=NULL;
404 default:
Fail;
return false;
424 const TStr& NrFPath,
const TStr& NrFMid){
425 return NrFPath+NrFMid+
".mbb";
429 const TStr& NrFPath,
const TStr& NrFMid,
const int& SegN){
450 const TStr& BlobBsFNm,
const TFAccess& _Access,
const int& _MxSegLen):
451 TBlobBs(), Access(_Access), MxSegLen(_MxSegLen),
452 NrFPath(), NrFMid(), SegV(), CurSegN(0){
465 for (
int SegN=0; SegN<Segs; SegN++){
515 if (!BlobPt.
Empty()){
break;}
524 if (!BlobPt.
Empty()){
532 TBlobPt NewBlobPt=
SegV[SegN]->PutBlob(BlobPt, SIn);
533 if (NewBlobPt.
Empty()){
543 return SegV[SegN]->GetBlob(BlobPt);
548 SegV[SegN]->DelBlob(BlobPt);
552 return SegV[0]->GetFirstBlobPt();
556 return SegV[0]->FFirstBlobPt();
570 TrvBlobPt=
SegV[SegN]->FFirstBlobPt();
void DelBlob(const TBlobPt &BlobPt)
TGBlobBs(const TStr &BlobBsFNm, const TFAccess &_Access=faRdOnly, const int &_MxSegLen=-1)
void DelBlob(const TBlobPt &BlobPt)
TStr GetStr(const int &StrLen)
static PFRnd New(const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo=true, const int &HdLen=-1, const int &RecLen=-1)
virtual int Len() const =0
void GenFFreeBlobPtV(const TIntV &BlockLenV, TBlobPtV &FFreeBlobPtV)
void AssertVersionStr(const PFRnd &FBlobBs)
static void GetNrFPathFMid(const TStr &BlobBsFNm, TStr &NrFPath, TStr &NrFMid)
static TBlobPt Load(const PFRnd &FRnd)
static PSOut New(const TStr &FNm, const bool &Append=false)
void PutSeg(const uchar &_Seg)
void PutBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
TB8Set GetFSet(const int &FSetN)
static bool Exists(const TStr &FNm)
void PutBlobState(const PFRnd &FBlobBs, const TBlobState &State)
void SetBit(const int &BitN, const bool &Bool)
void GetFFreeBlobPtV(const PFRnd &FBlobBs, TBlobPtV &FFreeBlobPtV)
static TStr GetSegFNm(const TStr &NrFPath, const TStr &NrFMid, const int &SegN)
void PutInt(const int &Int)
bool FNextBlobPt(TBlobPt &TrvBlobPt, TBlobPt &BlobPt, PSIn &BlobSIn)
TStr GetVarStr(const TStr &VarNm, const bool &NewLn=true)
TSizeTy Len() const
Returns the number of elements in the vector.
static bool Exists(const TStr &BlobBsFNm)
void PutVersionStr(const PFRnd &FBlobBs)
void AssertBlobBsStateStr(const PFRnd &FBlobBs, const TBlobBsState &State)
TBlobState GetBlobState(const PFRnd &FBlobBs)
virtual TStr GetVersionStr() const =0
void PutSIn(const PSIn &SIn, TCs &Cs)
static TStr GetNrFMid(const TStr &FMid)
void PutUInt(const uint &UInt)
void GetAllocInfo(const int &BfL, const TIntV &BlockLenV, int &MxBfL, int &FFreeBlobPtN)
bool IsFlag(const int &FlagN) const
void PutMxSegLen(const PFRnd &FBlobBs, const int &MxSegLen)
int GetVarInt(const TStr &VarNm, const bool &NewLn=true)
void AssertBfCsEqFlCs(const TCs &BfCs, const TCs &FCs)
void PutFlag(const int &FlagN, const bool &Val)
void Save(TSOut &SOut) const
void PutFSet(const int &FSetN, const TB8Set &FSet)
void PutCs(const TCs &Cs)
void AssertBlobTag(const PFRnd &FBlobBs, const TBlobTag &BlobTag)
static PSIn New(const TStr &FNm)
void PutFFreeBlobPtV(const PFRnd &FBlobBs, const TBlobPtV &FFreeBlobPtV)
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
static void DelWc(const TStr &WcStr, const bool &RecurseDirP=false)
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
static TStr GetNrBlobBsFNm(const TStr &BlobBsFNm)
static void Throw(const TStr &MsgStr)
void MoveFPos(const int &DFPos)
void GenBlockLenV(TIntV &BlockLenV)
void GetBlockLenV(const PFRnd &FBlobBs, TIntV &BlockLenV)
TBlobPt PutBlob(const PSIn &SIn)
static const TStr MxSegLenVNm
PSIn GetBlob(const TBlobPt &BlobPt)
const TVal & Last() const
Returns a reference to the last element of the vector.
PSIn GetBlob(const TBlobPt &BlobPt)
void SetFPos(const int &FPos)
static PBlobBs New(const TStr &BlobBsFNm, const TFAccess &Access=faRdOnly, const int &MxSegLen=-1)
static void ThrowFull(const TStr &MsgStr, const TStr &LocStr)
static TStr GetNrFPath(const TStr &FPath)
void PutBlobBsStateStr(const PFRnd &FBlobBs, const TBlobBsState &State)
void PutCh(const char &Ch)
static TStr GetMainFNm(const TStr &NrFPath, const TStr &NrFMid)
TStr GetVersionStr() const
void PutStr(const TStr &Str)
bool FNextBlobPt(TBlobPt &TrvBlobPt, TBlobPt &BlobPt, PSIn &BlobSIn)
static const TStr BlockLenVNm
bool GetBit(const int &BitN) const
TBlobPt PutBlob(const PSIn &SIn)
void PutBlockLenV(const PFRnd &FBlobBs, const TIntV &BlockLenV)
PSIn GetSIn(const int &SInLen, TCs &Cs)
static TStr GetNrNumFExt(const int &FExtN)
static const int MnBlobBfL
static bool Exists(const TStr &BlobBsFNm)
void AssertBlobState(const PFRnd &FBlobBs, const TBlobState &State)
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
void PutVarInt(const TStr &VarNm, const int &Int, const bool &NewLn=true, const bool &CheckIdStr=true)
void PutVarStr(const TStr &VarNm, const TStr &Str, const bool &NewLn=true, const bool &CheckIdStr=true)
int GetMxSegLen(const PFRnd &FBlobBs)
static TBlobPt LoadAddr(const PFRnd &FRnd, const uchar &Seg=0)
static const int MxBlobFLen
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
static uint GetP2(const int &P2Exp)
static const TStr FFreeBlobPtVNm
TStr GetBlobBsStateStr(const TBlobBsState &BlobBsState)
TMBlobBs(const TStr &BlobBsFNm, const TFAccess &_Access=faRdOnly, const int &_MxSegLen=-1)