SNAP Library 2.2, User Reference  2014-03-11 19:15:55
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>

Inherits TSBase.

Inherited by TFOut, TMemOut, TMOut, TSInOut, TStdOut, and TZipOut.

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.

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

Definition at line 140 of file fl.h.

{MxLnLen=_MxLnLen;}
virtual void TSOut::Flush ( ) [pure virtual]

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

virtual TFileId TSOut::GetFileId ( ) const [inline, virtual]

Reimplemented in TFInOut, and TFOut.

Definition at line 146 of file fl.h.

{return NULL;}
TSOut& TSOut::operator<< ( const bool &  Bool) [inline]

Definition at line 191 of file fl.h.

{Cs+=PutBf(&Bool, sizeof(Bool)); return *this;}
TSOut& TSOut::operator<< ( const uchar UCh) [inline]

Definition at line 192 of file fl.h.

{Cs+=PutBf(&UCh, sizeof(UCh)); return *this;}
TSOut& TSOut::operator<< ( const char &  Ch) [inline]

Definition at line 193 of file fl.h.

{Cs+=PutBf(&Ch, sizeof(Ch)); return *this;}
TSOut& TSOut::operator<< ( const short &  Sh) [inline]

Definition at line 194 of file fl.h.

{Cs+=PutBf(&Sh, sizeof(Sh)); return *this;}
TSOut& TSOut::operator<< ( const ushort USh) [inline]

Definition at line 195 of file fl.h.

{Cs+=PutBf(&USh, sizeof(USh)); return *this;}
TSOut& TSOut::operator<< ( const int &  Int) [inline]

Definition at line 196 of file fl.h.

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}
TSOut& TSOut::operator<< ( const uint Int) [inline]

Definition at line 197 of file fl.h.

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}
TSOut& TSOut::operator<< ( const int64 Int) [inline]

Definition at line 198 of file fl.h.

{Cs+=PutBf(&Int, sizeof(Int)); return *this;}
TSOut& TSOut::operator<< ( const uint64 UInt) [inline]

Definition at line 199 of file fl.h.

{Cs+=PutBf(&UInt, sizeof(UInt)); return *this;}
TSOut& TSOut::operator<< ( const float &  Flt) [inline]

Definition at line 200 of file fl.h.

{Cs+=PutBf(&Flt, sizeof(Flt)); return *this;}
TSOut& TSOut::operator<< ( const double &  Double) [inline]

Definition at line 201 of file fl.h.

{Cs+=PutBf(&Double, sizeof(Double)); return *this;}
TSOut& TSOut::operator<< ( const long double &  LDouble) [inline]

Definition at line 202 of file fl.h.

{Cs+=PutBf(&LDouble, sizeof(LDouble)); return *this;}
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.

                                  {
  while (!SIn.Eof())
    operator<<((char)SIn.GetCh());
  return *this;
}
TSOut& TSOut::operator<< ( PSIn SIn) [inline]

Definition at line 206 of file fl.h.

{return operator<<(*SIn);}
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.

int TSOut::PutBool ( const bool &  Bool)

Definition at line 89 of file fl.cpp.

                                  {
  return PutStr(TBool::GetStr(Bool));
}
virtual int TSOut::PutCh ( const char &  Ch) [pure virtual]

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

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

Definition at line 83 of file fl.cpp.

                                              {
  int Cs=0;
  for (int ChN=0; ChN<Chs; ChN++){Cs+=PutCh(Ch);}
  return Cs;
}
int TSOut::PutDosLn ( const int &  Lns = 1)

Definition at line 164 of file fl.cpp.

                                 {
  LnLen=0; int Cs=0;
  for (int LnN=0; LnN<Lns; LnN++){Cs+=PutCh(TCh::CrCh)+PutCh(TCh::LfCh);}
  return Cs;
}
int TSOut::PutFlt ( const double &  Flt)

Definition at line 109 of file fl.cpp.

                                  {
  return PutStr(TFlt::GetStr(Flt));
}
int TSOut::PutFlt ( const double &  Flt,
const char *  FmtStr 
)

Definition at line 113 of file fl.cpp.

                                                      {
  return PutStr(TFlt::GetStr(Flt, FmtStr));
}
int TSOut::PutIndent ( const int &  IndentLev = 1)

Definition at line 154 of file fl.cpp.

                                        {
  return PutCh(' ', IndentLev*2);
}
int TSOut::PutInt ( const int &  Int)

Definition at line 93 of file fl.cpp.

                               {
  return PutStr(TInt::GetStr(Int));
}
int TSOut::PutInt ( const int &  Int,
const char *  FmtStr 
)

Definition at line 97 of file fl.cpp.

                                                   {
  return PutStr(TInt::GetStr(Int, FmtStr));
}
int TSOut::PutLn ( const int &  Lns = 1)

Definition at line 158 of file fl.cpp.

                              {
  LnLen=0; int Cs=0;
  for (int LnN=0; LnN<Lns; LnN++){Cs+=PutCh('\n');}
  return Cs;
}
int TSOut::PutMem ( const TMem Mem)

Definition at line 79 of file fl.cpp.

                                {
  return PutBf(Mem(), Mem.Len());
}
int TSOut::PutSep ( const int &  NextStrLen = 0)

Definition at line 170 of file fl.cpp.

                                      {
  int Cs=0;
  if (MxLnLen==-1){
    Cs+=PutCh(' ');
  } else {
    if (LnLen>0){
      if (LnLen+1+NextStrLen>MxLnLen){Cs+=PutLn();} else {Cs+=PutCh(' ');}
    }
  }
  return Cs;
}
int TSOut::PutSepLn ( const int &  Lns = 0)

Definition at line 182 of file fl.cpp.

                                 {
  int Cs=0;
  if (LnLen>0){Cs+=PutLn();}
  Cs+=PutLn(Lns);
  return Cs;
}
int TSOut::PutStr ( const char *  CStr)

Definition at line 117 of file fl.cpp.

                                 {
  int Cs=UpdateLnLen(int(strlen(CStr)));
  return Cs+PutBf(CStr, int(strlen(CStr)));
}
int TSOut::PutStr ( const TChA ChA)

Definition at line 122 of file fl.cpp.

                                {
  int Cs=UpdateLnLen(ChA.Len());
  return Cs+PutBf(ChA.CStr(), ChA.Len());
}
int TSOut::PutStr ( const TStr Str,
const char *  FmtStr 
)

Definition at line 127 of file fl.cpp.

                                                    {
  return PutStr(TStr::GetStr(Str, FmtStr));
}
int TSOut::PutStr ( const TStr Str,
const bool &  ForceInLn = false 
)

Definition at line 131 of file fl.cpp.

                                                       {
  int Cs=UpdateLnLen(Str.Len(), ForceInLn);
  return Cs+PutBf(Str.CStr(), Str.Len());
}
int TSOut::PutStrFmt ( const char *  FmtStr,
  ... 
)

Definition at line 136 of file fl.cpp.

                                           {
  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;     
}
int TSOut::PutStrFmtLn ( const char *  FmtStr,
  ... 
)

Definition at line 145 of file fl.cpp.

                                             {
  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();     
}
int TSOut::PutStrLn ( const TStr Str,
const bool &  ForceInLn = false 
) [inline]

Definition at line 161 of file fl.h.

                                                            {
    int Cs=PutStr(Str,ForceInLn); Cs+=PutLn(); return Cs;}
int TSOut::PutUInt ( const uint Int)

Definition at line 101 of file fl.cpp.

                                  {
  return PutStr(TUInt::GetStr(UInt));
}
int TSOut::PutUInt ( const uint Int,
const char *  FmtStr 
)

Definition at line 105 of file fl.cpp.

                                                      {
  return PutStr(TUInt::GetStr(UInt, FmtStr));
}
void TSOut::Save ( const bool &  Bool) [inline]

Definition at line 173 of file fl.h.

{Cs+=PutBf(&Bool, sizeof(Bool));}
void TSOut::Save ( const char &  Ch) [inline]

Definition at line 174 of file fl.h.

{Cs+=PutBf(&Ch, sizeof(Ch));}
void TSOut::Save ( const uchar UCh) [inline]

Definition at line 175 of file fl.h.

{Cs+=PutBf(&UCh, sizeof(UCh));}
void TSOut::Save ( const short &  Short) [inline]

Definition at line 176 of file fl.h.

{Cs+=PutBf(&Short, sizeof(Short));}
void TSOut::Save ( const ushort UShort) [inline]

Definition at line 177 of file fl.h.

{Cs+=PutBf(&UShort, sizeof(UShort));}
void TSOut::Save ( const int &  Int) [inline]

Definition at line 178 of file fl.h.

{Cs+=PutBf(&Int, sizeof(Int));}
void TSOut::Save ( const uint UInt) [inline]

Definition at line 179 of file fl.h.

{Cs+=PutBf(&UInt, sizeof(UInt));}
void TSOut::Save ( const int64 Int) [inline]

Definition at line 180 of file fl.h.

{Cs+=PutBf(&Int, sizeof(Int));}
void TSOut::Save ( const uint64 UInt) [inline]

Definition at line 181 of file fl.h.

{Cs+=PutBf(&UInt, sizeof(UInt));}
void TSOut::Save ( const double &  Flt) [inline]

Definition at line 182 of file fl.h.

{Cs+=PutBf(&Flt, sizeof(Flt));}
void TSOut::Save ( const sdouble SFlt) [inline]

Definition at line 183 of file fl.h.

{Cs+=PutBf(&SFlt, sizeof(SFlt));}
void TSOut::Save ( const ldouble LFlt) [inline]

Definition at line 184 of file fl.h.

{Cs+=PutBf(&LFlt, sizeof(LFlt));}
void TSOut::Save ( const char *  CStr,
const TSize CStrLen 
) [inline]

Definition at line 185 of file fl.h.

{Cs+=PutBf(CStr, CStrLen+1);}
void TSOut::Save ( const char *  CStr)

Definition at line 189 of file fl.cpp.

                                {
  int CStrLen=int(strlen(CStr));
  EAssertR(CStrLen<=127, "Error writting stream '"+GetSNm()+"'.");
  Save(char(CStrLen));
  if (CStrLen>0){Cs+=PutBf(CStr, CStrLen);}
}
void TSOut::Save ( TSIn SIn,
const TSize BfL = -1 
)

Definition at line 196 of file fl.cpp.

                                           {
  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());}
  }
}
void TSOut::Save ( const PSIn SIn,
const TSize BfL = -1 
) [inline]

Definition at line 188 of file fl.h.

{Save(*SIn, BfL);}
void TSOut::Save ( const void *  Bf,
const TSize BfL 
) [inline]

Definition at line 189 of file fl.h.

{Cs+=PutBf(Bf, BfL);}
void TSOut::SaveBf ( const void *  Bf,
const TSize BfL 
) [inline]

Definition at line 172 of file fl.h.

{Cs+=PutBf(Bf, BfL);}
void TSOut::SaveCs ( ) [inline]

Definition at line 171 of file fl.h.

{Cs+=PutBf(&Cs, sizeof(Cs));}
int TSOut::UpdateLnLen ( const int &  StrLen,
const bool &  ForceInLn = false 
) [private]

Definition at line 70 of file fl.cpp.

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

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.

int TSOut::MxLnLen [private]

Definition at line 130 of file fl.h.

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

Definition at line 208 of file fl.h.


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