SNAP Library 2.0, Developer Reference  2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TSOut Class Reference

#include <fl.h>

Inheritance diagram for TSOut:
Collaboration diagram for TSOut:

List of all members.

Public Member Functions

 TSOut ()
 TSOut (const TStr &Str)
virtual ~TSOut ()
void EnableLnTrunc (const int &_MxLnLen)
void DisableLnTrunc ()
virtual int PutCh (const char &Ch)=0
virtual int PutBf (const void *LBf, const TSize &LBfL)=0
virtual void Flush ()=0
virtual TFileId GetFileId () const
int PutMem (const TMem &Mem)
int PutCh (const char &Ch, const int &Chs)
int PutBool (const bool &Bool)
int PutInt (const int &Int)
int PutInt (const int &Int, const char *FmtStr)
int PutUInt (const uint &Int)
int PutUInt (const uint &Int, const char *FmtStr)
int PutFlt (const double &Flt)
int PutFlt (const double &Flt, const char *FmtStr)
int PutStr (const char *CStr)
int PutStr (const TChA &ChA)
int PutStr (const TStr &Str, const char *FmtStr)
int PutStr (const TStr &Str, const bool &ForceInLn=false)
int PutStrLn (const TStr &Str, const bool &ForceInLn=false)
int PutStrFmt (const char *FmtStr,...)
int PutStrFmtLn (const char *FmtStr,...)
int PutIndent (const int &IndentLev=1)
int PutLn (const int &Lns=1)
int PutDosLn (const int &Lns=1)
int PutSep (const int &NextStrLen=0)
int PutSepLn (const int &Lns=0)
void SaveCs ()
void SaveBf (const void *Bf, const TSize &BfL)
void Save (const bool &Bool)
void Save (const char &Ch)
void Save (const uchar &UCh)
void Save (const short &Short)
void Save (const ushort &UShort)
void Save (const int &Int)
void Save (const uint &UInt)
void Save (const int64 &Int)
void Save (const uint64 &UInt)
void Save (const double &Flt)
void Save (const sdouble &SFlt)
void Save (const ldouble &LFlt)
void Save (const char *CStr, const TSize &CStrLen)
void Save (const char *CStr)
void Save (TSIn &SIn, const TSize &BfL=-1)
void Save (const PSIn &SIn, const TSize &BfL=-1)
void Save (const void *Bf, const TSize &BfL)
TSOutoperator<< (const bool &Bool)
TSOutoperator<< (const uchar &UCh)
TSOutoperator<< (const char &Ch)
TSOutoperator<< (const short &Sh)
TSOutoperator<< (const ushort &USh)
TSOutoperator<< (const int &Int)
TSOutoperator<< (const uint &Int)
TSOutoperator<< (const int64 &Int)
TSOutoperator<< (const uint64 &UInt)
TSOutoperator<< (const float &Flt)
TSOutoperator<< (const double &Double)
TSOutoperator<< (const long double &LDouble)
TSOutoperator<< (const TSOutMnp &Mnp)
TSOutoperator<< (TSOut &(*FuncPt)(TSOut &))
TSOutoperator<< (TSIn &SIn)
TSOutoperator<< (PSIn &SIn)

Static Public Attributes

static const TPt< TSOutStdOut = PSOut(new TStdOut())

Private Member Functions

int UpdateLnLen (const int &StrLen, const bool &ForceInLn=false)
 TSOut (const TSIn &)
TSOutoperator= (const TSOut &)

Private Attributes

int MxLnLen
int LnLen

Friends

class TPt< TSOut >

Detailed Description

Definition at line 128 of file fl.h.


Constructor & Destructor Documentation

TSOut::TSOut ( const TSIn ) [private]
TSOut::TSOut ( ) [inline]

Definition at line 136 of file fl.h.

: TSBase("Output-Stream"), MxLnLen(-1), LnLen(0){}
TSOut::TSOut ( const TStr Str)

Definition at line 67 of file fl.cpp.

                           :
  TSBase(Str.CStr()), MxLnLen(-1), LnLen(0){}
virtual TSOut::~TSOut ( ) [inline, virtual]

Definition at line 138 of file fl.h.

{}

Member Function Documentation

void TSOut::DisableLnTrunc ( ) [inline]

Definition at line 141 of file fl.h.

References MxLnLen.

{MxLnLen=-1;}
void TSOut::EnableLnTrunc ( const int &  _MxLnLen) [inline]

Definition at line 140 of file fl.h.

References MxLnLen.

{MxLnLen=_MxLnLen;}
virtual TFileId TSOut::GetFileId ( ) const [inline, virtual]

Reimplemented in TFInOut, and TFOut.

Definition at line 146 of file fl.h.

Referenced by THtmlDoc::SaveHtmlToXml().

{return NULL;}

Here is the caller graph for this function:

TSOut& TSOut::operator<< ( const bool &  Bool) [inline]

Definition at line 191 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Bool, sizeof(Bool)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const uchar UCh) [inline]

Definition at line 192 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UCh, sizeof(UCh)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const char &  Ch) [inline]

Definition at line 193 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Ch, sizeof(Ch)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const short &  Sh) [inline]

Definition at line 194 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Sh, sizeof(Sh)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const ushort USh) [inline]

Definition at line 195 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&USh, sizeof(USh)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const int &  Int) [inline]

Definition at line 196 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const uint Int) [inline]

Definition at line 197 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const int64 Int) [inline]

Definition at line 198 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const uint64 UInt) [inline]

Definition at line 199 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UInt, sizeof(UInt)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const float &  Flt) [inline]

Definition at line 200 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Flt, sizeof(Flt)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const double &  Double) [inline]

Definition at line 201 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Double, sizeof(Double)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const long double &  LDouble) [inline]

Definition at line 202 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&LDouble, sizeof(LDouble)); return *this;}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( const TSOutMnp Mnp) [inline]

Definition at line 203 of file fl.h.

{return Mnp(*this);}
TSOut& TSOut::operator<< ( TSOut &(*)(TSOut &)  FuncPt) [inline]

Definition at line 204 of file fl.h.

{return FuncPt(*this);}
TSOut & TSOut::operator<< ( TSIn SIn)

Definition at line 205 of file fl.cpp.

References TSIn::Eof(), and TSIn::GetCh().

                                  {
  while (!SIn.Eof())
    operator<<((char)SIn.GetCh());
  return *this;
}

Here is the call graph for this function:

TSOut& TSOut::operator<< ( PSIn SIn) [inline]

Definition at line 206 of file fl.h.

References operator<<().

Referenced by operator<<().

{return operator<<(*SIn);}

Here is the call graph for this function:

Here is the caller graph for this function:

TSOut& TSOut::operator= ( const TSOut ) [private]
virtual int TSOut::PutBf ( const void *  LBf,
const TSize LBfL 
) [pure virtual]

Implemented in TMOut, TFInOut, TFOut, TStdOut, TMemOut, and TZipOut.

Referenced by operator<<(), PutMem(), PutStr(), Save(), SaveBf(), SaveCs(), and TInt::SaveFrugalIntV().

Here is the caller graph for this function:

int TSOut::PutBool ( const bool &  Bool)

Definition at line 89 of file fl.cpp.

References TBool::GetStr(), and PutStr().

                                  {
  return PutStr(TBool::GetStr(Bool));
}

Here is the call graph for this function:

int TSOut::PutCh ( const char &  Ch,
const int &  Chs 
)

Definition at line 83 of file fl.cpp.

References TSBase::Cs, and PutCh().

                                              {
  int Cs=0;
  for (int ChN=0; ChN<Chs; ChN++){Cs+=PutCh(Ch);}
  return Cs;
}

Here is the call graph for this function:

int TSOut::PutDosLn ( const int &  Lns = 1)

Definition at line 164 of file fl.cpp.

References TCh::CrCh, TSBase::Cs, TCh::LfCh, LnLen, and PutCh().

Referenced by TOLx::PutDosLn().

                                 {
  LnLen=0; int Cs=0;
  for (int LnN=0; LnN<Lns; LnN++){Cs+=PutCh(TCh::CrCh)+PutCh(TCh::LfCh);}
  return Cs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::PutFlt ( const double &  Flt)

Definition at line 109 of file fl.cpp.

References TFlt::GetStr(), and PutStr().

Referenced by TLAMisc::SaveCsvTFltV().

                                  {
  return PutStr(TFlt::GetStr(Flt));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::PutFlt ( const double &  Flt,
const char *  FmtStr 
)

Definition at line 113 of file fl.cpp.

References TFlt::GetStr(), and PutStr().

                                                      {
  return PutStr(TFlt::GetStr(Flt, FmtStr));
}

Here is the call graph for this function:

int TSOut::PutIndent ( const int &  IndentLev = 1)

Definition at line 154 of file fl.cpp.

References PutCh().

                                        {
  return PutCh(' ', IndentLev*2);
}

Here is the call graph for this function:

int TSOut::PutInt ( const int &  Int)

Definition at line 93 of file fl.cpp.

References TInt::GetStr(), and PutStr().

Referenced by TLAMisc::SaveMatlabTIntV().

                               {
  return PutStr(TInt::GetStr(Int));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::PutInt ( const int &  Int,
const char *  FmtStr 
)

Definition at line 97 of file fl.cpp.

References TInt::GetStr(), and PutStr().

                                                   {
  return PutStr(TInt::GetStr(Int, FmtStr));
}

Here is the call graph for this function:

int TSOut::PutLn ( const int &  Lns = 1)

Definition at line 158 of file fl.cpp.

References TSBase::Cs, LnLen, and PutCh().

Referenced by TOLx::PutLn(), PutSep(), PutSepLn(), PutStrFmtLn(), PutStrLn(), TLAMisc::SaveCsvTFltV(), THtmlDoc::SaveTxt(), and UpdateLnLen().

                              {
  LnLen=0; int Cs=0;
  for (int LnN=0; LnN<Lns; LnN++){Cs+=PutCh('\n');}
  return Cs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::PutMem ( const TMem Mem)

Definition at line 79 of file fl.cpp.

References TMem::Len(), and PutBf().

                                {
  return PutBf(Mem(), Mem.Len());
}

Here is the call graph for this function:

int TSOut::PutSep ( const int &  NextStrLen = 0)

Definition at line 170 of file fl.cpp.

References TSBase::Cs, LnLen, MxLnLen, PutCh(), and PutLn().

                                      {
  int Cs=0;
  if (MxLnLen==-1){
    Cs+=PutCh(' ');
  } else {
    if (LnLen>0){
      if (LnLen+1+NextStrLen>MxLnLen){Cs+=PutLn();} else {Cs+=PutCh(' ');}
    }
  }
  return Cs;
}

Here is the call graph for this function:

int TSOut::PutSepLn ( const int &  Lns = 0)

Definition at line 182 of file fl.cpp.

References TSBase::Cs, LnLen, and PutLn().

                                 {
  int Cs=0;
  if (LnLen>0){Cs+=PutLn();}
  Cs+=PutLn(Lns);
  return Cs;
}

Here is the call graph for this function:

int TSOut::PutStr ( const TChA ChA)

Definition at line 122 of file fl.cpp.

References TSBase::Cs, TChA::CStr(), TChA::Len(), PutBf(), and UpdateLnLen().

                                {
  int Cs=UpdateLnLen(ChA.Len());
  return Cs+PutBf(ChA.CStr(), ChA.Len());
}

Here is the call graph for this function:

int TSOut::PutStr ( const TStr Str,
const char *  FmtStr 
)

Definition at line 127 of file fl.cpp.

References TStr::GetStr(), and PutStr().

                                                    {
  return PutStr(TStr::GetStr(Str, FmtStr));
}

Here is the call graph for this function:

int TSOut::PutStr ( const TStr Str,
const bool &  ForceInLn = false 
)

Definition at line 131 of file fl.cpp.

References TSBase::Cs, TStr::CStr(), TStr::Len(), PutBf(), and UpdateLnLen().

                                                       {
  int Cs=UpdateLnLen(Str.Len(), ForceInLn);
  return Cs+PutBf(Str.CStr(), Str.Len());
}

Here is the call graph for this function:

int TSOut::PutStrFmt ( const char *  FmtStr,
  ... 
)

Definition at line 136 of file fl.cpp.

References PutStr().

                                           {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  return RetVal!=-1 ? PutStr(TStr(Bf)) : 0;     
}

Here is the call graph for this function:

int TSOut::PutStrFmtLn ( const char *  FmtStr,
  ... 
)

Definition at line 145 of file fl.cpp.

References PutLn(), and PutStrLn().

                                             {
  char Bf[10*1024];
  va_list valist;
  va_start(valist, FmtStr);
  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
  va_end(valist);
  return RetVal!=-1 ? PutStrLn(TStr(Bf)) : PutLn();     
}

Here is the call graph for this function:

int TSOut::PutStrLn ( const TStr Str,
const bool &  ForceInLn = false 
) [inline]

Definition at line 161 of file fl.h.

References TSBase::Cs, PutLn(), and PutStr().

Referenced by TFPathNotify::OnStatus(), PutStrFmtLn(), TLAMisc::SaveMatlabTFltIntKdV(), and THist::SaveStat().

                                                            {
    int Cs=PutStr(Str,ForceInLn); Cs+=PutLn(); return Cs;}

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::PutUInt ( const uint Int)

Definition at line 101 of file fl.cpp.

References TUInt::GetStr(), and PutStr().

                                  {
  return PutStr(TUInt::GetStr(UInt));
}

Here is the call graph for this function:

int TSOut::PutUInt ( const uint Int,
const char *  FmtStr 
)

Definition at line 105 of file fl.cpp.

References TUInt::GetStr(), and PutStr().

                                                      {
  return PutStr(TUInt::GetStr(UInt, FmtStr));
}

Here is the call graph for this function:

void TSOut::Save ( const char &  Ch) [inline]

Definition at line 174 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Ch, sizeof(Ch));}

Here is the call graph for this function:

void TSOut::Save ( const uchar UCh) [inline]

Definition at line 175 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UCh, sizeof(UCh));}

Here is the call graph for this function:

void TSOut::Save ( const short &  Short) [inline]

Definition at line 176 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Short, sizeof(Short));}

Here is the call graph for this function:

void TSOut::Save ( const ushort UShort) [inline]

Definition at line 177 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UShort, sizeof(UShort));}

Here is the call graph for this function:

void TSOut::Save ( const int &  Int) [inline]

Definition at line 178 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Int, sizeof(Int));}

Here is the call graph for this function:

void TSOut::Save ( const uint UInt) [inline]

Definition at line 179 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UInt, sizeof(UInt));}

Here is the call graph for this function:

void TSOut::Save ( const int64 Int) [inline]

Definition at line 180 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Int, sizeof(Int));}

Here is the call graph for this function:

void TSOut::Save ( const uint64 UInt) [inline]

Definition at line 181 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&UInt, sizeof(UInt));}

Here is the call graph for this function:

void TSOut::Save ( const double &  Flt) [inline]

Definition at line 182 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&Flt, sizeof(Flt));}

Here is the call graph for this function:

void TSOut::Save ( const sdouble SFlt) [inline]

Definition at line 183 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&SFlt, sizeof(SFlt));}

Here is the call graph for this function:

void TSOut::Save ( const ldouble LFlt) [inline]

Definition at line 184 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(&LFlt, sizeof(LFlt));}

Here is the call graph for this function:

void TSOut::Save ( const char *  CStr,
const TSize CStrLen 
) [inline]

Definition at line 185 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(CStr, CStrLen+1);}

Here is the call graph for this function:

void TSOut::Save ( const char *  CStr)

Definition at line 189 of file fl.cpp.

References TSBase::Cs, EAssertR, TSBase::GetSNm(), PutBf(), and Save().

                                {
  int CStrLen=int(strlen(CStr));
  EAssertR(CStrLen<=127, "Error writting stream '"+GetSNm()+"'.");
  Save(char(CStrLen));
  if (CStrLen>0){Cs+=PutBf(CStr, CStrLen);}
}

Here is the call graph for this function:

void TSOut::Save ( TSIn SIn,
const TSize BfL = -1 
)

Definition at line 196 of file fl.cpp.

References TSIn::Eof(), Fail, TSIn::GetCh(), and Save().

                                           {
  Fail;
  if (BfL==0){ //J: used to be ==-1
    while (!SIn.Eof()){Save(SIn.GetCh());}
  } else {
    for (TSize BfC=0; BfC<BfL; BfC++){Save(SIn.GetCh());}
  }
}

Here is the call graph for this function:

void TSOut::Save ( const PSIn SIn,
const TSize BfL = -1 
) [inline]

Definition at line 188 of file fl.h.

References Save().

Referenced by Save().

{Save(*SIn, BfL);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TSOut::Save ( const void *  Bf,
const TSize BfL 
) [inline]

Definition at line 189 of file fl.h.

References TSBase::Cs, and PutBf().

{Cs+=PutBf(Bf, BfL);}

Here is the call graph for this function:

void TSOut::SaveBf ( const void *  Bf,
const TSize BfL 
) [inline]
void TSOut::SaveCs ( ) [inline]

Definition at line 171 of file fl.h.

References TSBase::Cs, and PutBf().

Referenced by THash< TIntPr, TEdgeInfo >::Save(), TUniCaseFolding::Save(), TBigStrPool::Save(), TStrHash< TDat, TStringPool, THashFunc >::Save(), TStrPool::Save(), TStrPool64::Save(), THashSet< TInt >::Save(), and TUniChDb::Save().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int TSOut::UpdateLnLen ( const int &  StrLen,
const bool &  ForceInLn = false 
) [private]

Definition at line 70 of file fl.cpp.

References TSBase::Cs, LnLen, MxLnLen, and PutLn().

Referenced by PutStr().

                                                              {
  int Cs=0;
  if (MxLnLen!=-1){
    if ((!ForceInLn)&&(LnLen+StrLen>MxLnLen)){Cs+=PutLn();}
    LnLen+=StrLen;
  }
  return Cs;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class TPt< TSOut > [friend]

Definition at line 209 of file fl.h.


Member Data Documentation

int TSOut::LnLen [private]

Definition at line 130 of file fl.h.

Referenced by PutDosLn(), PutLn(), PutSep(), PutSepLn(), and UpdateLnLen().

int TSOut::MxLnLen [private]

Definition at line 130 of file fl.h.

Referenced by DisableLnTrunc(), EnableLnTrunc(), PutSep(), and UpdateLnLen().

const PSOut TSOut::StdOut = PSOut(new TStdOut()) [static]

Definition at line 208 of file fl.h.

Referenced by THtmlHldV::THtmlHldV().


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