www.cemf.ir
iIstream Class Referenceabstract

Interface class for any input stream
More...

+ Inheritance diagram for iIstream:
+ Collaboration diagram for iIstream:

Public Member Functions

 iIstream ()
 default More...
 
 iIstream (writeFormat wf)
 
 iIstream (const iIstream &)=default
 Copy construct. More...
 
virtual ~iIstream ()=default
 Destructor. More...
 
void putBack (const token &tok)
 Put back token Only a single put back is permitted. More...
 
bool getBack (token &tok)
 Get the put back token if there is one and return true. More...
 
bool peekBack (token &tok)
 Peek at the put back token without removing it. More...
 
void resetPutBack ()
 reset the put back token; More...
 
virtual iIstreamread (token &)=0
 Return next token from stream. More...
 
virtual iIstreamread (char &)=0
 Read a character. More...
 
virtual iIstreamread (word &)=0
 Read a string (including enclosing double-quotes) More...
 
virtual iIstreamreadString (word &)=0
 Read a string. More...
 
virtual iIstreamread (int64 &)=0
 Read a int64. More...
 
virtual iIstreamread (int32 &)=0
 Read a int32. More...
 
virtual iIstreamread (int8 &)=0
 Read a int8. More...
 
virtual iIstreamread (uint64 &)=0
 Read a uint64. More...
 
virtual iIstreamread (uint32 &)=0
 Read a uin32. More...
 
virtual iIstreamread (uint8 &)=0
 Read a uint8. More...
 
virtual iIstreamread (float &)=0
 Read a floatScalar. More...
 
virtual iIstreamread (double &)=0
 Read a doubleScalar. More...
 
virtual iIstreamread (char *buffer, std::streamsize count)=0
 Write a block of binray data. More...
 
virtual void rewind ()=0
 Rewind the stream so that it may be read again. More...
 
virtual void seek (size_t pos)=0
 
virtual size_t tell ()=0
 Return current position indicator. More...
 
virtual size_t findBinaryBlockStart ()
 It seek for a character sequence that indicates the start of a binary block char sequence is 255 255 255 0
More...
 
virtual bool findToken (const word &w)
 search for all tokesn and find the first word token tbat matchs w More...
 
virtual bool findTokenResume (const word &w)
 search for all tokesn after the current file position and find the first word token tbat matchs w More...
 
virtual bool findTokenSilent (const word &w, int32 limitLine=100)
 search for all tokesn and find the first word token that matchs More...
 
virtual bool findTokenResumeSilent (const word &w, int32 limitLine=100)
 search for all tokesn after the current file position and find the first word token tbat matchs w More...
 
virtual bool findTokenAndNext (const word &w, word &nextW, bool checkEndStatement=true)
 search for all tokens and find the first word token and also next word token chekck if it is eneded with end statement ; More...
 
virtual bool findTokenAndNextSilent (const word &w, word &nextW, int32 limitLine=100)
 
template<typename T >
bool findKeywordAndVal (const word &keyword, T &val, bool checkEndStatement=true)
 find a pair of keyword and data terminated by ; keyword data; return false if keyword does not exist or reading fails. More...
 
template<typename T >
lookupData (const word &keyword)
 lookup for keyword and data; fatalExit if fails More...
 
template<typename T >
lookupDataOrSet (const word &keyword, const T &setVal)
 lookup for keyword and data; set to setVal if lookup fails. More...
 
template<typename T >
bool nextData (const word &keyword, T &data)
 read the data next to keword keyword data; check the keyword is correct or not
More...
 
bool readBegin (const char *funcName)
 Begin read of data chunk, starts with '('. More...
 
bool readEnd (const char *funcName)
 End read of data chunk, ends with ')' return true or FatalIOError. More...
 
bool readBeginSquare (const char *funcName)
 Begin read of data chunk, starts with '('. More...
 
bool readEndSquare (const char *funcName)
 Begin read of data chunk, starts with '('. More...
 
char readBeginList (const char *funcName)
 Begin read of list data, starts with '(' or '{' return starting delimiter or FatalIOError. More...
 
char readEndList (const char *funcName)
 End read of list data, ends with ')' or '}' return closing delimiter or FatalIOError. More...
 
char readEndStatement (const char *funcName)
 End statement character ;. More...
 
iIstreamoperator() () const
 
- Public Member Functions inherited from IOstream
 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...
 

Private Attributes

bool putBack_
 Has a token been put back on the stream? More...
 
token putBackToken_
 The last token put back on the stream. More...
 

Additional Inherited Members

- Public Types inherited from IOstream
enum  streamAccess : char { CLOSED = 0, OPENED }
 
enum  writeFormat : char { ASCII = 0, BINARY }
 
- Static Public Member Functions inherited from IOstream
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 inherited from IOstream
static unsigned int precision_ = 6
 Default precision, only works for ASCII. More...
 
- Protected Member Functions inherited from IOstream
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 inherited from IOstream
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 inherited from IOstream
static word staticName_
 Name for any generic stream - normally treat as readonly. More...
 

Detailed Description

Interface class for any input stream

It is based on OpenFOAM stream, with some modifications/simplifications to be tailored to our needs

Definition at line 37 of file iIstream.hpp.

Constructor & Destructor Documentation

◆ iIstream() [1/3]

iIstream ( )
inline

default

Definition at line 55 of file iIstream.hpp.

◆ iIstream() [2/3]

iIstream ( writeFormat  wf)
inline

Definition at line 60 of file iIstream.hpp.

◆ iIstream() [3/3]

iIstream ( const iIstream )
default

Copy construct.

◆ ~iIstream()

virtual ~iIstream ( )
virtualdefault

Destructor.

Member Function Documentation

◆ putBack()

void putBack ( const token tok)

Put back token Only a single put back is permitted.

Definition at line 23 of file iIstream.cpp.

References IOstream::bad(), fatalErrorInFunction, fatalExit, ioErrorInFile, IOstream::lineNumber(), IOstream::name(), iIstream::putBack_, and iIstream::putBackToken_.

Referenced by iEntry< Key, T * >::createEntry(), stlFile::read(), pFlow::readDataAscii(), dictionary::readDictionary(), List< std::any >::readList(), and stlFile::readSolid().

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

◆ getBack()

bool getBack ( token tok)

Get the put back token if there is one and return true.

Return false if no put back token is available.

Definition at line 45 of file iIstream.cpp.

References fatalErrorInFunction.

Referenced by iTstream::read(), and Istream::read().

+ Here is the caller graph for this function:

◆ peekBack()

bool peekBack ( token tok)

Peek at the put back token without removing it.

Returns false if no put back token is available and set the token to undefined.

Definition at line 64 of file iIstream.cpp.

References token::reset().

+ Here is the call graph for this function:

◆ resetPutBack()

void resetPutBack ( )
inline

reset the put back token;

Definition at line 89 of file iIstream.hpp.

References iIstream::putBack_, iIstream::putBackToken_, and token::reset().

Referenced by iTstream::reset(), and iTstream::rewind().

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

◆ read() [1/12]

virtual iIstream& read ( token )
pure virtual

Return next token from stream.

Implemented in Istream, and iTstream.

Referenced by iEntry< Key, T * >::createEntry(), pFlow::operator>>(), pFlow::readDataAsciiBinary(), dataEntry::readDataEntry(), iEntry< Key, T * >::readKeyword(), and token::token().

+ Here is the caller graph for this function:

◆ read() [2/12]

virtual iIstream& read ( char &  )
pure virtual

Read a character.

Implemented in Istream, and iTstream.

◆ read() [3/12]

virtual iIstream& read ( word )
pure virtual

Read a string (including enclosing double-quotes)

Implemented in Istream, and iTstream.

◆ readString()

virtual iIstream& readString ( word )
pure virtual

Read a string.

Implemented in Istream, and iTstream.

◆ read() [4/12]

virtual iIstream& read ( int64 )
pure virtual

Read a int64.

Implemented in Istream, and iTstream.

◆ read() [5/12]

virtual iIstream& read ( int32 )
pure virtual

Read a int32.

Implemented in Istream, and iTstream.

◆ read() [6/12]

virtual iIstream& read ( int8 )
pure virtual

Read a int8.

Implemented in Istream, and iTstream.

◆ read() [7/12]

virtual iIstream& read ( uint64 )
pure virtual

Read a uint64.

Implemented in Istream, and iTstream.

◆ read() [8/12]

virtual iIstream& read ( uint32 )
pure virtual

Read a uin32.

Implemented in Istream, and iTstream.

◆ read() [9/12]

virtual iIstream& read ( uint8 )
pure virtual

Read a uint8.

Implemented in Istream, and iTstream.

◆ read() [10/12]

virtual iIstream& read ( float &  )
pure virtual

Read a floatScalar.

Implemented in Istream, and iTstream.

◆ read() [11/12]

virtual iIstream& read ( double &  )
pure virtual

Read a doubleScalar.

Implemented in Istream, and iTstream.

◆ read() [12/12]

virtual iIstream& read ( char *  buffer,
std::streamsize  count 
)
pure virtual

Write a block of binray data.

Implemented in Istream, and iTstream.

◆ rewind()

virtual void rewind ( )
pure virtual

Rewind the stream so that it may be read again.

Implemented in Istream, and iTstream.

◆ seek()

virtual void seek ( size_t  pos)
pure virtual

Implemented in Istream, and iTstream.

◆ tell()

virtual size_t tell ( )
pure virtual

Return current position indicator.

Implemented in Istream, and iTstream.

◆ findBinaryBlockStart()

size_t findBinaryBlockStart ( )
virtual

It seek for a character sequence that indicates the start of a binary block char sequence is 255 255 255 0

Reimplemented in Istream.

Definition at line 78 of file iIstream.cpp.

References notImplementedFunction.

◆ findToken()

bool findToken ( const word w)
virtual

search for all tokesn and find the first word token tbat matchs w

Definition at line 84 of file iIstream.cpp.

Referenced by iIstream::findKeywordAndVal(), and Field< uint32x3 >::read().

+ Here is the caller graph for this function:

◆ findTokenResume()

bool findTokenResume ( const word w)
virtual

search for all tokesn after the current file position and find the first word token tbat matchs w

Definition at line 90 of file iIstream.cpp.

References pFlow::endl(), token::error(), fatalErrorInFunction, token::isEndBlock(), token::isEndStatement(), token::isWord(), and token::wordToken().

Referenced by Field< uint32x3 >::read().

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

◆ findTokenSilent()

bool findTokenSilent ( const word w,
int32  limitLine = 100 
)
virtual

search for all tokesn and find the first word token that matchs

Definition at line 123 of file iIstream.cpp.

◆ findTokenResumeSilent()

bool findTokenResumeSilent ( const word w,
int32  limitLine = 100 
)
virtual

search for all tokesn after the current file position and find the first word token tbat matchs w

Definition at line 129 of file iIstream.cpp.

References token::error(), token::isEndBlock(), token::isEndStatement(), token::isWord(), and token::wordToken().

+ Here is the call graph for this function:

◆ findTokenAndNext()

bool findTokenAndNext ( const word w,
word nextW,
bool  checkEndStatement = true 
)
virtual

search for all tokens and find the first word token and also next word token chekck if it is eneded with end statement ;

Definition at line 157 of file iIstream.cpp.

References pFlow::endl(), token::error(), ioErrorInFile, token::isEndStatement(), token::isWord(), and token::wordToken().

+ Here is the call graph for this function:

◆ findTokenAndNextSilent()

bool findTokenAndNextSilent ( const word w,
word nextW,
int32  limitLine = 100 
)
virtual

Definition at line 203 of file iIstream.cpp.

References token::error(), token::isEndStatement(), token::isWord(), and token::wordToken().

Referenced by readControlDict::read(), and IOfileHeader::readHeader().

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

◆ findKeywordAndVal()

bool findKeywordAndVal ( const word keyword,
T &  val,
bool  checkEndStatement = true 
)

find a pair of keyword and data terminated by ; keyword data; return false if keyword does not exist or reading fails.


Definition at line 24 of file iIstreamI.hpp.

References iIstream::findToken(), token::good(), and token::isEndStatement().

Referenced by readControlDict::read(), and multiTriSurface::read().

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

◆ lookupData()

T lookupData ( const word keyword)

lookup for keyword and data; fatalExit if fails

Definition at line 52 of file iIstreamI.hpp.

References fatalExit, and ioErrorInFile.

◆ lookupDataOrSet()

T lookupDataOrSet ( const word keyword,
const T &  setVal 
)

lookup for keyword and data; set to setVal if lookup fails.


Definition at line 68 of file iIstreamI.hpp.

Referenced by readControlDict::read().

+ Here is the caller graph for this function:

◆ nextData()

bool nextData ( const word keyword,
T &  data 
)

read the data next to keword keyword data; check the keyword is correct or not

Definition at line 81 of file iIstreamI.hpp.

References pFlow::endl(), token::error(), token::good(), ioErrorInFile, token::isEndStatement(), token::isWord(), and token::wordToken().

Referenced by iBox< intType >::read(), sphere::read(), box::read(), cylinder::read(), and infinitePlane::read().

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

◆ readBegin()

bool readBegin ( const char *  funcName)

Begin read of data chunk, starts with '('.

return true or FatalIOError

Definition at line 238 of file iIstream.cpp.

References token::BEGIN_LIST, pFlow::endl(), fatalExit, and ioErrorInFile.

Referenced by pFlow::operator>>().

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

◆ readEnd()

bool readEnd ( const char *  funcName)

End read of data chunk, ends with ')' return true or FatalIOError.

Definition at line 258 of file iIstream.cpp.

References token::END_LIST, pFlow::endl(), fatalExit, and ioErrorInFile.

Referenced by pFlow::operator>>().

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

◆ readBeginSquare()

bool readBeginSquare ( const char *  funcName)

Begin read of data chunk, starts with '('.

return true or FatalIOError

Definition at line 277 of file iIstream.cpp.

References token::BEGIN_SQR, pFlow::endl(), fatalExit, and ioErrorInFile.

Referenced by pFlow::operator>>().

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

◆ readEndSquare()

bool readEndSquare ( const char *  funcName)

Begin read of data chunk, starts with '('.

return true or FatalIOError

Definition at line 296 of file iIstream.cpp.

References token::END_SQR, pFlow::endl(), fatalExit, and ioErrorInFile.

Referenced by pFlow::operator>>().

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

◆ readBeginList()

char readBeginList ( const char *  funcName)

Begin read of list data, starts with '(' or '{' return starting delimiter or FatalIOError.

Definition at line 315 of file iIstream.cpp.

References token::BEGIN_BLOCK, token::BEGIN_LIST, pFlow::endl(), fatalExit, ioErrorInFile, and token::pToken().

+ Here is the call graph for this function:

◆ readEndList()

char readEndList ( const char *  funcName)

End read of list data, ends with ')' or '}' return closing delimiter or FatalIOError.

Definition at line 336 of file iIstream.cpp.

References token::END_BLOCK, token::END_LIST, pFlow::endl(), fatalExit, ioErrorInFile, and token::pToken().

+ Here is the call graph for this function:

◆ readEndStatement()

char readEndStatement ( const char *  funcName)

End statement character ;.

Definition at line 359 of file iIstream.cpp.

References CONSUME_PARAM, pFlow::endl(), fatalExit, ioErrorInFile, token::isEndStatement(), and token::pToken().

Referenced by timeInterval::read(), line::read(), rotatingAxis::read(), and Field< uint32x3 >::read().

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

◆ operator()()

pFlow::iIstream & operator() ( ) const

Definition at line 377 of file iIstream.cpp.

References fatalExit.

Member Data Documentation

◆ putBack_

bool putBack_
private

Has a token been put back on the stream?

Definition at line 45 of file iIstream.hpp.

Referenced by iIstream::putBack(), and iIstream::resetPutBack().

◆ putBackToken_

token putBackToken_
private

The last token put back on the stream.

Definition at line 48 of file iIstream.hpp.

Referenced by iIstream::putBack(), and iIstream::resetPutBack().


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