SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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>

Inherits TSBase.

Inherited by TChAIn, TFIn, TMemIn, TMIn, TSInOut, TStdIn, TStrIn, and TZipIn.

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)
 
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 bool TSIn::Eof ( )
pure virtual

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

virtual int TSIn::GetBf ( const void *  Bf,
const TSize BfL 
)
pure virtual

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

virtual char TSIn::GetCh ( )
pure virtual

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

bool TSIn::GetNextLn ( TStr LnStr)

Definition at line 43 of file fl.cpp.

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
bool TSIn::GetNextLn ( TChA LnChA)

Definition at line 50 of file fl.cpp.

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
virtual bool TSIn::GetNextLnBf ( TChA LnChA)
pure virtual

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

bool TSIn::IsFastMode ( ) const
inline

Definition at line 77 of file fl.h.

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

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

void TSIn::Load ( bool &  Bool)
inline

Definition at line 84 of file fl.h.

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

Definition at line 85 of file fl.h.

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

Definition at line 86 of file fl.h.

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

Definition at line 87 of file fl.h.

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

Definition at line 88 of file fl.h.

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

Definition at line 89 of file fl.h.

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

Definition at line 90 of file fl.h.

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

Definition at line 91 of file fl.h.

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

Definition at line 92 of file fl.h.

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

Definition at line 93 of file fl.h.

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

Definition at line 94 of file fl.h.

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

Definition at line 95 of file fl.h.

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

Definition at line 96 of file fl.h.

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
void TSIn::Load ( char *&  CStr)

Definition at line 34 of file fl.cpp.

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:943
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
void TSIn::LoadBf ( const void *  Bf,
const TSize BfL 
)
inline

Definition at line 81 of file fl.h.

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

Definition at line 28 of file fl.cpp.

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
void* TSIn::LoadNewBf ( const int &  BfL)
inline

Definition at line 82 of file fl.h.

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
TSIn& TSIn::operator= ( const TSIn )
private
TSIn& TSIn::operator>> ( bool &  Bool)
inline

Definition at line 100 of file fl.h.

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

Definition at line 101 of file fl.h.

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

Definition at line 102 of file fl.h.

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

Definition at line 103 of file fl.h.

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

Definition at line 104 of file fl.h.

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

Definition at line 105 of file fl.h.

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

Definition at line 106 of file fl.h.

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

Definition at line 107 of file fl.h.

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

Definition at line 108 of file fl.h.

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

Definition at line 109 of file fl.h.

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

Definition at line 110 of file fl.h.

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

Definition at line 111 of file fl.h.

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

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

virtual void TSIn::Reset ( )
inlinevirtual

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

Definition at line 75 of file fl.h.

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

Definition at line 78 of file fl.h.

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.

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: