Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::PStream Class Reference

#include <PStream.h>

Inheritance diagram for PLearn::PStream:

Inheritance graph
[legend]
Collaboration diagram for PLearn::PStream:

Collaboration graph
[legend]
List of all members.

Public Types

typedef PStream &(* pl_pstream_manip )(PStream &)
 typedef's for PStream manipulators

typedef int streamsize
 typedef's for compatibility w/ old libraries

typedef ios ios_base
enum  mode_t {
  plearn_ascii, plearn_binary, raw_ascii, raw_binary,
  pretty_ascii
}
enum  compr_mode_t { compr_none, compr_double_as_float, compr_sparse, compr_lossy_sparse }
 Compression mode (mostly used by binary serialization of sequences of floats or doubles, such as TMat<real>) (Used on output only; autodetect on read). More...


Public Member Functions

 PStream ()
 default ctor: the stream is unusable ...

 PStream (istream *pin_, bool own_pin_=false)
 ctor. from an istream (I)

 PStream (ostream *pout_, bool own_pout_=false)
 ctor. from an ostream (O)

 PStream (iostream *pios_, bool own_pios_=false)
 ctor. from an iostream (IO)

 PStream (istream *pin_, ostream *pout_, bool own_pin_=false, bool own_pout_=false)
 ctor. from an istream and an ostream (IO)

virtual ~PStream ()
 dtor.

void setInMode (mode_t m)
void setOutMode (mode_t m)
void setMode (mode_t m)
PStreamoperator>> (mode_t m)
PStreamoperator<< (mode_t m)
PStreamoperator() (istream *pin)
PStreamoperator() (ostream *pout)
PStreamoperator() (iostream *pios)
PStreamoperator() (istream *pin, ostream *pout)
PStreamoperator= (const PStream &pios)
PStreamoperator= (istream *pin)
PStreamoperator= (ostream *pout)
PStreamoperator= (iostream *pios)
PStreamoperator() (const PStream &pios)
void writeAsciiNum (char x)
void writeAsciiNum (unsigned char x)
void writeAsciiNum (signed char x)
void writeAsciiNum (short x)
void writeAsciiNum (unsigned short x)
void writeAsciiNum (int x)
void writeAsciiNum (unsigned int x)
void writeAsciiNum (long x)
void writeAsciiNum (unsigned long x)
void writeAsciiNum (float x)
void writeAsciiNum (double x)
void readAsciiNum (char &x)
void readAsciiNum (unsigned char &x)
void readAsciiNum (signed char &x)
void readAsciiNum (short &x)
void readAsciiNum (unsigned short &x)
void readAsciiNum (int &x)
void readAsciiNum (unsigned int &x)
void readAsciiNum (long &x)
void readAsciiNum (unsigned long &x)
void readAsciiNum (float &x)
void readAsciiNum (double &x)
void writeAsciiHexNum (unsigned char x)
 Writes the corresponding 2 hex digits (ex: 0A ).

 operator bool ()
 op bool: true if the stream is in a valid state (e.g. "while(stm) stm >> x;")

bool eof () const
bool good () const
istream & _do_not_use_this_method_rawin_ ()
int get ()
PStreamget (char &c)
PStreamgetline (string &line, char delimitor='\n')
 Delimitor is read from stream but not appended to string.

string getline ()
int peek ()
PStreamputback (char c)
PStreamunget ()
PStreamread (char *s, streamsize n)
PStreamread (string &s, streamsize n)
streamsize readUntil (char *buf, streamsize n, char stop_char)
 Reads characters into buf until n characters have been read, or end-of-file has been reached, or the next character in the stream is the stop_char.

streamsize readUntil (char *buf, streamsize n, const char *stop_chars)
 Reads characters into buf until n characters have been read, or end-of-file has been reached, or the next character in the stream is one of the stop_chars (null terminated string) Returns the total number of characters put into buf.

PStreamwrite (const char *s, streamsize n)
PStreamput (char c)
PStreamput (unsigned char c)
PStreamput (int x)
PStreamflush ()
PStreamendl ()
PStreamwrite (const char *s)
PStreamwrite (const string &s)
void attach (int fd)
 attach this stream to a POSIX file descriptor.

void skipRestOfLine ()
 reads everything until '
' (also consumes the '
')

void skipBlanks ()
 skips any blanks (space, tab, newline)

void skipBlanksAndComments ()
 skips any blanks (space, tab, newline) and comments starting with #

void skipBlanksAndCommentsAndSeparators ()
 skips any blanks, # comments, and separators (',' and ';')

void skipAll (const char *chars_to_skip)
 skips all occurences of any of the given characters

int smartReadUntilNext (const string &stoppingsymbols, string &characters_read, bool ignore_brackets=false)
 Reads characters from stream, until we meet one of the stopping symbols at the current "level".

PStreamoperator>> (bool &x)
PStreamoperator>> (float &x)
PStreamoperator>> (double &x)
PStreamoperator>> (string &x)
PStreamoperator>> (char *x)
PStreamoperator>> (char &x)
PStreamoperator>> (signed char &x)
PStreamoperator>> (unsigned char &x)
PStreamoperator>> (int &x)
PStreamoperator>> (unsigned int &x)
PStreamoperator>> (long &x)
PStreamoperator>> (unsigned long &x)
PStreamoperator>> (short &x)
PStreamoperator>> (unsigned short &x)
PStreamoperator>> (pl_pstream_manip func)
PStreamoperator<< (float x)
PStreamoperator<< (double x)
PStreamoperator<< (const char *x)
 Warning: string output will be formatted according to outmode (if you want to output a raw string use the write method instead).

PStreamoperator<< (const string &x)
 Warning: string output will be formatted according to outmode (if you want to output a raw string use the write method instead) (unless you're in raw_ascii or raw_binary mode!).

PStreamoperator<< (char x)
PStreamoperator<< (signed char x)
PStreamoperator<< (unsigned char x)
PStreamoperator<< (int x)
PStreamoperator<< (unsigned int x)
PStreamoperator<< (long x)
PStreamoperator<< (unsigned long x)
PStreamoperator<< (short x)
PStreamoperator<< (unsigned short x)
PStreamoperator<< (pl_pstream_manip func)
pl_streambufpl_rdbuf ()
 DEPRECATED: TO BE REMOVED SOON, DO NOT USE!


Public Attributes

mode_t inmode
map< unsigned int, void * > copies_map_in
mode_t outmode
map< void *, unsigned intcopies_map_out
bool implicit_storage
 If true, then Mat and Vec will be serialized with their elements in place, If false, they will have an explicit pointer to a storage.

compr_mode_t compression_mode
 Determines the way data is compressed, if any.


Protected Attributes

PP< StdPStreamBufpstreambuf

Static Private Attributes

char tmpbuf [100]

Detailed Description

PStream: This class defines a type of stream that should be used for all I/O within PLearn. It supports most operations available for standard c++ streams, plus:

Definition at line 79 of file PStream.h.


Member Typedef Documentation

typedef ios PLearn::PStream::ios_base
 

Definition at line 95 of file PStream.h.

typedef PStream&(* PLearn::PStream::pl_pstream_manip)(PStream &)
 

typedef's for PStream manipulators

Definition at line 83 of file PStream.h.

Referenced by operator>>().

typedef int PLearn::PStream::streamsize
 

typedef's for compatibility w/ old libraries

Definition at line 94 of file PStream.h.

Referenced by readUntil().


Member Enumeration Documentation

enum PLearn::PStream::compr_mode_t
 

Compression mode (mostly used by binary serialization of sequences of floats or doubles, such as TMat<real>) (Used on output only; autodetect on read).

Enumeration values:
compr_none 
compr_double_as_float 
compr_sparse 
compr_lossy_sparse 

Definition at line 112 of file PStream.h.

enum PLearn::PStream::mode_t
 

Enumeration values:
plearn_ascii 
plearn_binary 
raw_ascii 
raw_binary 
pretty_ascii 

Definition at line 98 of file PStream.h.


Constructor & Destructor Documentation

PLearn::PStream::PStream  ) 
 

default ctor: the stream is unusable ...

Definition at line 72 of file PStream.cc.

PLearn::PStream::PStream istream *  pin_,
bool  own_pin_ = false
 

ctor. from an istream (I)

Definition at line 79 of file PStream.cc.

PLearn::PStream::PStream ostream *  pout_,
bool  own_pout_ = false
 

ctor. from an ostream (O)

Definition at line 87 of file PStream.cc.

PLearn::PStream::PStream iostream pios_,
bool  own_pios_ = false
 

ctor. from an iostream (IO)

Definition at line 95 of file PStream.cc.

PLearn::PStream::PStream istream *  pin_,
ostream *  pout_,
bool  own_pin_ = false,
bool  own_pout_ = false
 

ctor. from an istream and an ostream (IO)

Definition at line 103 of file PStream.cc.

PLearn::PStream::~PStream  )  [virtual]
 

dtor.

Definition at line 111 of file PStream.cc.


Member Function Documentation

istream& PLearn::PStream::_do_not_use_this_method_rawin_  )  [inline]
 

Definition at line 246 of file PStream.h.

References pstreambuf.

Referenced by PLearn::readObject().

void PLearn::PStream::attach int  fd  )  [inline]
 

attach this stream to a POSIX file descriptor.

Definition at line 412 of file PStream.h.

References attach(), and pstreambuf.

Referenced by attach(), PLearn::IPopen::establish_communication(), PLearn::GhostScript::GhostScript(), PLearn::Gnuplot::Gnuplot(), and PLearn::Popen::launch().

PStream& PLearn::PStream::endl  )  [inline]
 

Definition at line 392 of file PStream.h.

References flush().

Referenced by PLearn::endl(), and printobj().

bool PLearn::PStream::eof  )  const [inline]
 

Definition at line 243 of file PStream.h.

References pstreambuf.

Referenced by PLearn::MatlabInterface::launchAndWaitFor(), and PLearn::readSequence().

PStream& PLearn::PStream::flush  )  [inline]
 

Definition at line 382 of file PStream.h.

References pstreambuf.

Referenced by PLearn::TextProgressBarPlugin::addProgressBar(), endl(), PLearn::flush(), PLearn::Gnuplot::flush(), PLearn::GhostScript::flush(), PLearn::RowMapSparseMatrix< real >::transposeProduct(), and PLearn::TextProgressBarPlugin::update().

PStream& PLearn::PStream::get char &  c  )  [inline]
 

Definition at line 260 of file PStream.h.

References pstreambuf.

int PLearn::PStream::get  )  [inline]
 

Definition at line 251 of file PStream.h.

References pstreambuf.

Referenced by PLearn::binread_(), PLearn::getDatasetAliases(), getline(), main(), PLearn::Object::newread(), operator>>(), PLearn::operator>>(), PLearn::plotVMats(), PLearn::TVec< pair< real, real > >::read(), PLearn::TMat< pair< real, real > >::read(), PLearn::SmoothedProbSparseMatrix::read(), PLearn::RealMapping::read(), read(), PLearn::DoubleAccessSparseMatrix< T >::read(), readAsciiNum(), PLearn::readMap(), PLearn::readObject(), PLearn::readSequence(), PLearn::readSet(), readUntil(), skipAll(), skipBlanks(), skipBlanksAndComments(), skipBlanksAndCommentsAndSeparators(), skipRestOfLine(), and smartReadUntilNext().

string PLearn::PStream::getline  )  [inline]
 

Definition at line 284 of file PStream.h.

PStream& PLearn::PStream::getline string line,
char  delimitor = '\n'
[inline]
 

Delimitor is read from stream but not appended to string.

Definition at line 271 of file PStream.h.

References get(), and pstreambuf.

Referenced by PLearn::execute(), PLearn::Object::newread(), and PLearn::readObject().

bool PLearn::PStream::good  )  const [inline]
 

Definition at line 244 of file PStream.h.

References pstreambuf.

PLearn::PStream::operator bool  )  [inline]
 

op bool: true if the stream is in a valid state (e.g. "while(stm) stm >> x;")

Definition at line 241 of file PStream.h.

References pstreambuf.

PStream& PLearn::PStream::operator() const PStream pios  )  [inline]
 

Definition at line 207 of file PStream.h.

References operator()(), and operator=().

PStream& PLearn::PStream::operator() istream *  pin,
ostream *  pout
[inline]
 

Definition at line 198 of file PStream.h.

References operator()(), and pstreambuf.

PStream& PLearn::PStream::operator() iostream pios  )  [inline]
 

Definition at line 195 of file PStream.h.

References operator()(), and pstreambuf.

PStream& PLearn::PStream::operator() ostream *  pout  )  [inline]
 

Definition at line 192 of file PStream.h.

References operator()(), and pstreambuf.

PStream& PLearn::PStream::operator() istream *  pin  )  [inline]
 

Definition at line 189 of file PStream.h.

References operator()(), and pstreambuf.

Referenced by operator()(), and operator=().

PStream& PLearn::PStream::operator<< pl_pstream_manip  func  )  [inline]
 

Definition at line 481 of file PStream.h.

PStream & PLearn::PStream::operator<< unsigned short  x  ) 
 

Definition at line 1275 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< short  x  ) 
 

Definition at line 1247 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< unsigned long  x  ) 
 

Definition at line 1219 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< long  x  ) 
 

Definition at line 1191 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< unsigned int  x  ) 
 

Definition at line 1163 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< int  x  ) 
 

Definition at line 1135 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< unsigned char  x  ) 
 

Definition at line 1065 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, and x.

PStream & PLearn::PStream::operator<< signed char  x  ) 
 

Definition at line 1059 of file PStream.cc.

References PLearn::operator<<(), and x.

PStream & PLearn::PStream::operator<< char  x  ) 
 

Definition at line 1033 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, and x.

PStream & PLearn::PStream::operator<< const string x  ) 
 

Warning: string output will be formatted according to outmode (if you want to output a raw string use the write method instead) (unless you're in raw_ascii or raw_binary mode!).

Definition at line 1128 of file PStream.cc.

References PLearn::operator<<(), and x.

PStream & PLearn::PStream::operator<< const char *  x  ) 
 

Warning: string output will be formatted according to outmode (if you want to output a raw string use the write method instead).

Definition at line 1094 of file PStream.cc.

References outmode, PLERROR, put(), PLearn::strlen(), PLearn::write(), and x.

PStream & PLearn::PStream::operator<< double  x  ) 
 

Definition at line 1331 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream & PLearn::PStream::operator<< float  x  ) 
 

Definition at line 1303 of file PStream.cc.

References outmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, put(), raw_ascii, raw_binary, PLearn::write(), writeAsciiNum(), and x.

PStream& PLearn::PStream::operator<< mode_t  m  )  [inline]
 

Definition at line 185 of file PStream.h.

References outmode.

PStream& PLearn::PStream::operator= iostream pios  )  [inline]
 

Definition at line 205 of file PStream.h.

References operator()(), and operator=().

PStream& PLearn::PStream::operator= ostream *  pout  )  [inline]
 

Definition at line 204 of file PStream.h.

References operator()(), and operator=().

PStream& PLearn::PStream::operator= istream *  pin  )  [inline]
 

Definition at line 203 of file PStream.h.

References operator()(), and operator=().

PStream & PLearn::PStream::operator= const PStream pios  ) 
 

Definition at line 473 of file PStream.cc.

References compression_mode, implicit_storage, inmode, outmode, and pstreambuf.

Referenced by operator()(), and operator=().

PStream& PLearn::PStream::operator>> pl_pstream_manip  func  )  [inline]
 

Definition at line 457 of file PStream.h.

References pl_pstream_manip.

PStream & PLearn::PStream::operator>> unsigned short &  x  ) 
 

Definition at line 886 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> short &  x  ) 
 

Definition at line 848 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> unsigned long &  x  ) 
 

Definition at line 810 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> long &  x  ) 
 

Definition at line 772 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> unsigned int x  ) 
 

Definition at line 734 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> int x  ) 
 

Definition at line 696 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> unsigned char &  x  ) 
 

Definition at line 527 of file PStream.cc.

References get(), inmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, raw_ascii, raw_binary, PLearn::read(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> signed char &  x  ) 
 

Definition at line 519 of file PStream.cc.

References PLearn::operator>>(), and x.

PStream & PLearn::PStream::operator>> char &  x  ) 
 

Definition at line 488 of file PStream.cc.

References get(), inmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, raw_ascii, raw_binary, skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> char *  x  ) 
 

Definition at line 562 of file PStream.cc.

References get(), inmode, peek(), PLERROR, putback(), skipBlanksAndComments(), and x.

PStream & PLearn::PStream::operator>> string x  ) 
 

Definition at line 632 of file PStream.cc.

References get(), inmode, peek(), PLERROR, putback(), skipBlanksAndComments(), and x.

PStream & PLearn::PStream::operator>> double &  x  ) 
 

Definition at line 992 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> float &  x  ) 
 

Definition at line 954 of file PStream.cc.

References BIG_ENDIAN_ORDER, PLearn::byte_order(), PLearn::endianswap(), get(), inmode, LITTLE_ENDIAN_ORDER, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, putback(), raw_ascii, raw_binary, PLearn::read(), readAsciiNum(), skipBlanks(), skipBlanksAndCommentsAndSeparators(), and x.

PStream & PLearn::PStream::operator>> bool x  ) 
 

Definition at line 924 of file PStream.cc.

References get(), inmode, plearn_ascii, plearn_binary, PLERROR, pretty_ascii, raw_ascii, raw_binary, skipBlanksAndCommentsAndSeparators(), and x.

PStream& PLearn::PStream::operator>> mode_t  m  )  [inline]
 

Definition at line 184 of file PStream.h.

References inmode.

int PLearn::PStream::peek  )  [inline]
 

Definition at line 290 of file PStream.h.

References pstreambuf.

Referenced by PLearn::Object::newread(), operator>>(), PLearn::operator>>(), PLearn::TVec< pair< real, real > >::read(), PLearn::TMat< pair< real, real > >::read(), PLearn::Object::read(), PLearn::readMap(), PLearn::readObject(), PLearn::readSequence(), and PLearn::readSet().

pl_streambuf* PLearn::PStream::pl_rdbuf  )  [inline]
 

DEPRECATED: TO BE REMOVED SOON, DO NOT USE!

Definition at line 486 of file PStream.h.

Referenced by PLearn::readObject().

PStream& PLearn::PStream::put int  x  )  [inline]
 

Definition at line 380 of file PStream.h.

References x.

PStream& PLearn::PStream::put unsigned char  c  )  [inline]
 

Definition at line 379 of file PStream.h.

References PLearn::write().

PStream& PLearn::PStream::put char  c  )  [inline]
 

Definition at line 370 of file PStream.h.

References pstreambuf, and put().

Referenced by PLearn::binwrite_(), PLearn::operator<<(), operator<<(), put(), PLearn::TMat< pair< real, real > >::write(), writeAsciiHexNum(), PLearn::GhostScript::writeBitmapHexString1Bit(), PLearn::writeMap(), PLearn::writeSequence(), and PLearn::writeSet().

PStream& PLearn::PStream::putback char  c  )  [inline]
 

Definition at line 301 of file PStream.h.

References pstreambuf, and putback().

Referenced by operator>>(), putback(), readAsciiNum(), readUntil(), skipAll(), skipBlanks(), skipBlanksAndComments(), and skipBlanksAndCommentsAndSeparators().

PStream& PLearn::PStream::read string s,
streamsize  n
[inline]
 

Definition at line 339 of file PStream.h.

References PLearn::read().

PStream& PLearn::PStream::read char *  s,
streamsize  n
[inline]
 

Definition at line 318 of file PStream.h.

References get(), and pstreambuf.

Referenced by PLearn::binread_(), main(), PLearn::TMat< pair< real, real > >::read(), and PLearn::readSequence().

void PLearn::PStream::readAsciiNum double &  x  ) 
 

Definition at line 433 of file PStream.cc.

References get(), MISSING_VALUE, PLERROR, putback(), skipBlanks(), tmpbuf, and x.

void PLearn::PStream::readAsciiNum float &  x  ) 
 

Definition at line 426 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum unsigned long &  x  ) 
 

Definition at line 413 of file PStream.cc.

References get(), putback(), skipBlanks(), and x.

void PLearn::PStream::readAsciiNum long &  x  ) 
 

Definition at line 390 of file PStream.cc.

References get(), putback(), skipBlanks(), and x.

void PLearn::PStream::readAsciiNum unsigned int x  ) 
 

Definition at line 383 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum int x  ) 
 

Definition at line 376 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum unsigned short &  x  ) 
 

Definition at line 369 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum short &  x  ) 
 

Definition at line 362 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum signed char &  x  ) 
 

Definition at line 355 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum unsigned char &  x  ) 
 

Definition at line 348 of file PStream.cc.

References readAsciiNum(), and x.

void PLearn::PStream::readAsciiNum char &  x  ) 
 

Definition at line 341 of file PStream.cc.

References readAsciiNum(), and x.

Referenced by operator>>(), and readAsciiNum().

streamsize PLearn::PStream::readUntil char *  buf,
streamsize  n,
const char *  stop_chars
 

Reads characters into buf until n characters have been read, or end-of-file has been reached, or the next character in the stream is one of the stop_chars (null terminated string) Returns the total number of characters put into buf.

The stopping character met is not extracted from the stream.

Definition at line 136 of file PStream.cc.

References get(), and putback().

streamsize PLearn::PStream::readUntil char *  buf,
streamsize  n,
char  stop_char
 

Reads characters into buf until n characters have been read, or end-of-file has been reached, or the next character in the stream is the stop_char.

Returns the total number of characters put into buf. The stopping character met is not extracted from the stream.

Definition at line 115 of file PStream.cc.

References get(), putback(), and streamsize.

void PLearn::PStream::setInMode mode_t  m  )  [inline]
 

Definition at line 180 of file PStream.h.

References inmode, and setInMode().

Referenced by setInMode().

void PLearn::PStream::setMode mode_t  m  )  [inline]
 

Definition at line 182 of file PStream.h.

References inmode, outmode, and setMode().

Referenced by setMode().

void PLearn::PStream::setOutMode mode_t  m  )  [inline]
 

Definition at line 181 of file PStream.h.

References outmode, and setOutMode().

Referenced by setOutMode().

void PLearn::PStream::skipAll const char *  chars_to_skip  ) 
 

skips all occurences of any of the given characters

Definition at line 200 of file PStream.cc.

References get(), and putback().

void PLearn::PStream::skipBlanks  ) 
 

skips any blanks (space, tab, newline)

Definition at line 217 of file PStream.cc.

References get(), and putback().

Referenced by operator>>(), readAsciiNum(), and PLearn::readSequence().

void PLearn::PStream::skipBlanksAndComments  ) 
 

skips any blanks (space, tab, newline) and comments starting with #

Definition at line 226 of file PStream.cc.

References get(), putback(), and skipRestOfLine().

Referenced by PLearn::Object::newread(), PLearn::operator>>(), operator>>(), PLearn::TVec< pair< real, real > >::read(), PLearn::TMat< pair< real, real > >::read(), PLearn::readSequence(), and PLearn::ws().

void PLearn::PStream::skipBlanksAndCommentsAndSeparators  ) 
 

skips any blanks, # comments, and separators (',' and ';')

Definition at line 241 of file PStream.cc.

References get(), putback(), and skipRestOfLine().

Referenced by PLearn::Object::newread(), operator>>(), PLearn::operator>>(), PLearn::TVec< pair< real, real > >::read(), PLearn::TMat< pair< real, real > >::read(), PLearn::SmoothedProbSparseMatrix::read(), PLearn::DoubleAccessSparseMatrix< T >::read(), PLearn::readMap(), PLearn::readObject(), PLearn::readSequence(), PLearn::readSet(), and PLearn::RunCommand::run().

void PLearn::PStream::skipRestOfLine  ) 
 

reads everything until '
' (also consumes the '
')

Definition at line 210 of file PStream.cc.

References get().

Referenced by skipBlanksAndComments(), skipBlanksAndCommentsAndSeparators(), and smartReadUntilNext().

int PLearn::PStream::smartReadUntilNext const string stoppingsymbols,
string characters_read,
bool  ignore_brackets = false
 

Reads characters from stream, until we meet one of the stopping symbols at the current "level".

i.e. any opening parenthesis, bracket, brace or quote will open a next level and we'll be back to the current level only *after* we meet the corresponding closing parenthesis, bracket, brace or quote. All characters read, except the stoppingsymbol, will be *appended* to characters_read The stoppingsymbol is read and returned, but not appended to characters_read. Comments starting with # until the end of line are skipped (as if they were not part of the stream)

Definition at line 157 of file PStream.cc.

References get(), skipRestOfLine(), and PLearn::smartReadUntilNext().

Referenced by PLearn::VecStatsCollector::getStat(), PLearn::LiftStatsCollector::getStat(), PLearn::Option< DeallocatorType, self >::read_and_discard(), and PLearn::smartReadUntilNext().

PStream& PLearn::PStream::unget  )  [inline]
 

Definition at line 314 of file PStream.h.

References pstreambuf.

Referenced by PLearn::Object::newread(), and PLearn::Option< DeallocatorType, self >::read_and_discard().

PStream& PLearn::PStream::write const string s  )  [inline]
 

Definition at line 402 of file PStream.h.

References PLearn::write().

PStream& PLearn::PStream::write const char *  s  )  [inline]
 

Definition at line 396 of file PStream.h.

References PLearn::strlen(), and PLearn::write().

PStream& PLearn::PStream::write const char *  s,
streamsize  n
[inline]
 

Definition at line 360 of file PStream.h.

References pstreambuf.

Referenced by PLearn::binwrite_(), PLearn::Object::newwrite(), PLearn::operator<<(), PLearn::TVec< pair< real, real > >::write(), PLearn::TMat< pair< real, real > >::write(), PLearn::SmoothedProbSparseMatrix::write(), PLearn::DoubleAccessSparseMatrix< T >::write(), PLearn::writeMap(), PLearn::writeSequence(), and PLearn::writeSet().

void PLearn::PStream::writeAsciiHexNum unsigned char  x  ) 
 

Writes the corresponding 2 hex digits (ex: 0A ).

Definition at line 256 of file PStream.cc.

References put(), and x.

Referenced by PLearn::GhostScript::writeBitmapHexString1Bit(), PLearn::GhostScript::writeBitmapHexString24Bits(), and PLearn::GhostScript::writeBitmapHexString8Bits().

void PLearn::PStream::writeAsciiNum double  x  ) 
 

Definition at line 330 of file PStream.cc.

References PLearn::is_missing(), PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum float  x  ) 
 

Definition at line 319 of file PStream.cc.

References PLearn::is_missing(), PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum unsigned long  x  ) 
 

Definition at line 313 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum long  x  ) 
 

Definition at line 307 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum unsigned int  x  ) 
 

Definition at line 301 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum int  x  ) 
 

Definition at line 295 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum unsigned short  x  ) 
 

Definition at line 289 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum short  x  ) 
 

Definition at line 283 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum signed char  x  ) 
 

Definition at line 277 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum unsigned char  x  ) 
 

Definition at line 271 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

void PLearn::PStream::writeAsciiNum char  x  ) 
 

Definition at line 265 of file PStream.cc.

References PLearn::strlen(), tmpbuf, PLearn::write(), and x.

Referenced by operator<<().


Member Data Documentation

compr_mode_t PLearn::PStream::compression_mode
 

Determines the way data is compressed, if any.

Definition at line 156 of file PStream.h.

Referenced by operator=().

map<unsigned int, void *> PLearn::PStream::copies_map_in
 

Definition at line 136 of file PStream.h.

Referenced by PLearn::operator>>(), and PLearn::readObject().

map<void *, unsigned int> PLearn::PStream::copies_map_out
 

Definition at line 139 of file PStream.h.

Referenced by PLearn::operator<<().

bool PLearn::PStream::implicit_storage
 

If true, then Mat and Vec will be serialized with their elements in place, If false, they will have an explicit pointer to a storage.

Definition at line 154 of file PStream.h.

Referenced by operator=(), PLearn::TVec< pair< real, real > >::write(), and PLearn::TMat< pair< real, real > >::write().

mode_t PLearn::PStream::inmode
 

Definition at line 134 of file PStream.h.

Referenced by operator=(), operator>>(), PLearn::TVec< pair< real, real > >::read(), PLearn::TMat< pair< real, real > >::read(), PLearn::SmoothedProbSparseMatrix::read(), PLearn::DoubleAccessSparseMatrix< T >::read(), PLearn::readSequence(), setInMode(), and setMode().

mode_t PLearn::PStream::outmode
 

Definition at line 137 of file PStream.h.

Referenced by PLearn::binwrite_(), PLearn::Learner::default_vlog(), PLearn::GhostScript::GhostScript(), PLearn::Gnuplot::Gnuplot(), PLearn::operator<<(), operator<<(), operator=(), setMode(), setOutMode(), PLearn::TextProgressBarPlugin::TextProgressBarPlugin(), PLearn::TVec< pair< real, real > >::write(), PLearn::TMat< pair< real, real > >::write(), PLearn::SmoothedProbSparseMatrix::write(), PLearn::DoubleAccessSparseMatrix< T >::write(), and PLearn::writeSequence().

PP<StdPStreamBuf> PLearn::PStream::pstreambuf [protected]
 

Definition at line 130 of file PStream.h.

Referenced by _do_not_use_this_method_rawin_(), attach(), eof(), flush(), get(), getline(), good(), operator bool(), operator()(), operator=(), peek(), put(), putback(), read(), unget(), and write().

char PLearn::PStream::tmpbuf [static, private]
 

Definition at line 50 of file PStream.cc.

Referenced by readAsciiNum(), and writeAsciiNum().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:13 2004 for PLearn by doxygen 1.3.7