www.cemf.ir
IOstream Class Referenceabstract
+ Inheritance diagram for IOstream:

Public Types

enum  streamAccess : char { CLOSED = 0, OPENED }
 
enum  writeFormat : char { ASCII = 0, BINARY }
 

Public Member Functions

 IOstream ()
 Default. More...
 
 IOstream (writeFormat wF)
 Construct and set write format. More...
 
 IOstream (const IOstream &)=default
 Copy. More...
 
virtual ~IOstream ()=default
 Destructor. More...
 
virtual const wordname () const
 Return the name of the stream. More...
 
virtual wordname ()
 Return non-const access to the name of the stream. More...
 
virtual bool check (const char *operation) const
 Check IOstream status for given operation. More...
 
bool fatalCheck (const char *operation) const
 Check IOstream status for given operation. More...
 
bool opened () const
 Return true if stream has been opened. More...
 
bool closed () const
 Return true if stream is closed. More...
 
bool isBinary () const
 Return true if stream format is binray. More...
 
bool good () const
 Return true if next operation might succeed. More...
 
bool eof () const
 Return true if end of input seen. More...
 
bool fail () const
 Return true if next operation will fail. More...
 
bool bad () const
 Return true if stream is corrupted. More...
 
 operator bool () const
 Return true if the stream has not failed. More...
 
bool operator! () const
 Return true if the stream has failed. More...
 
int32 lineNumber () const
 Const access to the current stream line number. More...
 
int32lineNumber ()
 Non-const access to the current stream line number. More...
 
int32 lineNumber (const int32 num)
 Set the stream line number return the previous value. More...
 
virtual ios_base::fmtflags flags () const =0
 Return flags of stream. More...
 
void setEof ()
 Set stream to have reached eof. More...
 
void setFail ()
 Set stream to have failed. More...
 
void setBad ()
 Set stream to be bad. More...
 
virtual ios_base::fmtflags flags (const ios_base::fmtflags f)=0
 Set flags of stream. More...
 
ios_base::fmtflags setf (const ios_base::fmtflags f)
 Set flags of stream. More...
 
ios_base::fmtflags setf (const ios_base::fmtflags f, const ios_base::fmtflags mask)
 Set flags of given field of stream. More...
 
void unsetf (const ios_base::fmtflags f)
 Unset flags of stream. More...
 

Static Public Member Functions

static unsigned int defaultPrecision ()
 Return the default precision. More...
 
static unsigned int defaultPrecision (unsigned int prec)
 Reset the default precision return the previous value. More...
 

Static Public Attributes

static unsigned int precision_ = 6
 Default precision, only works for ASCII. More...
 

Protected Member Functions

void setOpened ()
 Set stream opened. More...
 
void setClosed ()
 Set stream closed. More...
 
void setState (ios_base::iostate state)
 Set stream state. More...
 
void setWriteFormat (writeFormat wF)
 
void setGood ()
 Set stream to be good. More...
 

Protected Attributes

streamAccess openClosed_
 Is stream open or closed. More...
 
writeFormat writeFormat_ = ASCII
 write format More...
 
ios_base::iostate ioState_
 state More...
 
int32 lineNumber_
 The file line. More...
 

Static Protected Attributes

static word staticName_
 Name for any generic stream - normally treat as readonly. More...
 

Detailed Description

Definition at line 45 of file IOstream.hpp.

Member Enumeration Documentation

◆ streamAccess

enum streamAccess : char
Enumerator
CLOSED 
OPENED 

stream is not open

stream is open

Definition at line 51 of file IOstream.hpp.

◆ writeFormat

enum writeFormat : char
Enumerator
ASCII 
BINARY 

Definition at line 57 of file IOstream.hpp.

Constructor & Destructor Documentation

◆ IOstream() [1/3]

IOstream ( )
inlineexplicit

Default.

Definition at line 121 of file IOstream.hpp.

References IOstream::setBad().

+ Here is the call graph for this function:

◆ IOstream() [2/3]

IOstream ( writeFormat  wF)
inlineexplicit

Construct and set write format.

Definition at line 131 of file IOstream.hpp.

References IOstream::setBad().

+ Here is the call graph for this function:

◆ IOstream() [3/3]

IOstream ( const IOstream )
default

Copy.

◆ ~IOstream()

virtual ~IOstream ( )
virtualdefault

Destructor.

Member Function Documentation

◆ setOpened()

void setOpened ( )
inlineprotected

Set stream opened.

Definition at line 88 of file IOstream.hpp.

References IOstream::openClosed_, and IOstream::OPENED.

◆ setClosed()

void setClosed ( )
inlineprotected

Set stream closed.

Definition at line 94 of file IOstream.hpp.

References IOstream::CLOSED, and IOstream::openClosed_.

◆ setState()

void setState ( ios_base::iostate  state)
inlineprotected

Set stream state.

Definition at line 100 of file IOstream.hpp.

References IOstream::ioState_.

◆ setWriteFormat()

void setWriteFormat ( writeFormat  wF)
inlineprotected

Definition at line 105 of file IOstream.hpp.

References IOstream::writeFormat_.

◆ setGood()

void setGood ( )
inlineprotected

Set stream to be good.

Definition at line 111 of file IOstream.hpp.

References IOstream::ioState_.

◆ name() [1/2]

◆ name() [2/2]

virtual word& name ( )
virtual

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

Reimplemented in iTstream, Istream, and Ostream.

◆ check()

bool check ( const char *  operation) const
virtual

Check IOstream status for given operation.

Print IOstream state or generate a FatalIOError when an error has occurred. The base implementation is a fatalCheck

Definition at line 42 of file IOstream.cpp.

Referenced by pFlow::operator<<(), pFlow::operator>>(), line::read(), rotatingAxis::read(), timeInterval::write(), iBox< intType >::write(), Logical::write(), box::write(), sphere::write(), line::write(), rotatingAxis::write(), vibrating::write(), cylinder::write(), List< word >::writeList(), multiTriSurface::writeMultiTriSurface(), triSurface::writeTriSurface(), and Vector< word, vecAllocator< word > >::writeVector().

+ Here is the caller graph for this function:

◆ fatalCheck()

bool fatalCheck ( const char *  operation) const

Check IOstream status for given operation.

Generate a FatalIOError when an error has occurred.

Definition at line 48 of file IOstream.cpp.

References fatalErrorInFunction, and fatalExit.

Referenced by iEntry< Key, T * >::createEntry(), dataEntry::readDataEntry(), List< word >::readList(), triSurface::readTriSurface(), Vector< word, vecAllocator< word > >::readVector(), IOfileHeader::writeHeader(), and iEntry< Key, T * >::writeKeyword().

+ Here is the caller graph for this function:

◆ opened()

bool opened ( ) const
inline

Return true if stream has been opened.

Definition at line 166 of file IOstream.hpp.

References IOstream::openClosed_, and IOstream::OPENED.

◆ closed()

bool closed ( ) const
inline

Return true if stream is closed.

Definition at line 172 of file IOstream.hpp.

References IOstream::CLOSED, and IOstream::openClosed_.

◆ isBinary()

bool isBinary ( ) const
inline

Return true if stream format is binray.

Definition at line 178 of file IOstream.hpp.

References IOstream::BINARY, and IOstream::writeFormat_.

Referenced by triSurface::readTriSurface(), Vector< word, vecAllocator< word > >::readVector(), and Vector< word, vecAllocator< word > >::writeVector().

+ Here is the caller graph for this function:

◆ good()

bool good ( ) const
inline

Return true if next operation might succeed.

Definition at line 184 of file IOstream.hpp.

References IOstream::ioState_.

Referenced by Istream::nextValid(), and dictionary::readDictionary().

+ Here is the caller graph for this function:

◆ eof()

◆ fail()

bool fail ( ) const
inline

Return true if next operation will fail.

Definition at line 196 of file IOstream.hpp.

References IOstream::ioState_.

Referenced by IOstream::operator bool(), and IOstream::operator!().

+ Here is the caller graph for this function:

◆ bad()

◆ operator bool()

operator bool ( ) const
inlineexplicit

Return true if the stream has not failed.

Definition at line 208 of file IOstream.hpp.

References IOstream::fail().

+ Here is the call graph for this function:

◆ operator!()

bool operator! ( ) const
inline

Return true if the stream has failed.

Definition at line 214 of file IOstream.hpp.

References IOstream::fail().

+ Here is the call graph for this function:

◆ lineNumber() [1/3]

◆ lineNumber() [2/3]

int32& lineNumber ( )
inline

Non-const access to the current stream line number.

Definition at line 227 of file IOstream.hpp.

References IOstream::lineNumber_.

◆ lineNumber() [3/3]

int32 lineNumber ( const int32  num)
inline

Set the stream line number return the previous value.

Definition at line 234 of file IOstream.hpp.

References IOstream::lineNumber_.

◆ flags() [1/2]

virtual ios_base::fmtflags flags ( ) const
pure virtual

Return flags of stream.

Implemented in oTstream, iTstream, Istream, and Ostream.

Referenced by IOstream::setf(), and IOstream::unsetf().

+ Here is the caller graph for this function:

◆ defaultPrecision() [1/2]

static unsigned int defaultPrecision ( )
inlinestatic

Return the default precision.

Definition at line 245 of file IOstream.hpp.

References IOstream::precision_.

◆ defaultPrecision() [2/2]

static unsigned int defaultPrecision ( unsigned int  prec)
inlinestatic

Reset the default precision return the previous value.

Definition at line 252 of file IOstream.hpp.

References IOstream::precision_.

◆ setEof()

void setEof ( )
inline

Set stream to have reached eof.

Definition at line 260 of file IOstream.hpp.

References IOstream::ioState_.

◆ setFail()

void setFail ( )
inline

Set stream to have failed.

Definition at line 266 of file IOstream.hpp.

References IOstream::ioState_.

◆ setBad()

void setBad ( )
inline

Set stream to be bad.

Definition at line 272 of file IOstream.hpp.

References IOstream::ioState_.

Referenced by IOstream::IOstream(), pFlow::operator>>(), and Logical::read().

+ Here is the caller graph for this function:

◆ flags() [2/2]

virtual ios_base::fmtflags flags ( const ios_base::fmtflags  f)
pure virtual

Set flags of stream.

Implemented in oTstream, iTstream, Istream, and Ostream.

◆ setf() [1/2]

ios_base::fmtflags setf ( const ios_base::fmtflags  f)
inline

Set flags of stream.

Definition at line 281 of file IOstream.hpp.

References IOstream::flags().

Referenced by pFlow::dec(), pFlow::fixed(), pFlow::hex(), pFlow::oct(), and pFlow::scientific().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setf() [2/2]

ios_base::fmtflags setf ( const ios_base::fmtflags  f,
const ios_base::fmtflags  mask 
)
inline

Set flags of given field of stream.

Definition at line 288 of file IOstream.hpp.

References IOstream::flags().

+ Here is the call graph for this function:

◆ unsetf()

void unsetf ( const ios_base::fmtflags  f)
inline

Unset flags of stream.

Definition at line 297 of file IOstream.hpp.

References IOstream::flags().

+ Here is the call graph for this function:

Member Data Documentation

◆ precision_

unsigned int precision_ = 6
static

Default precision, only works for ASCII.

Definition at line 64 of file IOstream.hpp.

Referenced by IOstream::defaultPrecision().

◆ staticName_

pFlow::word staticName_
staticprotected

Name for any generic stream - normally treat as readonly.

Definition at line 69 of file IOstream.hpp.

Referenced by IOstream::name().

◆ openClosed_

streamAccess openClosed_
protected

Is stream open or closed.

Definition at line 72 of file IOstream.hpp.

Referenced by IOstream::closed(), IOstream::opened(), IOstream::setClosed(), and IOstream::setOpened().

◆ writeFormat_

writeFormat writeFormat_ = ASCII
protected

write format

Definition at line 75 of file IOstream.hpp.

Referenced by IOstream::isBinary(), and IOstream::setWriteFormat().

◆ ioState_

◆ lineNumber_

int32 lineNumber_
protected

The file line.

Definition at line 82 of file IOstream.hpp.

Referenced by IOstream::lineNumber().


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