Interface class for any output stream. More...
Public Member Functions | |
iOstream () | |
Default. More... | |
iOstream (writeFormat wF) | |
Construct from writeFormat. More... | |
iOstream (const iOstream &)=default | |
Copy construct. More... | |
virtual | ~iOstream ()=default |
Destructor. More... | |
virtual bool | write (const token &tok)=0 |
Write token to stream or otherwise handle it. More... | |
virtual iOstream & | write (const char c)=0 |
Write character. More... | |
virtual iOstream & | write (const char *str)=0 |
Write character string. More... | |
virtual iOstream & | write (const word &str)=0 |
Write word. More... | |
virtual iOstream & | writeQuoted (const word &str, const bool quoted=true)=0 |
Write std::string surrounded by quotes. More... | |
virtual iOstream & | write (const int64 val)=0 |
Write int64. More... | |
virtual iOstream & | write (const int32 val)=0 |
Write int32. More... | |
virtual iOstream & | write (const int8 val)=0 |
Write int8. More... | |
virtual iOstream & | write (const uint64 val)=0 |
Write uint64. More... | |
virtual iOstream & | write (const uint32 val)=0 |
Write uint32. More... | |
virtual iOstream & | write (const uint8 val)=0 |
Write uint8. More... | |
virtual iOstream & | write (const float val)=0 |
Write float. More... | |
virtual iOstream & | write (const double val)=0 |
Write double. More... | |
virtual iOstream & | write (const size_t val)=0 |
Write size_t. More... | |
virtual iOstream & | write (const char *binaryData, std::streamsize count)=0 |
Write a block of binray data. More... | |
virtual iOstream & | writeBinaryBlockFlag () |
Write the flag to indicate the start of a binary block. More... | |
virtual void | seek (size_t pos)=0 |
virtual void | indent ()=0 |
Add indentation characters. More... | |
unsigned short | indentSize () const |
Return indent level. More... | |
unsigned short & | indentSize () |
Access to indent size. More... | |
unsigned short | indentLevel () const |
Return indent level. More... | |
unsigned short & | indentLevel () |
Access to indent level. More... | |
void | incrIndent () |
Increment the indent level. More... | |
void | decrIndent () |
Decrement the indent level. More... | |
virtual iOstream & | beginBlock (const word &kw) |
Write begin block group with a name Increments indentation, adds newline. More... | |
virtual iOstream & | beginBlock () |
Write begin block group without a name Increments indentation, adds newline. More... | |
virtual iOstream & | endBlock () |
Write end block group Decrements indentation, adds newline. More... | |
virtual iOstream & | beginList () |
Write begin list "(". More... | |
virtual iOstream & | beginList (const word &kw) |
Write begin list with keyword "kw (". More... | |
virtual iOstream & | endList () |
Write end list ")". More... | |
virtual iOstream & | beginSquare () |
Write begin list "[". More... | |
virtual iOstream & | beginSquare (const word &kw) |
Write begin list with keyword "kw [". More... | |
virtual iOstream & | endSquare () |
Write end list "]". More... | |
virtual iOstream & | endEntry () |
Write end entry (';') followed by newline. More... | |
virtual iOstream & | newLine () |
Write a newLine to stream. More... | |
virtual iOstream & | space (int32 n=1) |
Write space to stream. More... | |
virtual iOstream & | writeWordKeyword (const word &kw) |
Write the keyword followed by an appropriate indentation. More... | |
template<class T > | |
iOstream & | writeWordEntry (const word &key, const T &value) |
Write a keyword/value entry. More... | |
virtual void | startOfBinaryStreaming ()=0 |
Add a new line and flush stream. More... | |
virtual void | endOfBinaryStreaming ()=0 |
Reach end of file add a new line and flush stream. More... | |
virtual void | flush ()=0 |
Flush stream. More... | |
virtual void | endl ()=0 |
Add newline and flush stream. More... | |
virtual char | fill () const =0 |
Get padding character. More... | |
virtual char | fill (const char fillch)=0 |
Set padding character for formatted field up to field width. More... | |
virtual int | width () const =0 |
Get width of output field. More... | |
virtual int | width (const int w)=0 |
Set width of output field (and return old width) More... | |
virtual int | precision () const =0 |
Get precision of output field. More... | |
virtual int | precision (const int p)=0 |
Set precision of output field (and return old precision) More... | |
iOstream & | operator() () const |
Return a non-const reference to const iOstream Needed for write functions where the stream argument is temporary: e.g. More... | |
![]() | |
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 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 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... | |
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... | |
Protected Attributes | |
unsigned short | indentSize_ = 4 |
Number of spaces per indent level. More... | |
unsigned short | indentLevel_ = 0 |
Current indent level. More... | |
![]() | |
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 constexpr const unsigned short | entryIndentation_ = 16 |
Indentation of the entry from the start of the keyword. More... | |
![]() | |
static word | staticName_ |
Name for any generic stream - normally treat as readonly. More... | |
Additional Inherited Members | |
![]() | |
enum | streamAccess : char { CLOSED = 0, OPENED } |
enum | writeFormat : char { ASCII = 0, BINARY } |
![]() | |
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 unsigned int | precision_ = 6 |
Default precision, only works for ASCII. More... | |
![]() | |
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... | |
Interface class for any output stream.
It is based on OpenFOAM stream, with some modifications/simplifications to be tailored to our needs
Definition at line 59 of file iOstream.hpp.
|
inlineexplicit |
Default.
Definition at line 83 of file iOstream.hpp.
|
inlineexplicit |
Construct from writeFormat.
Definition at line 87 of file iOstream.hpp.
|
virtualdefault |
Destructor.
|
pure virtual |
Write token to stream or otherwise handle it.
return false if the token type was not handled by this method
Implemented in Ostream, oTstream, processorOstream, and masterOstream.
Referenced by pFlow::operator<<(), pFlow::writeDataAsciiBinary(), and dictionary::writeDictionary().
|
pure virtual |
Write character.
Implemented in processorOstream, Ostream, masterOstream, and oTstream.
|
pure virtual |
Write character string.
Implemented in processorOstream, Ostream, masterOstream, and oTstream.
Write word.
Implemented in processorOstream, Ostream, masterOstream, and oTstream.
Write std::string surrounded by quotes.
Optional write without quotes.
Implemented in processorOstream, Ostream, masterOstream, and oTstream.
Write int64.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write int32.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write int8.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write uint64.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write uint32.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write uint8.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
|
pure virtual |
Write float.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
|
pure virtual |
Write double.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
Write size_t.
Implemented in processorOstream, oTstream, Ostream, and masterOstream.
|
pure virtual |
Write a block of binray data.
Implemented in oTstream, processorOstream, Ostream, and masterOstream.
|
virtual |
Write the flag to indicate the start of a binary block.
Reimplemented in Ostream.
Definition at line 28 of file iOstream.cpp.
References notImplementedFunction.
|
pure virtual |
Add indentation characters.
Implemented in processorOstream, Ostream, masterOstream, and oTstream.
Referenced by pFlow::indent().
|
inline |
|
inline |
Access to indent size.
Definition at line 167 of file iOstream.hpp.
References iOstream::indentSize_.
|
inline |
Return indent level.
Definition at line 173 of file iOstream.hpp.
References iOstream::indentLevel_.
|
inline |
Access to indent level.
Definition at line 179 of file iOstream.hpp.
References iOstream::indentLevel_.
|
inline |
Increment the indent level.
Definition at line 185 of file iOstream.hpp.
References iOstream::indentLevel_.
Referenced by pFlow::incrIndent(), and stlFile::writeFacet().
void decrIndent | ( | ) |
Decrement the indent level.
Definition at line 34 of file iOstream.cpp.
Referenced by pFlow::decrIndent(), and stlFile::writeFacet().
|
virtual |
Write begin block group with a name Increments indentation, adds newline.
Definition at line 77 of file iOstream.cpp.
References pFlow::beginBlock(), and pFlow::indent().
Referenced by pFlow::beginBlock(), and dictionary::writeDictionary().
|
virtual |
Write begin block group without a name Increments indentation, adds newline.
Definition at line 86 of file iOstream.cpp.
References token::BEGIN_BLOCK, pFlow::incrIndent(), and pFlow::indent().
|
virtual |
Write end block group Decrements indentation, adds newline.
Definition at line 95 of file iOstream.cpp.
References pFlow::decrIndent(), token::END_BLOCK, and pFlow::indent().
Referenced by pFlow::endBlock(), and dictionary::writeDictionary().
|
virtual |
|
virtual |
Write begin list with keyword "kw (".
Definition at line 141 of file iOstream.cpp.
|
virtual |
|
virtual |
Write begin list "[".
Definition at line 160 of file iOstream.cpp.
References token::BEGIN_SQR.
Referenced by pFlow::operator<<().
|
virtual |
Write begin list with keyword "kw [".
Definition at line 169 of file iOstream.cpp.
|
virtual |
Write end list "]".
Definition at line 179 of file iOstream.cpp.
References token::END_SQR.
Referenced by pFlow::operator<<().
|
virtual |
Write end entry (';') followed by newline.
Definition at line 104 of file iOstream.cpp.
References token::END_STATEMENT.
Referenced by pFlow::endEntry(), Field< uint32x3 >::write(), dataEntry::writeDataEntry(), and iOstream::writeWordEntry().
|
virtual |
Write a newLine to stream.
Definition at line 112 of file iOstream.cpp.
References token::NL.
Referenced by Field< uint32x3 >::write().
|
virtual |
Write space to stream.
Definition at line 119 of file iOstream.cpp.
References n, and token::SPACE.
Referenced by boundaryGrainParticles::create(), boundarySphereParticles::create(), boundaryIntegration::create(), interaction::create(), boundaryContactSearch::create(), boundaryGrainInteraction< contactForceModel, geometryMotionModel >::create(), boundarySphereInteraction< contactForceModel, geometryMotionModel >::create(), and contactSearch::create().
|
virtual |
Write the keyword followed by an appropriate indentation.
Definition at line 48 of file iOstream.cpp.
References pFlow::indent(), and token::SPACE.
Referenced by Field< uint32x3 >::write(), iEntry< Key, T * >::writeKeyword(), and iOstream::writeWordEntry().
Write a keyword/value entry.
Definition at line 239 of file iOstream.hpp.
References iOstream::endEntry(), and iOstream::writeWordKeyword().
Referenced by conveyorBelt::write(), timeInterval::write(), iBox< intType >::write(), sphere::write(), box::write(), line::write(), vibrating::write(), cylinder::write(), rotatingAxis::write(), multiTriSurface::write(), infinitePlane::write(), and IOfileHeader::writeHeader().
|
pure virtual |
|
pure virtual |
|
pure virtual |
Flush stream.
Implemented in Ostream, and oTstream.
Referenced by pFlow::flush().
|
pure virtual |
Add newline and flush stream.
Implemented in Ostream, and oTstream.
Referenced by pFlow::endl().
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inline |
Return a non-const reference to const iOstream Needed for write functions where the stream argument is temporary: e.g.
thing thisThing(OFstream("thingFileName")());
Definition at line 284 of file iOstream.hpp.
|
staticconstexprprotected |
Indentation of the entry from the start of the keyword.
Definition at line 68 of file iOstream.hpp.
|
protected |
Number of spaces per indent level.
Definition at line 71 of file iOstream.hpp.
Referenced by iOstream::indentSize().
|
protected |
Current indent level.
Definition at line 74 of file iOstream.hpp.
Referenced by iOstream::incrIndent(), and iOstream::indentLevel().