OpenFOAM logo
Open Source CFD Toolkit

IOstream Class Reference

Inheritance diagram for IOstream:

Inheritance graph
[legend]
Collaboration diagram for IOstream:

Collaboration graph
[legend]
List of all members.

Public Types

enum  streamAccess { OPENED, CLOSED }
 Enumeration for whether the stream open or closed. More...
enum  streamFormat { ASCII, BINARY }
 Enumeration for the format of data in the stream. More...
enum  compressionType { UNCOMPRESSED, COMPRESSED }
 Enumeration for the format of data in the stream. More...

Public Member Functions

 IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED)
 Construct setting format and version.
virtual ~IOstream ()
virtual const fileNamename () const
 Return the name of the stream.
virtual fileNamename ()
 Return non-const access to the name of the stream.
virtual bool check (const char *operation) const
 Check IOstream status for given operation.
void fatalCheck (const char *operation) const
 Check IOstream status for given operation.
bool opened () const
 Return true if stream has been opened.
bool closed () const
 Return true if stream is closed.
bool good () const
 Return true if next operation might succeed.
bool eof () const
 Return true if end of input seen.
bool fail () const
 Return true if next operation will fail.
bool bad () const
 Return true if stream is corrupted.
 operator void * () const
 Return non-zero if the stream has not failed.
bool operator! () const
 Return true if the stream has failed.
streamFormat format () const
 Return current stream format.
versionNumber version () const
 Return current stream version.
compressionType compression () const
 Return current compression.
label lineNumber () const
 Return current stream line number.
virtual ios::fmtflags flags () const =0
 Return flags of stream.
labellineNumber ()
 Return current stream line number.
void set (const streamFormat fmt)
 Set the stream format.
void setFormat (const word &fmt)
 Set the stream format from word.
void set (const versionNumber version)
 Reset stream version.
void setVersion (const versionNumber version)
 Reset stream version.
void setCompression (const compressionType compression)
 Reset stream compression.
void setEof ()
 Set stream to have reached eof.
void setFail ()
 Set stream to have failed.
void setBad ()
 Set stream to be bad.
virtual ios::fmtflags flags (const ios::fmtflags f)=0
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f)
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f, const ios::fmtflags mask)
 Set flags of given field of stream.
void unsetf (const ios::fmtflags uf)
 Unset flags of stream.
virtual void print (Ostream &) const
 Print description of IOstream to Ostream.
void print (Ostream &, const int streamState) const
 Check given stream state bits.
InfoProxy< IOstreaminfo () const
 Return info proxy.

Static Public Member Functions

streamFormat format (const word &)
 Return stream format of given format name.
compressionType compression (const word &)
 Return compression of given compression name.
unsigned int defaultPrecision ()
 Return the default precision.
unsigned int defaultPrecision (unsigned int p)
 Reset the default precision (and return old precision).

Static Public Attributes

const versionNumber originalVersion
 Original version number.
const versionNumber currentVersion
 Current version number.
unsigned int precision_
 Default precision.

Protected Member Functions

void setOpened ()
 Set stream opened.
void setClosed ()
 Set stream closed.
void setState (ios::iostate state)
 Set stream state.
void setGood ()
 Set stream to be good.

Protected Attributes

label lineNumber_

Friends

Ostreamoperator<< (Ostream &os, const streamFormat &sf)
 Ostream operator.

Member Enumeration Documentation

enum compressionType
 

Enumeration for the format of data in the stream.

Enumeration values:
UNCOMPRESSED 
COMPRESSED 

Definition at line 206 of file IOstream.H.

enum streamAccess
 

Enumeration for whether the stream open or closed.

Enumeration values:
OPENED 
CLOSED 

Definition at line 92 of file IOstream.H.

enum streamFormat
 

Enumeration for the format of data in the stream.

Enumeration values:
ASCII 
BINARY 

Definition at line 99 of file IOstream.H.


Constructor & Destructor Documentation

IOstream streamFormat  format,
versionNumber  version,
compressionType  compression = UNCOMPRESSED
[inline]
 

Construct setting format and version.

Definition at line 282 of file IOstream.H.

virtual ~IOstream  )  [inline, virtual]
 

Definition at line 301 of file IOstream.H.


Member Function Documentation

bool bad  )  const [inline]
 

Return true if stream is corrupted.

Definition at line 373 of file IOstream.H.

virtual bool check const char *  operation  )  const [virtual]
 

Check IOstream status for given operation.

print IOstream state if error has occured

Referenced by pyramid::pyramid().

bool closed  )  const [inline]
 

Return true if stream is closed.

Definition at line 349 of file IOstream.H.

compressionType compression  )  const [inline]
 

Return current compression.

Definition at line 414 of file IOstream.H.

References Foam::label.

compressionType compression const word  )  [static]
 

Return compression of given compression name.

unsigned int defaultPrecision unsigned int  p  )  [inline, static]
 

Reset the default precision (and return old precision).

Definition at line 444 of file IOstream.H.

unsigned int defaultPrecision  )  [inline, static]
 

Return the default precision.

Definition at line 438 of file IOstream.H.

bool eof  )  const [inline]
 

Return true if end of input seen.

Definition at line 361 of file IOstream.H.

Referenced by gaussGrad::gaussGrad(), and laplacianScheme::laplacianScheme().

bool fail  )  const [inline]
 

Return true if next operation will fail.

Definition at line 367 of file IOstream.H.

void fatalCheck const char *  operation  )  const
 

Check IOstream status for given operation.

print IOstream state if error has occured and exit

virtual ios ::fmtflags flags const ios::fmtflags  f  )  [pure virtual]
 

Set flags of stream.

virtual ios ::fmtflags flags  )  const [pure virtual]
 

Return flags of stream.

Implemented in IPstream, OPstream, ISstream, OSstream, and ITstream.

streamFormat format  )  const [inline]
 

Return current stream format.

Definition at line 399 of file IOstream.H.

streamFormat format const word  )  [static]
 

Return stream format of given format name.

bool good  )  const [inline]
 

Return true if next operation might succeed.

Definition at line 355 of file IOstream.H.

InfoProxy<IOstream> info  )  const [inline]
 

Return info proxy.

Used to print IOstream information to a stream

Reimplemented in primitiveEntry.

Definition at line 540 of file IOstream.H.

label& lineNumber  )  [inline]
 

Return current stream line number.

Definition at line 432 of file IOstream.H.

label lineNumber  )  const [inline]
 

Return current stream line number.

Definition at line 420 of file IOstream.H.

virtual fileName& name  )  [inline, virtual]
 

Return non-const access to the name of the stream.

Useful to alter the stream name

Reimplemented in primitiveEntry, IFstream, OFstream, ISstream, OSstream, and ITstream.

Definition at line 322 of file IOstream.H.

virtual const fileName& name  )  const [inline, virtual]
 

Return the name of the stream.

Useful for Fstream to return the filename

Reimplemented in primitiveEntry, IFstream, OFstream, ISstream, OSstream, and ITstream.

Definition at line 313 of file IOstream.H.

bool opened  )  const [inline]
 

Return true if stream has been opened.

Definition at line 343 of file IOstream.H.

operator void *  )  const [inline]
 

Return non-zero if the stream has not failed.

Definition at line 379 of file IOstream.H.

bool operator!  )  const [inline]
 

Return true if the stream has failed.

Definition at line 387 of file IOstream.H.

void print Ostream ,
const int  streamState
const
 

Check given stream state bits.

virtual void print Ostream  )  const [virtual]
 

Print description of IOstream to Ostream.

Reimplemented in IFstream, OFstream, IPstream, OPstream, ISstream, OSstream, prefixOSstream, IStringStream, OStringStream, and ITstream.

void set const versionNumber  version  )  [inline]
 

Reset stream version.

Definition at line 464 of file IOstream.H.

void set const streamFormat  fmt  )  [inline]
 

Set the stream format.

Definition at line 452 of file IOstream.H.

void setBad  )  [inline]
 

Set stream to be bad.

Definition at line 494 of file IOstream.H.

References Foam::setf().

Referenced by ISstream::putback().

Here is the call graph for this function:

void setClosed  )  [inline, protected]
 

Set stream closed.

Definition at line 258 of file IOstream.H.

void setCompression const compressionType  compression  )  [inline]
 

Reset stream compression.

Definition at line 476 of file IOstream.H.

void setEof  )  [inline]
 

Set stream to have reached eof.

Definition at line 482 of file IOstream.H.

ios ::fmtflags setf const ios::fmtflags  f,
const ios::fmtflags  mask
[inline]
 

Set flags of given field of stream.

Definition at line 510 of file IOstream.H.

ios ::fmtflags setf const ios::fmtflags  f  )  [inline]
 

Set flags of stream.

Definition at line 503 of file IOstream.H.

Referenced by Foam::dec(), Foam::hex(), and Foam::operator<<().

void setFail  )  [inline]
 

Set stream to have failed.

Definition at line 488 of file IOstream.H.

void setFormat const word fmt  )  [inline]
 

Set the stream format from word.

Definition at line 458 of file IOstream.H.

void setGood  )  [inline, protected]
 

Set stream to be good.

Definition at line 270 of file IOstream.H.

void setOpened  )  [inline, protected]
 

Set stream opened.

Definition at line 252 of file IOstream.H.

void setState ios::iostate  state  )  [inline, protected]
 

Set stream state.

Definition at line 264 of file IOstream.H.

void setVersion const versionNumber  version  )  [inline]
 

Reset stream version.

Definition at line 470 of file IOstream.H.

void unsetf const ios::fmtflags  uf  )  [inline]
 

Unset flags of stream.

Definition at line 519 of file IOstream.H.

versionNumber version  )  const [inline]
 

Return current stream version.

Definition at line 405 of file IOstream.H.

References Foam::label.

Referenced by face::prevLabel().


Friends And Related Function Documentation

Ostream& operator<< Ostream os,
const streamFormat sf
[friend]
 

Ostream operator.


Member Data Documentation

const versionNumber currentVersion [static]
 

Current version number.

Definition at line 219 of file IOstream.H.

label lineNumber_ [protected]
 

Definition at line 244 of file IOstream.H.

const versionNumber originalVersion [static]
 

Original version number.

Definition at line 216 of file IOstream.H.

unsigned int precision_ [static]
 

Default precision.

Definition at line 222 of file IOstream.H.


The documentation for this class was generated from the following file:
For further information go to www.openfoam.org