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
TSIn Class Referenceabstract

#include <fl.h>

Inheritance diagram for TSIn:
Collaboration diagram for TSIn:

Public Member Functions

 TSIn ()
 
 TSIn (const TStr &Str)
 
virtual ~TSIn ()
 
virtual bool Eof ()=0
 
virtual int Len () const =0
 
virtual char GetCh ()=0
 
virtual char PeekCh ()=0
 
virtual int GetBf (const void *Bf, const TSize &BfL)=0
 
virtual bool GetNextLnBf (TChA &LnChA)=0
 
virtual void Reset ()
 
bool IsFastMode () const
 
void SetFastMode (const bool &_FastMode)
 
virtual void LoadCs ()
 
void LoadBf (const void *Bf, const TSize &BfL)
 
void * LoadNewBf (const int &BfL)
 
void Load (bool &Bool)
 
void Load (uchar &UCh)
 
void Load (char &Ch)
 
void Load (short &Short)
 
void Load (ushort &UShort)
 
void Load (int &Int)
 
void Load (uint &UInt)
 
void Load (int64 &Int)
 
void Load (uint64 &UInt)
 
void Load (double &Flt)
 
void Load (sdouble &SFlt)
 
void Load (ldouble &LFlt)
 
void Load (char *&CStr, const int &MxCStrLen, const int &CStrLen)
 
void Load (char *&CStr)
 
TSInoperator>> (bool &Bool)
 
TSInoperator>> (uchar &UCh)
 
TSInoperator>> (char &Ch)
 
TSInoperator>> (short &Sh)
 
TSInoperator>> (ushort &USh)
 
TSInoperator>> (int &Int)
 
TSInoperator>> (uint &UInt)
 
TSInoperator>> (int64 &Int)
 
TSInoperator>> (uint64 &UInt)
 
TSInoperator>> (float &Flt)
 
TSInoperator>> (double &Double)
 
TSInoperator>> (long double &LDouble)
 
bool GetNextLn (TStr &LnStr)
 
bool GetNextLn (TChA &LnChA)
 
- Public Member Functions inherited from TSBase
 TSBase (const TSStr &Nm)
 
virtual ~TSBase ()
 
virtual TStr GetSNm () const
 

Static Public Attributes

static const TPt< TSInStdIn =PSIn(new TStdIn())
 

Private Member Functions

 TSIn (const TSIn &)
 
TSInoperator= (const TSIn &)
 

Private Attributes

bool FastMode
 

Friends

class TPt< TSIn >
 

Additional Inherited Members

- Protected Attributes inherited from TSBase
TCRef CRef
 
TSStr SNm
 
TCs Cs
 

Detailed Description

Definition at line 58 of file fl.h.

Constructor & Destructor Documentation

TSIn::TSIn ( const TSIn )
private
TSIn::TSIn ( )
inline

Definition at line 65 of file fl.h.

65 : TSBase("Input-Stream"), FastMode(false){}
TSBase(const TSStr &Nm)
Definition: fl.h:50
bool FastMode
Definition: fl.h:60
TSIn::TSIn ( const TStr Str)

Definition at line 26 of file fl.cpp.

26 : TSBase(Str.CStr()), FastMode(false){}
TSBase(const TSStr &Nm)
Definition: fl.h:50
bool FastMode
Definition: fl.h:60
char * CStr()
Definition: dt.h:476
virtual TSIn::~TSIn ( )
inlinevirtual

Definition at line 67 of file fl.h.

67 {}

Member Function Documentation

virtual int TSIn::GetBf ( const void *  Bf,
const TSize BfL 
)
pure virtual
bool TSIn::GetNextLn ( TStr LnStr)

Definition at line 43 of file fl.cpp.

Referenced by TNetInfBs::LoadCascadesTxt(), TNIBs::LoadCascadesTxt(), TNIBs::LoadGroundTruthNodesTxt(), TNetInfBs::LoadGroundTruthTxt(), TNIBs::LoadGroundTruthTxt(), TNIBs::LoadInferredNodesTxt(), TNIBs::LoadInferredTxt(), and TSsParser::NextSlow().

43  {
44  TChA LnChA;
45  const bool IsNext=GetNextLn(LnChA);
46  LnStr=LnChA;
47  return IsNext;
48 }
Definition: dt.h:201
bool GetNextLn(TStr &LnStr)
Definition: fl.cpp:43

Here is the caller graph for this function:

bool TSIn::GetNextLn ( TChA LnChA)

Definition at line 50 of file fl.cpp.

References TChA::AddCh(), TChA::Clr(), TChA::Empty(), Eof(), GetCh(), and PeekCh().

50  {
51  LnChA.Clr();
52  while (!Eof()){
53  const char Ch=GetCh();
54  if (Ch=='\n'){return true;}
55  if (Ch=='\r' && PeekCh()=='\n'){GetCh(); return true;}
56  LnChA.AddCh(Ch);
57  }
58  return !LnChA.Empty();
59 }
bool Empty() const
Definition: dt.h:260
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
virtual bool Eof()=0
virtual char GetCh()=0
virtual char PeekCh()=0

Here is the call graph for this function:

virtual bool TSIn::GetNextLnBf ( TChA LnChA)
pure virtual

Implemented in TStrIn, TMIn, TShMIn, TFInOut, TChAIn, TFIn, TStdIn, TMemIn, and TZipIn.

Referenced by TSsParser::Next().

Here is the caller graph for this function:

bool TSIn::IsFastMode ( ) const
inline

Definition at line 77 of file fl.h.

References FastMode.

77 {return FastMode;}
bool FastMode
Definition: fl.h:60
virtual int TSIn::Len ( ) const
pure virtual
void TSIn::Load ( uchar UCh)
inline

Definition at line 85 of file fl.h.

References TSBase::Cs, and GetBf().

85 {Cs+=GetBf(&UCh, sizeof(UCh));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( char &  Ch)
inline

Definition at line 86 of file fl.h.

References TSBase::Cs, and GetBf().

86 {Cs+=GetBf(&Ch, sizeof(Ch));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( short &  Short)
inline

Definition at line 87 of file fl.h.

References TSBase::Cs, and GetBf().

87 {Cs+=GetBf(&Short, sizeof(Short));} //J:
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( ushort UShort)
inline

Definition at line 88 of file fl.h.

References TSBase::Cs, and GetBf().

88 {Cs+=GetBf(&UShort, sizeof(UShort));} //J:
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( int &  Int)
inline

Definition at line 89 of file fl.h.

References TSBase::Cs, and GetBf().

89 {Cs+=GetBf(&Int, sizeof(Int));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( uint UInt)
inline

Definition at line 90 of file fl.h.

References TSBase::Cs, and GetBf().

90 {Cs+=GetBf(&UInt, sizeof(UInt));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( int64 Int)
inline

Definition at line 91 of file fl.h.

References TSBase::Cs, and GetBf().

91 {Cs+=GetBf(&Int, sizeof(Int));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( uint64 UInt)
inline

Definition at line 92 of file fl.h.

References TSBase::Cs, and GetBf().

92 {Cs+=GetBf(&UInt, sizeof(UInt));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( double &  Flt)
inline

Definition at line 93 of file fl.h.

References TSBase::Cs, and GetBf().

93 {Cs+=GetBf(&Flt, sizeof(Flt));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( sdouble SFlt)
inline

Definition at line 94 of file fl.h.

References TSBase::Cs, and GetBf().

94 {Cs+=GetBf(&SFlt, sizeof(SFlt));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( ldouble LFlt)
inline

Definition at line 95 of file fl.h.

References TSBase::Cs, and GetBf().

95 {Cs+=GetBf(&LFlt, sizeof(LFlt));}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( char *&  CStr,
const int &  MxCStrLen,
const int &  CStrLen 
)
inline

Definition at line 96 of file fl.h.

References TSBase::Cs, and GetBf().

96  {
97  CStr=new char[MxCStrLen+1]; Cs+=GetBf(CStr, CStrLen+1);}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::Load ( char *&  CStr)

Definition at line 34 of file fl.cpp.

References TSBase::Cs, EAssertR, GetBf(), TSBase::GetSNm(), Load(), and TCh::NullCh.

34  {
35  char Ch; Load(Ch);
36  int CStrLen=int(Ch);
37  EAssertR(CStrLen>=0, "Error reading stream '"+GetSNm()+"'.");
38  CStr=new char[CStrLen+1];
39  if (CStrLen>0){Cs+=GetBf(CStr, CStrLen);}
40  CStr[CStrLen]=TCh::NullCh;
41 }
static const char NullCh
Definition: dt.h:1033
virtual int GetBf(const void *Bf, const TSize &BfL)=0
void Load(bool &Bool)
Definition: fl.h:84
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
virtual TStr GetSNm() const
Definition: fl.cpp:20
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

void TSIn::LoadBf ( const void *  Bf,
const TSize BfL 
)
inline

Definition at line 81 of file fl.h.

References TSBase::Cs, and GetBf().

Referenced by TPackVec< TVal >::AddV(), TSparseGroup< TVal, GroupSize >::Load(), TPackVec< TVal >::Load(), TBigStrPool::LoadPoolShM(), TUniChInfo::LoadSChar(), TUniChInfo::LoadUShort(), TB32Set::TB32Set(), TB8Set::TB8Set(), TBigStrPool::TBigStrPool(), TBSet::TBSet(), TMd5Sig::TMd5Sig(), TMem::TMem(), and TStrPool::TStrPool().

81 {Cs+=GetBf(Bf, BfL);}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

Here is the caller graph for this function:

void TSIn::LoadCs ( )
virtual

Reimplemented in TShMIn.

Definition at line 28 of file fl.cpp.

References TSBase::Cs, EAssertR, GetBf(), and TSBase::GetSNm().

Referenced by THashMP< TInt, TEdge >::Load(), THash< TPair, THash >::Load(), TUniCaseFolding::Load(), TStrHash< TInt, TBigStrPool >::Load(), THashSet< TInt >::Load(), TUniChDb::Load(), TBigStrPool::TBigStrPool(), THash< TPair, THash >::THash(), THashMP< TInt, TEdge >::THashMP(), THashSet< TInt >::THashSet(), TStrHash< TInt, TBigStrPool >::TStrHash(), TStrPool::TStrPool(), TStrPool64::TStrPool64(), and TUniCaseFolding::TUniCaseFolding().

28  {
29  TCs CurCs=Cs; TCs TestCs;
30  Cs+=GetBf(&TestCs, sizeof(TestCs));
31  EAssertR(CurCs==TestCs, "Invalid checksum reading '"+GetSNm()+"'.");
32 }
virtual int GetBf(const void *Bf, const TSize &BfL)=0
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
virtual TStr GetSNm() const
Definition: fl.cpp:20
Definition: fl.h:11
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

Here is the caller graph for this function:

void* TSIn::LoadNewBf ( const int &  BfL)
inline

Definition at line 82 of file fl.h.

References TSBase::Cs, and GetBf().

Referenced by TBSet::TBSet().

82  {
83  void* Bf=(void*)new char[BfL]; Cs+=GetBf(Bf, BfL); return Bf;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

Here is the caller graph for this function:

TSIn& TSIn::operator= ( const TSIn )
private
TSIn& TSIn::operator>> ( bool &  Bool)
inline

Definition at line 100 of file fl.h.

References TSBase::Cs, and GetBf().

100 {Cs+=GetBf(&Bool, sizeof(Bool)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( uchar UCh)
inline

Definition at line 101 of file fl.h.

References TSBase::Cs, and GetBf().

101 {Cs+=GetBf(&UCh, sizeof(UCh)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( char &  Ch)
inline

Definition at line 102 of file fl.h.

References TSBase::Cs, and GetBf().

102 {Cs+=GetBf(&Ch, sizeof(Ch)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( short &  Sh)
inline

Definition at line 103 of file fl.h.

References TSBase::Cs, and GetBf().

103 {Cs+=GetBf(&Sh, sizeof(Sh)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( ushort USh)
inline

Definition at line 104 of file fl.h.

References TSBase::Cs, and GetBf().

104 {Cs+=GetBf(&USh, sizeof(USh)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( int &  Int)
inline

Definition at line 105 of file fl.h.

References TSBase::Cs, and GetBf().

105 {Cs+=GetBf(&Int, sizeof(Int)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( uint UInt)
inline

Definition at line 106 of file fl.h.

References TSBase::Cs, and GetBf().

106 {Cs+=GetBf(&UInt, sizeof(UInt)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( int64 Int)
inline

Definition at line 107 of file fl.h.

References TSBase::Cs, and GetBf().

107 {Cs+=GetBf(&Int, sizeof(Int)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( uint64 UInt)
inline

Definition at line 108 of file fl.h.

References TSBase::Cs, and GetBf().

108 {Cs+=GetBf(&UInt, sizeof(UInt)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( float &  Flt)
inline

Definition at line 109 of file fl.h.

References TSBase::Cs, and GetBf().

109 {Cs+=GetBf(&Flt, sizeof(Flt)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( double &  Double)
inline

Definition at line 110 of file fl.h.

References TSBase::Cs, and GetBf().

110 {Cs+=GetBf(&Double, sizeof(Double)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

TSIn& TSIn::operator>> ( long double &  LDouble)
inline

Definition at line 111 of file fl.h.

References TSBase::Cs, and GetBf().

111 {Cs+=GetBf(&LDouble, sizeof(LDouble)); return *this;}
virtual int GetBf(const void *Bf, const TSize &BfL)=0
TCs Cs
Definition: fl.h:44

Here is the call graph for this function:

virtual char TSIn::PeekCh ( )
pure virtual

Implemented in TStrIn, TMIn, TShMIn, TFInOut, TChAIn, TFIn, TStdIn, TMemIn, and TZipIn.

Referenced by GetNextLn(), and TXmlParser::GetSym().

Here is the caller graph for this function:

virtual void TSIn::Reset ( )
inlinevirtual

Reimplemented in TStrIn, TMIn, TChAIn, TFIn, TStdIn, and TMemIn.

Definition at line 75 of file fl.h.

References Fail.

75 {Fail;}
#define Fail
Definition: bd.h:238
void TSIn::SetFastMode ( const bool &  _FastMode)
inline

Definition at line 78 of file fl.h.

References FastMode.

78 {FastMode=_FastMode;}
bool FastMode
Definition: fl.h:60

Friends And Related Function Documentation

friend class TPt< TSIn >
friend

Definition at line 117 of file fl.h.

Member Data Documentation

bool TSIn::FastMode
private

Definition at line 60 of file fl.h.

Referenced by IsFastMode(), and SetFastMode().

const PSIn TSIn::StdIn =PSIn(new TStdIn())
static

Definition at line 116 of file fl.h.


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