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
TFRnd Class Reference

#include <fl.h>

Collaboration diagram for TFRnd:

Public Member Functions

 TFRnd (const TStr &_FNm, const TFAccess &FAccess, const bool &CreateIfNo=true, const int &_HdLen=-1, const int &_RecLen=-1)
 
 ~TFRnd ()
 
TStr GetFNm () const
 
void SetHdRecLen (const int &_HdLen, const int &_RecLen)
 
void SetFPos (const int &FPos)
 
void MoveFPos (const int &DFPos)
 
int GetFPos ()
 
int GetFLen ()
 
bool Empty ()
 
bool Eof ()
 
void SetRecN (const int &RecN)
 
int GetRecN ()
 
int GetRecs ()
 
void GetBf (void *Bf, const TSize &BfL)
 
void PutBf (const void *Bf, const TSize &BfL)
 
void Flush ()
 
void GetHd (void *Hd)
 
void PutHd (const void *Hd)
 
void GetRec (void *Rec, const int &RecN=-1)
 
void PutRec (const void *Rec, const int &RecN=-1)
 
void PutCs (const TCs &Cs)
 
TCs GetCs ()
 
void PutCh (const char &Ch)
 
void PutCh (const char &Ch, const int &Chs)
 
char GetCh ()
 
void PutUCh (const uchar &UCh)
 
uchar GetUCh ()
 
void PutInt (const int &Int)
 
int GetInt ()
 
void PutUInt (const uint &UInt)
 
uint GetUInt ()
 
void PutStr (const TStr &Str)
 
TStr GetStr (const int &StrLen)
 
TStr GetStr (const int &MxStrLen, bool &IsOk)
 
void PutSIn (const PSIn &SIn, TCs &Cs)
 
PSIn GetSIn (const int &SInLen, TCs &Cs)
 

Static Public Member Functions

static PFRnd New (const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo=true, const int &HdLen=-1, const int &RecLen=-1)
 
static TStr GetStrFromFAccess (const TFAccess &FAccess)
 
static TFAccess GetFAccessFromStr (const TStr &Str)
 

Private Member Functions

void RefreshFPos ()
 
 TFRnd (const TFRnd &)
 
TFRndoperator= (const TFRnd &)
 

Private Attributes

TCRef CRef
 
TFileId FileId
 
TSStr FNm
 
bool RecAct
 
int HdLen
 
int RecLen
 

Friends

class TPt< TFRnd >
 

Detailed Description

Definition at line 569 of file fl.h.

Constructor & Destructor Documentation

TFRnd::TFRnd ( const TFRnd )
private
TFRnd::TFRnd ( const TStr _FNm,
const TFAccess FAccess,
const bool &  CreateIfNo = true,
const int &  _HdLen = -1,
const int &  _RecLen = -1 
)

Definition at line 981 of file fl.cpp.

References TSStr::CStr(), EAssertR, faAppend, faCreate, Fail, faRdOnly, faUpdate, FileId, FNm, HdLen, RecAct, RecLen, and SEEK_END.

982  :
983  FileId(NULL), FNm(_FNm.CStr()),
984  RecAct(false), HdLen(_HdLen), RecLen(_RecLen){
985  RecAct=(HdLen>=0)&&(RecLen>0);
986  switch (FAccess){
987  case faCreate: FileId=fopen(FNm.CStr(), "w+b"); break;
988  case faUpdate: FileId=fopen(FNm.CStr(), "r+b"); break;
989  case faAppend: FileId=fopen(FNm.CStr(), "r+b");
990  if (FileId!=NULL){fseek(FileId, SEEK_END, 0);} break;
991  case faRdOnly: FileId=fopen(FNm.CStr(), "rb"); break;
992  default: Fail;
993  }
994  if ((FileId==NULL)&&(CreateIfNo)){
995  FileId=fopen(FNm.CStr(), "w+b");}
996  EAssertR(FileId!=NULL, "Can not open file '"+_FNm+"'.");
997 }
char * CStr()
Definition: bd.h:531
Definition: fl.h:347
#define SEEK_END
Definition: fl.cpp:969
bool RecAct
Definition: fl.h:573
#define Fail
Definition: bd.h:238
TFileId FileId
Definition: fl.h:571
Definition: fl.h:347
Definition: fl.h:347
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
int HdLen
Definition: fl.h:574
char * CStr()
Definition: dt.h:476
int RecLen
Definition: fl.h:574
Definition: fl.h:347

Here is the call graph for this function:

TFRnd::~TFRnd ( )

Definition at line 999 of file fl.cpp.

References EAssertR, FileId, and FNm.

999  {
1000  EAssertR(fclose(FileId)==0, "Can not close file '"+TStr(FNm)+"'.");
1001 }
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Member Function Documentation

bool TFRnd::Empty ( )
inline

Definition at line 597 of file fl.h.

Referenced by TGBlobBs::TGBlobBs().

597 {return GetFLen()==0;}
int GetFLen()
Definition: fl.cpp:1025

Here is the caller graph for this function:

bool TFRnd::Eof ( )
inline

Definition at line 598 of file fl.h.

598 {return GetFPos()==GetFLen();}
int GetFLen()
Definition: fl.cpp:1025
int GetFPos()
Definition: fl.cpp:1019
void TFRnd::Flush ( )

Definition at line 1066 of file fl.cpp.

References EAssertR, FileId, and FNm.

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

1066  {
1067  EAssertR(fflush(FileId)==0, "Can not flush file '"+TStr(FNm)+"'.");
1068 }
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Here is the caller graph for this function:

void TFRnd::GetBf ( void *  Bf,
const TSize BfL 
)

Definition at line 1052 of file fl.cpp.

References EAssertR, FileId, FNm, and RefreshFPos().

Referenced by GetSIn(), and GetStr().

1052  {
1053  RefreshFPos();
1054  EAssertR(
1055  fread(Bf, 1, BfL, FileId)==BfL,
1056  "Error reading file '"+TStr(FNm)+"'.");
1057 }
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
void RefreshFPos()
Definition: fl.cpp:975

Here is the call graph for this function:

Here is the caller graph for this function:

char TFRnd::GetCh ( )
inline

Definition at line 621 of file fl.h.

Referenced by TBlobBs::AssertBlobState(), and TBlobBs::GetBlobState().

621 {char Ch; GetBf(&Ch, sizeof(Ch)); return Ch;}
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

TCs TFRnd::GetCs ( )
inline

Definition at line 618 of file fl.h.

Referenced by TGBlobBs::FNextBlobPt(), and TGBlobBs::GetBlob().

618 {TCs Cs; GetBf(&Cs, sizeof(Cs)); return Cs;}
Definition: fl.h:11
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

TFAccess TFRnd::GetFAccessFromStr ( const TStr Str)
static

Definition at line 1132 of file fl.cpp.

References faAppend, faCreate, faRdOnly, faRestore, faUndef, faUpdate, and TStr::GetUc().

1132  {
1133  TStr UcStr=Str.GetUc();
1134  if (UcStr=="CREATE"){return faCreate;}
1135  if (UcStr=="UPDATE"){return faUpdate;}
1136  if (UcStr=="APPEND"){return faAppend;}
1137  if (UcStr=="READONLY"){return faRdOnly;}
1138  if (UcStr=="RESTORE"){return faRestore;}
1139 
1140  if (UcStr=="NEW"){return faCreate;}
1141  if (UcStr=="CONT"){return faUpdate;}
1142  if (UcStr=="CONTINUE"){return faUpdate;}
1143  if (UcStr=="REST"){return faRestore;}
1144  if (UcStr=="RESTORE"){return faRestore;}
1145  return faUndef;
1146 }
Definition: fl.h:347
TStr GetUc() const
Definition: dt.h:493
Definition: fl.h:347
Definition: fl.h:347
Definition: fl.h:347
Definition: fl.h:347
Definition: dt.h:412
Definition: fl.h:347

Here is the call graph for this function:

int TFRnd::GetFLen ( )

Definition at line 1025 of file fl.cpp.

References EAssertR, FileId, FNm, GetFPos(), SEEK_END, and SetFPos().

Referenced by TGBlobBs::FNextBlobPt(), GetRecs(), GetStr(), and TGBlobBs::PutBlob().

1025  {
1026  int FPos=GetFPos();
1027  EAssertR(
1028  fseek(FileId, 0, SEEK_END)==0,
1029  "Error seeking into file '"+TStr(FNm)+"'.");
1030  int FLen=GetFPos(); SetFPos(FPos); return FLen;
1031 }
#define SEEK_END
Definition: fl.cpp:969
TFileId FileId
Definition: fl.h:571
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
int GetFPos()
Definition: fl.cpp:1019

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TFRnd::GetFNm ( ) const

Definition at line 1003 of file fl.cpp.

References TSStr::CStr(), and FNm.

1003  {
1004  return FNm.CStr();
1005 }
char * CStr()
Definition: bd.h:531
TSStr FNm
Definition: fl.h:572

Here is the call graph for this function:

int TFRnd::GetFPos ( )

Definition at line 1019 of file fl.cpp.

References EAssertR, FileId, and FNm.

Referenced by TGBlobBs::DelBlob(), TGBlobBs::FNextBlobPt(), GetFLen(), GetRecN(), GetStr(), TGBlobBs::PutBlob(), and TGBlobBs::TGBlobBs().

1019  {
1020  int FPos= (int) ftell(FileId);
1021  EAssertR(FPos!=-1, "Error seeking into file '"+TStr(FNm)+"'.");
1022  return FPos;
1023 }
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Here is the caller graph for this function:

void TFRnd::GetHd ( void *  Hd)
inline

Definition at line 608 of file fl.h.

References IAssert.

Referenced by TFRec< THd, TRec >::GetHd().

608  {IAssert(RecAct);
609  int FPos=GetFPos(); SetFPos(0); GetBf(Hd, HdLen); SetFPos(FPos);}
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int HdLen
Definition: fl.h:574
int GetFPos()
Definition: fl.cpp:1019
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

int TFRnd::GetInt ( )
inline

Definition at line 625 of file fl.h.

Referenced by TGBlobBs::DelBlob(), TGBlobBs::FNextBlobPt(), TGBlobBs::GetBlob(), TBlobBs::GetBlockLenV(), TBlobBs::GetFFreeBlobPtV(), TBlobBs::GetMxSegLen(), and TGBlobBs::PutBlob().

625 {int Int; GetBf(&Int, sizeof(Int)); return Int;}
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

void TFRnd::GetRec ( void *  Rec,
const int &  RecN = -1 
)
inline

Definition at line 612 of file fl.h.

References IAssert.

Referenced by TFRec< THd, TRec >::GetRec().

612  {
613  IAssert(RecAct); if (RecN!=-1){SetRecN(RecN);} GetBf(Rec, RecLen);}
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
void SetRecN(const int &RecN)
Definition: fl.cpp:1033
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052
int RecLen
Definition: fl.h:574

Here is the caller graph for this function:

int TFRnd::GetRecN ( )

Definition at line 1038 of file fl.cpp.

References EAssertR, FNm, GetFPos(), HdLen, IAssert, RecAct, and RecLen.

Referenced by TFRec< THd, TRec >::GetRecN().

1038  {
1039  IAssert(RecAct);
1040  int FPos=GetFPos()-HdLen;
1041  EAssertR(FPos%RecLen==0, "Invalid position in file'"+TStr(FNm)+"'.");
1042  return FPos/RecLen;
1043 }
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
int HdLen
Definition: fl.h:574
int GetFPos()
Definition: fl.cpp:1019
int RecLen
Definition: fl.h:574

Here is the call graph for this function:

Here is the caller graph for this function:

int TFRnd::GetRecs ( )

Definition at line 1045 of file fl.cpp.

References EAssertR, FNm, GetFLen(), HdLen, IAssert, RecAct, and RecLen.

Referenced by TFRec< THd, TRec >::GetRecs().

1045  {
1046  IAssert(RecAct);
1047  int FLen=GetFLen()-HdLen;
1048  EAssertR(FLen%RecLen==0, "Invalid length of file'"+TStr(FNm)+"'.");
1049  return FLen/RecLen;
1050 }
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
int GetFLen()
Definition: fl.cpp:1025
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
int HdLen
Definition: fl.h:574
int RecLen
Definition: fl.h:574

Here is the call graph for this function:

Here is the caller graph for this function:

PSIn TFRnd::GetSIn ( const int &  SInLen,
TCs Cs 
)

Definition at line 1113 of file fl.cpp.

References GetBf(), and TCs::GetCsFromBf().

Referenced by TGBlobBs::FNextBlobPt(), and TGBlobBs::GetBlob().

1113  {
1114  char* Bf=new char[BfL];
1115  GetBf(Bf, BfL);
1116  Cs=TCs::GetCsFromBf(Bf, BfL);
1117  PSIn SIn=PSIn(new TMIn(Bf, BfL, true));
1118  return SIn;
1119 }
Definition: fl.h:437
static TCs GetCsFromBf(char *Bf, const int &BfL)
Definition: fl.cpp:12
TPt< TSIn > PSIn
Definition: fl.h:119
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TFRnd::GetStr ( const int &  StrLen)

Definition at line 1094 of file fl.cpp.

References EAssertR, FNm, GetBf(), and TCh::NullCh.

Referenced by TBlobBs::AssertBlobBsStateStr(), TBlobBs::AssertVersionStr(), TBlobBs::GetBlockLenV(), TBlobBs::GetFFreeBlobPtV(), and TBlobBs::GetMxSegLen().

1094  {
1095  TStr Str;
1096  char* CStr=new char[StrLen+1];
1097  GetBf(CStr, StrLen+1);
1098  EAssertR(CStr[StrLen+1-1]==TCh::NullCh, "Error reading file '"+TStr(FNm)+"'.");
1099  Str=CStr;
1100  delete[] CStr;
1101  return Str;
1102 }
static const char NullCh
Definition: dt.h:1033
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TFRnd::GetStr ( const int &  MxStrLen,
bool &  IsOk 
)

Definition at line 1083 of file fl.cpp.

References GetBf(), GetFLen(), GetFPos(), and TCh::NullCh.

1083  {
1084  IsOk=false; TStr Str;
1085  if (GetFPos()+StrLen+1<=GetFLen()){
1086  char* CStr=new char[StrLen+1];
1087  GetBf(CStr, StrLen+1);
1088  if (CStr[StrLen+1-1]==TCh::NullCh){IsOk=true; Str=CStr;}
1089  delete[] CStr;
1090  }
1091  return Str;
1092 }
int GetFLen()
Definition: fl.cpp:1025
static const char NullCh
Definition: dt.h:1033
Definition: dt.h:412
int GetFPos()
Definition: fl.cpp:1019
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the call graph for this function:

TStr TFRnd::GetStrFromFAccess ( const TFAccess FAccess)
static

Definition at line 1121 of file fl.cpp.

References faAppend, faCreate, Fail, faRdOnly, faRestore, and faUpdate.

1121  {
1122  switch (FAccess){
1123  case faCreate: return "Create";
1124  case faUpdate: return "Update";
1125  case faAppend: return "Append";
1126  case faRdOnly: return "ReadOnly";
1127  case faRestore: return "Restore";
1128  default: Fail; return TStr();
1129  }
1130 }
Definition: fl.h:347
#define Fail
Definition: bd.h:238
Definition: fl.h:347
Definition: fl.h:347
Definition: fl.h:347
Definition: dt.h:412
Definition: fl.h:347
uchar TFRnd::GetUCh ( )
inline

Definition at line 623 of file fl.h.

Referenced by TBlobPt::Load().

623 {uchar UCh; GetBf(&UCh, sizeof(UCh)); return UCh;}
unsigned char uchar
Definition: bd.h:10
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

uint TFRnd::GetUInt ( )
inline

Definition at line 627 of file fl.h.

Referenced by TBlobBs::AssertBlobTag(), TBlobPt::Load(), and TBlobPt::LoadAddr().

627 {uint UInt; GetBf(&UInt, sizeof(UInt)); return UInt;}
unsigned int uint
Definition: bd.h:11
void GetBf(void *Bf, const TSize &BfL)
Definition: fl.cpp:1052

Here is the caller graph for this function:

void TFRnd::MoveFPos ( const int &  DFPos)

Definition at line 1013 of file fl.cpp.

References EAssertR, FileId, FNm, and SEEK_CUR.

Referenced by TGBlobBs::FNextBlobPt(), and TGBlobBs::GetBlob().

1013  {
1014  EAssertR(
1015  fseek(FileId, DFPos, SEEK_CUR)==0,
1016  "Error seeking into file '"+TStr(FNm)+"'.");
1017 }
#define SEEK_CUR
Definition: fl.cpp:968
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Here is the caller graph for this function:

static PFRnd TFRnd::New ( const TStr FNm,
const TFAccess FAccess,
const bool &  CreateIfNo = true,
const int &  HdLen = -1,
const int &  RecLen = -1 
)
inlinestatic

Definition at line 583 of file fl.h.

Referenced by TGBlobBs::TGBlobBs().

585  {
586  return new TFRnd(FNm, FAccess, CreateIfNo, HdLen, RecLen);}
TFRnd(const TFRnd &)
int HdLen
Definition: fl.h:574
int RecLen
Definition: fl.h:574

Here is the caller graph for this function:

TFRnd& TFRnd::operator= ( const TFRnd )
private
void TFRnd::PutBf ( const void *  Bf,
const TSize BfL 
)

Definition at line 1059 of file fl.cpp.

References EAssertR, FileId, FNm, and RefreshFPos().

Referenced by PutCh(), PutSIn(), and PutStr().

1059  {
1060  RefreshFPos();
1061  EAssertR(
1062  fwrite(Bf, 1, BfL, FileId)==BfL,
1063  "Error writting to the file '"+TStr(FNm)+"'.");
1064 }
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572
void RefreshFPos()
Definition: fl.cpp:975

Here is the call graph for this function:

Here is the caller graph for this function:

void TFRnd::PutCh ( const char &  Ch)
inline

Definition at line 619 of file fl.h.

Referenced by TGBlobBs::DelBlob(), TGBlobBs::PutBlob(), and TBlobBs::PutBlobState().

619 {PutBf(&Ch, sizeof(Ch));}
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the caller graph for this function:

void TFRnd::PutCh ( const char &  Ch,
const int &  Chs 
)

Definition at line 1070 of file fl.cpp.

References PutBf().

1070  {
1071  if (Chs>0){
1072  char* CStr=new char[Chs];
1073  for (int ChN=0; ChN<Chs; ChN++){CStr[ChN]=Ch;}
1074  PutBf(CStr, Chs);
1075  delete[] CStr;
1076  }
1077 }
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the call graph for this function:

void TFRnd::PutCs ( const TCs Cs)
inline

Definition at line 617 of file fl.h.

Referenced by TGBlobBs::PutBlob().

617 {PutBf(&Cs, sizeof(Cs));}
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the caller graph for this function:

void TFRnd::PutHd ( const void *  Hd)
inline

Definition at line 610 of file fl.h.

References IAssert.

Referenced by TFRec< THd, TRec >::PutHd().

610  {IAssert(RecAct);
611  int FPos=GetFPos(); SetFPos(0); PutBf(Hd, HdLen); SetFPos(FPos);}
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int HdLen
Definition: fl.h:574
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059
int GetFPos()
Definition: fl.cpp:1019

Here is the caller graph for this function:

void TFRnd::PutInt ( const int &  Int)
inline

Definition at line 624 of file fl.h.

Referenced by TGBlobBs::PutBlob(), TBlobBs::PutBlockLenV(), TBlobBs::PutFFreeBlobPtV(), and TBlobBs::PutMxSegLen().

624 {PutBf(&Int, sizeof(Int));}
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the caller graph for this function:

void TFRnd::PutRec ( const void *  Rec,
const int &  RecN = -1 
)
inline

Definition at line 614 of file fl.h.

References IAssert.

Referenced by TFRec< THd, TRec >::PutRec().

614  {
615  IAssert(RecAct); if (RecN!=-1){SetRecN(RecN);} PutBf(Rec, RecLen);}
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
void SetRecN(const int &RecN)
Definition: fl.cpp:1033
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059
int RecLen
Definition: fl.h:574

Here is the caller graph for this function:

void TFRnd::PutSIn ( const PSIn SIn,
TCs Cs 
)

Definition at line 1104 of file fl.cpp.

References TSIn::GetBf(), TCs::GetCsFromBf(), TSIn::Len(), and PutBf().

Referenced by TGBlobBs::PutBlob().

1104  {
1105  int BfL=SIn->Len();
1106  char* Bf=new char[BfL];
1107  SIn->GetBf(Bf, BfL);
1108  Cs=TCs::GetCsFromBf(Bf, BfL);
1109  PutBf(Bf, BfL);
1110  delete[] Bf;
1111 }
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static TCs GetCsFromBf(char *Bf, const int &BfL)
Definition: fl.cpp:12
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059
virtual int Len() const =0

Here is the call graph for this function:

Here is the caller graph for this function:

void TFRnd::PutStr ( const TStr Str)

Definition at line 1079 of file fl.cpp.

References TStr::CStr(), TStr::Len(), and PutBf().

Referenced by TBlobBs::PutBlobBsStateStr(), TBlobBs::PutBlockLenV(), TBlobBs::PutFFreeBlobPtV(), TBlobBs::PutMxSegLen(), and TBlobBs::PutVersionStr().

1079  {
1080  PutBf(Str.CStr(), Str.Len()+1);
1081 }
int Len() const
Definition: dt.h:487
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059
char * CStr()
Definition: dt.h:476

Here is the call graph for this function:

Here is the caller graph for this function:

void TFRnd::PutUCh ( const uchar UCh)
inline

Definition at line 622 of file fl.h.

Referenced by TBlobPt::Save().

622 {PutBf(&UCh, sizeof(UCh));}
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the caller graph for this function:

void TFRnd::PutUInt ( const uint UInt)
inline

Definition at line 626 of file fl.h.

Referenced by TBlobBs::PutBlobTag(), TBlobPt::Save(), and TBlobPt::SaveAddr().

626 {PutBf(&UInt, sizeof(UInt));}
void PutBf(const void *Bf, const TSize &BfL)
Definition: fl.cpp:1059

Here is the caller graph for this function:

void TFRnd::RefreshFPos ( )
private

Definition at line 975 of file fl.cpp.

References EAssertR, FileId, FNm, and SEEK_CUR.

Referenced by GetBf(), and PutBf().

975  {
976  EAssertR(
977  fseek(FileId, 0, SEEK_CUR)==0,
978  "Error seeking into file '"+TStr(FNm)+"'.");
979 }
#define SEEK_CUR
Definition: fl.cpp:968
TFileId FileId
Definition: fl.h:571
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Here is the caller graph for this function:

void TFRnd::SetFPos ( const int &  FPos)

Definition at line 1007 of file fl.cpp.

References EAssertR, FileId, FNm, and SEEK_SET.

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

1007  {
1008  EAssertR(
1009  fseek(FileId, FPos, SEEK_SET)==0,
1010  "Error seeking into file '"+TStr(FNm)+"'.");
1011 }
TFileId FileId
Definition: fl.h:571
#define SEEK_SET
Definition: fl.cpp:970
Definition: dt.h:412
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TSStr FNm
Definition: fl.h:572

Here is the caller graph for this function:

void TFRnd::SetHdRecLen ( const int &  _HdLen,
const int &  _RecLen 
)
inline

Definition at line 590 of file fl.h.

590  {
591  HdLen=_HdLen; RecLen=_RecLen; RecAct=(HdLen>=0)&&(RecLen>0);}
bool RecAct
Definition: fl.h:573
int HdLen
Definition: fl.h:574
int RecLen
Definition: fl.h:574
void TFRnd::SetRecN ( const int &  RecN)

Definition at line 1033 of file fl.cpp.

References HdLen, IAssert, RecAct, RecLen, and SetFPos().

Referenced by TFRec< THd, TRec >::SetRecN().

1033  {
1034  IAssert(RecAct);
1035  SetFPos(HdLen+RecN*RecLen);
1036 }
#define IAssert(Cond)
Definition: bd.h:262
bool RecAct
Definition: fl.h:573
void SetFPos(const int &FPos)
Definition: fl.cpp:1007
int HdLen
Definition: fl.h:574
int RecLen
Definition: fl.h:574

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TPt< TFRnd >
friend

Definition at line 569 of file fl.h.

Member Data Documentation

TCRef TFRnd::CRef
private

Definition at line 569 of file fl.h.

TFileId TFRnd::FileId
private

Definition at line 571 of file fl.h.

Referenced by Flush(), GetBf(), GetFLen(), GetFPos(), MoveFPos(), PutBf(), RefreshFPos(), SetFPos(), TFRnd(), and ~TFRnd().

TSStr TFRnd::FNm
private
int TFRnd::HdLen
private

Definition at line 574 of file fl.h.

Referenced by GetRecN(), GetRecs(), SetRecN(), and TFRnd().

bool TFRnd::RecAct
private

Definition at line 573 of file fl.h.

Referenced by GetRecN(), GetRecs(), SetRecN(), and TFRnd().

int TFRnd::RecLen
private

Definition at line 574 of file fl.h.

Referenced by GetRecN(), GetRecs(), SetRecN(), and TFRnd().


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