SNAP Library, Developer Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
fl.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TCs
class  TSOutMnp
class  TSBase
class  TSIn
class  TSOut
class  TSInOut
class  TStdIn
class  TStdOut
class  TFIn
class  TFOut
class  TFInOut
class  TMIn
class  TMOut
class  TChRet
class  TLnRet
class  TFile

Typedefs

typedef TPt< TSInPSIn
typedef TPt< TSOutPSOut
typedef TPt< TSInOutPSInOut

Enumerations

enum  TFAccess {
  faUndef, faCreate, faUpdate, faAppend,
  faRdOnly, faRestore
}

Functions

template<class T >
TSInoperator>> (TSIn &SIn, T &Val)
template<class T >
TSOutoperator<< (TSOut &SOut, const T &Val)
void RefreshFPos ()
 TFRnd (const TFRnd &)
TFRndoperator= (const TFRnd &)
 TFRnd (const TStr &_FNm, const TFAccess &FAccess, const bool &CreateIfNo=true, const int &_HdLen=-1, const int &_RecLen=-1)
static PFRnd New (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 TStr GetStrFromFAccess (const TFAccess &FAccess)
static TFAccess GetFAccessFromStr (const TStr &Str)

Variables

ClassTP(TFRnd, PFRnd) private TSStr FNm
bool RecAct
int HdLen
int RecLen

Typedef Documentation

typedef TPt<TSIn> PSIn

Definition at line 116 of file fl.h.

typedef TPt<TSInOut> PSInOut

Definition at line 233 of file fl.h.

typedef TPt<TSOut> PSOut

Definition at line 208 of file fl.h.


Enumeration Type Documentation

enum TFAccess
Enumerator:
faUndef 
faCreate 
faUpdate 
faAppend 
faRdOnly 
faRestore 

Definition at line 341 of file fl.h.


Function Documentation

bool Empty ( )

Definition at line 509 of file fl.h.

References GetFLen().

{return GetFLen()==0;}

Here is the call graph for this function:

bool Eof ( )

Definition at line 510 of file fl.h.

References GetFLen(), and GetFPos().

{return GetFPos()==GetFLen();}

Here is the call graph for this function:

void Flush ( )

Referenced by TCache< TKey, TDat, THashFunc >::FlushAndClr().

Here is the caller graph for this function:

void GetBf ( void *  Bf,
const TSize BfL 
)
char GetCh ( )

Definition at line 533 of file fl.h.

References GetBf().

{char Ch; GetBf(&Ch, sizeof(Ch)); return Ch;}

Here is the call graph for this function:

TCs GetCs ( )

Definition at line 530 of file fl.h.

References GetBf().

{TCs Cs; GetBf(&Cs, sizeof(Cs)); return Cs;}

Here is the call graph for this function:

TFAccess TFRnd::GetFAccessFromStr ( const TStr Str) [static]

Definition at line 795 of file fl.cpp.

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

                                                {
  TStr UcStr=Str.GetUc();
  if (UcStr=="CREATE"){return faCreate;}
  if (UcStr=="UPDATE"){return faUpdate;}
  if (UcStr=="APPEND"){return faAppend;}
  if (UcStr=="READONLY"){return faRdOnly;}
  if (UcStr=="RESTORE"){return faRestore;}

  if (UcStr=="NEW"){return faCreate;}
  if (UcStr=="CONT"){return faUpdate;}
  if (UcStr=="CONTINUE"){return faUpdate;}
  if (UcStr=="REST"){return faRestore;}
  if (UcStr=="RESTORE"){return faRestore;}
  return faUndef;
}

Here is the call graph for this function:

int GetFLen ( )

Referenced by Empty(), and Eof().

Here is the caller graph for this function:

TStr GetFNm ( ) const

Definition at line 59 of file xfl.h.

References CurFNm.

{return CurFNm;}
int GetFPos ( )

Referenced by Eof(), GetHd(), and PutHd().

Here is the caller graph for this function:

void GetHd ( void *  Hd)

Definition at line 520 of file fl.h.

References GetBf(), GetFPos(), HdLen, IAssert, RecAct, and SetFPos().

                      {IAssert(RecAct);
    int FPos=GetFPos(); SetFPos(0); GetBf(Hd, HdLen); SetFPos(FPos);}

Here is the call graph for this function:

int GetInt ( )

Definition at line 537 of file fl.h.

References GetBf().

Referenced by GetInt(), TTm::GetTmFromIdStr(), and IsInt().

{int Int; GetBf(&Int, sizeof(Int)); return Int;}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 524 of file fl.h.

References GetBf(), IAssert, RecAct, RecLen, and SetRecN().

                                            {
    IAssert(RecAct); if (RecN!=-1){SetRecN(RecN);} GetBf(Rec, RecLen);}

Here is the call graph for this function:

int GetRecN ( )
int GetRecs ( )

Definition at line 430 of file xmath.h.

References Recs.

{return Recs;}
PSIn GetSIn ( const int &  SInLen,
TCs Cs 
)
TStr GetStr ( const int &  StrLen)
TStr GetStr ( const int &  MxStrLen,
bool &  IsOk 
)
TStr TFRnd::GetStrFromFAccess ( const TFAccess FAccess) [static]

Definition at line 784 of file fl.cpp.

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

                                                    {
  switch (FAccess){
    case faCreate: return "Create";
    case faUpdate: return "Update";
    case faAppend: return "Append";
    case faRdOnly: return "ReadOnly";
    case faRestore: return "Restore";
    default: Fail; return TStr();
  }
}

Definition at line 535 of file fl.h.

References GetBf().

{uchar UCh; GetBf(&UCh, sizeof(UCh)); return UCh;}

Here is the call graph for this function:

Definition at line 539 of file fl.h.

References GetBf().

{uint UInt; GetBf(&UInt, sizeof(UInt)); return UInt;}

Here is the call graph for this function:

void TFRnd::MoveFPos ( const int &  DFPos)

Definition at line 676 of file fl.cpp.

References EAssertR, FNm, and SEEK_CUR.

                                    {
  EAssertR(
   fseek(FileId, DFPos, SEEK_CUR)==0,
   "Error seeking into file '"+TStr(FNm)+"'.");
}
static PFRnd New ( const TStr FNm,
const TFAccess FAccess,
const bool &  CreateIfNo = true,
const int &  HdLen = -1,
const int &  RecLen = -1 
) [static]

Definition at line 495 of file fl.h.

References TFRnd().

                                             {
    return new TFRnd(FNm, FAccess, CreateIfNo, HdLen, RecLen);}

Here is the call graph for this function:

template<class T >
TSOut& operator<< ( TSOut SOut,
const T &  Val 
)

Definition at line 211 of file fl.h.

References TSOut::Save().

                                            {
  Val.Save(SOut); return SOut;
}

Here is the call graph for this function:

TFRnd& operator= ( const TFRnd ) [private]
template<class T >
TSIn& operator>> ( TSIn SIn,
T &  Val 
)

Definition at line 119 of file fl.h.

References TSIn::Load().

                                    {
  Val.Load(SIn); return SIn;
}

Here is the call graph for this function:

void PutBf ( const void *  Bf,
const TSize BfL 
)

Referenced by PutCh(), PutCs(), PutHd(), PutInt(), PutRec(), PutSIn(), PutUCh(), and PutUInt().

Here is the caller graph for this function:

void PutCh ( const char &  Ch)

Definition at line 531 of file fl.h.

References PutBf().

{PutBf(&Ch, sizeof(Ch));}

Here is the call graph for this function:

void PutCh ( const char &  Ch,
const int &  Chs 
)
void PutCs ( const TCs Cs)

Definition at line 529 of file fl.h.

References PutBf().

{PutBf(&Cs, sizeof(Cs));}

Here is the call graph for this function:

void PutHd ( const void *  Hd)

Definition at line 522 of file fl.h.

References GetFPos(), HdLen, IAssert, PutBf(), RecAct, and SetFPos().

                            {IAssert(RecAct);
    int FPos=GetFPos(); SetFPos(0); PutBf(Hd, HdLen); SetFPos(FPos);}

Here is the call graph for this function:

void PutInt ( const int &  Int)

Definition at line 536 of file fl.h.

References PutBf().

{PutBf(&Int, sizeof(Int));}

Here is the call graph for this function:

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

Definition at line 526 of file fl.h.

References IAssert, PutBf(), RecAct, RecLen, and SetRecN().

                                                  {
    IAssert(RecAct); if (RecN!=-1){SetRecN(RecN);} PutBf(Rec, RecLen);}

Here is the call graph for this function:

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

Definition at line 767 of file fl.cpp.

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

                                          {
  int BfL=SIn->Len();
  char* Bf=new char[BfL];
  SIn->GetBf(Bf, BfL);
  Cs=TCs::GetCsFromBf(Bf, BfL);
  PutBf(Bf, BfL);
  delete[] Bf;
}

Here is the call graph for this function:

void PutStr ( const TStr Str)

Definition at line 28 of file json.h.

References jvtStr, and Str.

{JsonValType=jvtStr; Str=_Str;}
void PutUCh ( const uchar UCh)

Definition at line 534 of file fl.h.

References PutBf().

{PutBf(&UCh, sizeof(UCh));}

Here is the call graph for this function:

void PutUInt ( const uint UInt)

Definition at line 538 of file fl.h.

References PutBf().

{PutBf(&UInt, sizeof(UInt));}

Here is the call graph for this function:

void TFRnd::RefreshFPos ( ) [private]

Definition at line 638 of file fl.cpp.

References EAssertR, FNm, and SEEK_CUR.

                       {
  EAssertR(
   fseek(FileId, 0, SEEK_CUR)==0,
   "Error seeking into file '"+TStr(FNm)+"'.");
}
void SetFPos ( const int &  FPos)

Referenced by GetHd(), and PutHd().

Here is the caller graph for this function:

void SetHdRecLen ( const int &  _HdLen,
const int &  _RecLen 
)

Definition at line 502 of file fl.h.

References HdLen, RecAct, and RecLen.

                                                         {
    HdLen=_HdLen; RecLen=_RecLen; RecAct=(HdLen>=0)&&(RecLen>0);}
void SetRecN ( const int &  RecN)

Referenced by GetRec(), and PutRec().

Here is the caller graph for this function:

TFRnd ( const TFRnd ) [private]

Referenced by New().

Here is the caller graph for this function:

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

Definition at line 644 of file fl.cpp.

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

                                                               :
  FileId(NULL), FNm(_FNm.CStr()),
  RecAct(false), HdLen(_HdLen), RecLen(_RecLen){
  RecAct=(HdLen>=0)&&(RecLen>0);
  switch (FAccess){
    case faCreate: FileId=fopen(FNm.CStr(), "w+b"); break;
    case faUpdate: FileId=fopen(FNm.CStr(), "r+b"); break;
    case faAppend: FileId=fopen(FNm.CStr(), "r+b");
      if (FileId!=NULL){fseek(FileId, SEEK_END, 0);} break;
    case faRdOnly: FileId=fopen(FNm.CStr(), "rb"); break;
    default: Fail;
  }
  if ((FileId==NULL)&&(CreateIfNo)){
    FileId=fopen(FNm.CStr(), "w+b");}
  EAssertR(FileId!=NULL, "Can not open file '"+_FNm+"'.");
}

Here is the call graph for this function:

Definition at line 662 of file fl.cpp.

References EAssertR, and FNm.

             {
  EAssertR(fclose(FileId)==0, "Can not close file '"+TStr(FNm)+"'.");
}

Variable Documentation

int HdLen

Definition at line 486 of file fl.h.

Referenced by GetHd(), PutHd(), SetHdRecLen(), and TFRnd().

bool RecAct

Definition at line 485 of file fl.h.

Referenced by GetHd(), GetRec(), PutHd(), PutRec(), SetHdRecLen(), and TFRnd().

int RecLen

Definition at line 486 of file fl.h.

Referenced by GetRec(), PutRec(), SetHdRecLen(), and TFRnd().