SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <fl.h>
Public Member Functions | |
TFOut (const TStr &_FNm, const bool &Append=false) | |
TFOut (const TStr &_FNm, const bool &Append, bool &OpenedP) | |
~TFOut () | |
int | PutCh (const char &Ch) |
int | PutBf (const void *LBf, const TSize &LBfL) |
void | Flush () |
TFileId | GetFileId () const |
Static Public Member Functions | |
static PSOut | New (const TStr &FNm, const bool &Append=false) |
static PSOut | New (const TStr &FNm, const bool &Append, bool &OpenedP) |
Private Member Functions | |
void | FlushBf () |
TFOut () | |
TFOut (const TFOut &) | |
TFOut & | operator= (const TFOut &) |
Private Attributes | |
TFileId | FileId |
char * | Bf |
TSize | BfL |
Static Private Attributes | |
static const TSize | MxBfL = 16*1024 |
TFOut::TFOut | ( | ) | [private] |
TFOut::TFOut | ( | const TFOut & | ) | [private] |
TFOut::TFOut | ( | const TStr & | _FNm, |
const bool & | Append = false |
||
) |
Definition at line 322 of file fl.cpp.
References Bf, BfL, TStr::CStr(), EAssertR, FileId, TStr::GetUc(), and MxBfL.
: TSBase(FNm.CStr()), TSOut(FNm), FileId(NULL), Bf(NULL), BfL(0){ if (FNm.GetUc()=="CON"){ FileId=stdout; } else { if (Append){FileId=fopen(FNm.CStr(), "a+b");} else {FileId=fopen(FNm.CStr(), "w+b");} EAssertR(FileId!=NULL, "Can not open file '"+FNm+"'."); Bf=new char[MxBfL]; BfL=0; } }
TFOut::TFOut | ( | const TStr & | _FNm, |
const bool & | Append, | ||
bool & | OpenedP | ||
) |
Definition at line 334 of file fl.cpp.
References Bf, BfL, TStr::CStr(), FileId, TStr::GetUc(), and MxBfL.
: TSBase(FNm.CStr()), TSOut(FNm), FileId(NULL), Bf(NULL), BfL(0){ if (FNm.GetUc()=="CON"){ FileId=stdout; } else { if (Append){FileId=fopen(FNm.CStr(), "a+b");} else {FileId=fopen(FNm.CStr(), "w+b");} OpenedP=(FileId!=NULL); if (OpenedP){ Bf=new char[MxBfL]; BfL=0;} } }
TFOut::~TFOut | ( | ) |
void TFOut::Flush | ( | ) | [virtual] |
void TFOut::FlushBf | ( | ) | [private] |
Definition at line 315 of file fl.cpp.
References Bf, BfL, EAssertR, FileId, and TSBase::GetSNm().
Referenced by Flush(), PutCh(), and ~TFOut().
{ EAssertR( fwrite(Bf, 1, BfL, FileId)==BfL, "Error writting to the file '"+GetSNm()+"'."); BfL=0; }
TFileId TFOut::GetFileId | ( | ) | const [inline, virtual] |
PSOut TFOut::New | ( | const TStr & | FNm, |
const bool & | Append = false |
||
) | [static] |
Definition at line 347 of file fl.cpp.
References TFOut().
Referenced by TStrPool::Save(), TUniChDb::SaveBin(), TLAMisc::SaveMatlabTFltV(), TLAMisc::SaveMatlabTFltVV(), TLAMisc::SaveMatlabTFltVVCol(), TLAMisc::SaveMatlabTFltVVMjrSubMtrx(), TLAMisc::SaveMatlabTIntV(), TXmlDoc::SaveTxt(), TStr::SaveTxt(), TUniChDb::Test(), and TPreproc::TPreproc().
PSOut TFOut::New | ( | const TStr & | FNm, |
const bool & | Append, | ||
bool & | OpenedP | ||
) | [static] |
int TFOut::PutBf | ( | const void * | LBf, |
const TSize & | LBfL | ||
) | [virtual] |
Implements TSOut.
Definition at line 368 of file fl.cpp.
References Bf, BfL, MxBfL, and PutCh().
{ int LBfS=0; if (BfL+LBfL>MxBfL){ for (TSize LBfC=0; LBfC<LBfL; LBfC++){ LBfS+=PutCh(((char*)LBf)[LBfC]);} } else { for (TSize LBfC=0; LBfC<LBfL; LBfC++){ LBfS+=(Bf[BfL++]=((char*)LBf)[LBfC]);} } return LBfS; }
int TFOut::PutCh | ( | const char & | Ch | ) | [virtual] |
char* TFOut::Bf [private] |
TSize TFOut::BfL [private] |
TFileId TFOut::FileId [private] |
const TSize TFOut::MxBfL = 16*1024 [static, private] |