# PhasicFlow: iTstream Class Reference
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

iTstream Class Reference

Input token stream. More...

Inheritance diagram for iTstream:
[legend]
Collaboration diagram for iTstream:
[legend]

## Public Member Functions

| iTstream (const word &streamName)
| construct with a name More...
| iTstream (const word &streamName, const tokenList &tList)
| construct with name and copy More...
| iTstream (const word &streamName, tokenList &&tList)
| construct with name and move More...
| iTstream (const iTstream &)=default
| copy construct More...
| iTstream (iTstream &&)=default
| move construct More...
iTstream & | operator= (const iTstream &)=default
| copy assignment More...
iTstream & | operator= (iTstream &&)=default
| move assignment More...
void | operator= (const tokenList &tList)
| copy assignment from tokenList More...
void | operator= (tokenList &&tList)
| move assignment from tokenList More...
virtual | ~iTstream ()=default
| Destructor. More...
virtual const word & | name () const
| Return the name of the stream. More...
virtual word & | name ()
| Return non-const access to the name of the stream. More...
virtual iIstream & | read (token &t) override
| Return next token from stream. More...
virtual iIstream & | read (char &c) override
| Read a character. More...
virtual iIstream & | read (word &str) override
| Read a word. More...
virtual iIstream & | readString (word &str) override
| Read a string. More...
virtual iIstream & | read (int64 &) override
| Read a int64. More...
virtual iIstream & | read (int32 &) override
| Read a int32. More...
virtual iIstream & | read (int8 &) override
| Read a int8. More...
virtual iIstream & | read (uint64 &) override
| Read a uint64. More...
virtual iIstream & | read (uint32 &) override
| Read a uint32. More...
virtual iIstream & | read (uint8 &) override
| Read a uint8. More...
virtual iIstream & | read (float &) override
| Read a floatScalar. More...
virtual iIstream & | read (double &) override
| Read a doubleScalar. More...
iIstream & | read (char *buffer, std::streamsize count) override
| Write a block of binray data. More...
virtual void | rewind () override
| Rewind the stream so that it may be read again. More...
void | seek (size_t pos) override
size_t | tell () override
| Return current position indicator. More...
virtual void | reset ()
| reset the iTstream and make the stream empty More...
const tokenList & | tokens () const
| const access to token list More...
size_t | size () const
| size More...
size_t | numTokens () const
| size More...
void | appendTokens (const tokenList &tList)
| append a list of tokens to the end of tokens More...
void | appendToken (const token &t)
| append token to the end of token and rewind the stream More...
ios_base::fmtflags | flags () const
| Return flags of output stream. More...
ios_base::fmtflags | flags (const ios_base::fmtflags)
| Set flags of stream. More...
Public Member Functions inherited from iIstream
| 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 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 >
T | lookupData (const word &keyword)
| lookup for keyword and data; fatalExit if fails More...
template<typename T >
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...
iIstream & | operator() () 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 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...
int32 & | lineNumber ()
| 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...
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...
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...

## Protected Member Functions

bool | isLastToken ()
| check if end of list is reached More...
void | setFirstToken ()
| rewind the stream More...
void | validate ()
| check for valid tokens in the tokenList 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

word | name_
| name of the stream More...
tokenList | tokenList_
| list of tokens in this stream More...
tokenList::iterator | currentToken_
| current token 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...

## 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...
Static Protected Attributes inherited from IOstream
static word | staticName_
| Name for any generic stream - normally treat as readonly. More...

## Detailed Description

Input token stream.

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

Definition at line 27 of file iTstream.hpp.

## Constructor & Destructor Documentation

## iTstream() [1/5]

iTstream | ( | const word & | streamName | ) |

construct with a name

Definition at line 32 of file iTstream.cpp.

## iTstream() [2/5]

iTstream | ( | const word & | streamName,
|  | const tokenList & | tList
| ) |  |

construct with name and copy

Definition at line 47 of file iTstream.cpp.

## iTstream() [3/5]

iTstream | ( | const word & | streamName,
|  | tokenList && | tList
| ) |  |

construct with name and move

Definition at line 65 of file iTstream.cpp.

## iTstream() [4/5]

iTstream | ( | const iTstream & |  | ) |

default

copy construct

## iTstream() [5/5]

iTstream | ( | iTstream && |  | ) |

default

move construct

## ~iTstream()

virtual ~iTstream | ( |  | ) |

virtualdefault

Destructor.

## Member Function Documentation

## isLastToken()

bool isLastToken | ( |  | ) |

protected

check if end of list is reached

Definition at line 6 of file iTstream.cpp.

References iTstream::currentToken_, and iTstream::tokenList_.

## setFirstToken()

void setFirstToken | ( |  | ) |

protected

rewind the stream

Definition at line 11 of file iTstream.cpp.

## validate()

void validate | ( |  | ) |

protected

check for valid tokens in the tokenList

Definition at line 16 of file iTstream.cpp.

References pFlow::validTokenForStream().

Here is the call graph for this function:

## operator=() [1/4]

iTstream& operator= | ( | const iTstream & |  | ) |

default

copy assignment

## operator=() [2/4]

iTstream& operator= | ( | iTstream && |  | ) |

default

move assignment

## operator=() [3/4]

void operator= | ( | const tokenList & | tList | ) |

copy assignment from tokenList

Definition at line 84 of file iTstream.cpp.

## operator=() [4/4]

void operator= | ( | tokenList && | tList | ) |

move assignment from tokenList

Definition at line 92 of file iTstream.cpp.

## name() [1/2]

pFlow::word & name | ( |  | ) | const

virtual

Return the name of the stream.

Reimplemented from IOstream.

Definition at line 99 of file iTstream.cpp.

## name() [2/2]

virtual word& name | ( |  | ) |

virtual

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

Reimplemented from IOstream.

## read() [1/12]

pFlow::iIstream & read | ( | token & | t | ) |

overridevirtual

Return next token from stream.

Implements iIstream.

Definition at line 111 of file iTstream.cpp.

References fatalErrorInFunction, fatalExit, iIstream::getBack(), token::lineNumber(), and token::reset().

Referenced by twoPartEntry::twoPartEntry().

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

## read() [2/12]

pFlow::iIstream & read | ( | char & | c | ) |

overridevirtual

Read a character.

Implements iIstream.

Definition at line 168 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [3/12]

pFlow::iIstream & read | ( | word & | str | ) |

overridevirtual

Read a word.

Implements iIstream.

Definition at line 180 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## readString()

pFlow::iIstream & readString | ( | word & | str | ) |

overridevirtual

Read a string.

Implements iIstream.

Definition at line 192 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [4/12]

pFlow::iIstream & read | ( | int64 & | val | ) |

overridevirtual

Read a int64.

Implements iIstream.

Definition at line 204 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [5/12]

pFlow::iIstream & read | ( | int32 & | val | ) |

overridevirtual

Read a int32.

Implements iIstream.

Definition at line 215 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [6/12]

pFlow::iIstream & read | ( | int8 & | val | ) |

overridevirtual

Read a int8.

Implements iIstream.

Definition at line 227 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [7/12]

pFlow::iIstream & read | ( | uint64 & | val | ) |

overridevirtual

Read a uint64.

Implements iIstream.

Definition at line 238 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [8/12]

pFlow::iIstream & read | ( | uint32 & | val | ) |

overridevirtual

Read a uint32.

Implements iIstream.

Definition at line 249 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [9/12]

pFlow::iIstream & read | ( | uint8 & | val | ) |

overridevirtual

Read a uint8.

Implements iIstream.

Definition at line 260 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [10/12]

pFlow::iIstream & read | ( | float & | val | ) |

overridevirtual

Read a floatScalar.

Implements iIstream.

Definition at line 272 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [11/12]

pFlow::iIstream & read | ( | double & | val | ) |

overridevirtual

Read a doubleScalar.

Implements iIstream.

Definition at line 284 of file iTstream.cpp.

References CONSUME_PARAM, fatalExit, and notImplementedFunction.

## read() [12/12]

pFlow::iIstream & read | ( | char * | buffer,
|  | std::streamsize | count
| ) |  |

overridevirtual

Write a block of binray data.

Implements iIstream.

Definition at line 296 of file iTstream.cpp.

References notImplementedFunction.

## rewind()

void rewind | ( |  | ) |

overridevirtual

Rewind the stream so that it may be read again.

Implements iIstream.

Definition at line 305 of file iTstream.cpp.

References iIstream::resetPutBack().

Referenced by twoPartEntry::secondPartVal(), and dataEntry::stream().

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

## seek()

void seek | ( | size_t | pos | ) |

overridevirtual

Implements iIstream.

Definition at line 312 of file iTstream.cpp.

References notImplementedFunction.

## tell()

size_t tell | ( |  | ) |

overridevirtual

Return current position indicator.

Implements iIstream.

Definition at line 325 of file iTstream.cpp.

References notImplementedFunction.

## reset()

void reset | ( |  | ) |

virtual

reset the iTstream and make the stream empty

Definition at line 317 of file iTstream.cpp.

References iIstream::resetPutBack().

Here is the call graph for this function:

## tokens()

const pFlow::tokenList & tokens | ( |  | ) | const

const access to token list

Definition at line 331 of file iTstream.cpp.

Referenced by dataEntry::dataEntry().

Here is the caller graph for this function:

## size()

size_t size | ( |  | ) | const

size

Definition at line 336 of file iTstream.cpp.

Referenced by pFlow::isTwoPartEntry().

Here is the caller graph for this function:

## numTokens()

size_t numTokens | ( |  | ) | const

size

Definition at line 341 of file iTstream.cpp.

## appendTokens()

void appendTokens | ( | const tokenList & | tList | ) |

append a list of tokens to the end of tokens

Definition at line 347 of file iTstream.cpp.

References pFlow::validTokenForStream().

Here is the call graph for this function:

## appendToken()

void appendToken | ( | const token & | t | ) |

append token to the end of token and rewind the stream

Definition at line 360 of file iTstream.cpp.

References pFlow::validTokenForStream().

Here is the call graph for this function:

## flags() [1/2]

ios_base::fmtflags flags | ( |  | ) | const

inlinevirtual

Return flags of output stream.

Implements IOstream.

Definition at line 159 of file iTstream.hpp.

## flags() [2/2]

ios_base::fmtflags flags | ( | const ios_base::fmtflags |  | ) |

inlinevirtual

Set flags of stream.

Implements IOstream.

Definition at line 165 of file iTstream.hpp.

## Member Data Documentation

## name_

word name_

protected

name of the stream

Definition at line 34 of file iTstream.hpp.

## tokenList_

tokenList tokenList_

protected

list of tokens in this stream

Definition at line 37 of file iTstream.hpp.

Referenced by iTstream::isLastToken().

## currentToken_

tokenList::iterator currentToken_

protected

current token

Definition at line 40 of file iTstream.hpp.

Referenced by iTstream::isLastToken().

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

- src/phasicFlow/streams/TStream/iTstream.hpp
- src/phasicFlow/streams/TStream/iTstream.cpp