www.cemf.ir
oFstream Class Reference

Output file stream to send binary or ascii data to a file. More...

+ Inheritance diagram for oFstream:
+ Collaboration diagram for oFstream:

Public Member Functions

 oFstream (const fileSystem &path, bool binary=false, bool append=false)
 From file path and format. More...
 
 oFstream (const oFstream &src)=delete
 No copy constructor. More...
 
oFstreamoperator= (const oFstream &rhs)=delete
 No assignment. More...
 
virtual ~oFstream ()=default
 Destructor. More...
 
- Public Member Functions inherited from fileStream
 fileStream (const fileSystem &path, bool outStream=false, bool binary=false, bool append=false)
 From file path and input type and format. More...
 
 fileStream (const fileStream &)=delete
 No copy. More...
 
fileStreamoperator= (const fileStream &)=delete
 No assignment. More...
 
virtual ~fileStream ()
 Destructor. More...
 
std::ifstream & inStream ()
 Access input file stream. More...
 
std::ofstream & outStream ()
 Access output file stream. More...
 
- Public Member Functions inherited from Ostream
 Ostream (std::ostream &os, const word &streamName, writeFormat wf=ASCII)
 Construct from components. More...
 
 Ostream (const Ostream &)=delete
 No copy construct. More...
 
void operator= (const Ostream &)=delete
 No copy assignment. 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 ios_base::fmtflags flags () const
 Return flags of output stream. More...
 
bool write (const token &tok) override
 Write token to stream or otherwise handle it. More...
 
iOstreamwrite (const char c) override
 Write character. More...
 
iOstreamwrite (const char *str) override
 Write character string. More...
 
iOstreamwrite (const word &str) override
 Write word. More...
 
iOstreamwriteQuoted (const word &str, const bool quoted=true) override
 Write std::string surrounded by quotes. More...
 
iOstreamwrite (const int64 val) override
 Write int64. More...
 
iOstreamwrite (const int32 val) override
 Write int32. More...
 
iOstreamwrite (const int8 val) override
 Write int32. More...
 
iOstreamwrite (const uint64 val) override
 Write uint64. More...
 
iOstreamwrite (const uint32 val) override
 Write uint32. More...
 
iOstreamwrite (const uint8 val) override
 Write uint8. More...
 
iOstreamwrite (const float val) override
 Write float. More...
 
iOstreamwrite (const double val) override
 Write double. More...
 
iOstreamwrite (const size_t val) override
 Write size_t. More...
 
iOstreamwrite (const char *binaryData, std::streamsize count) override
 Write a block of binray data. More...
 
iOstreamwriteBinaryBlockFlag () override
 Write the flag to indicate the start of a binary block. More...
 
void seek (size_t pos) override
 
void indent () override
 Add indentation characters. More...
 
ios_base::fmtflags flags (const ios_base::fmtflags f) override
 Set stream flags. More...
 
void startOfBinaryStreaming () override
 Add a new line and flush stream. More...
 
void endOfBinaryStreaming () override
 Reach end of file add a new line and flush stream. More...
 
void flush () override
 Flush stream. More...
 
void endl () override
 Add newline and flush stream. More...
 
char fill () const override
 Get the current padding character. More...
 
char fill (const char fillch) override
 Set padding character for formatted field up to field width. More...
 
int width () const override
 Get width of output field. More...
 
int width (const int w) override
 Set width of output field. More...
 
int precision () const override
 Get precision of output field. More...
 
int precision (const int p) override
 Set precision of output field return old precision. More...
 
virtual std::ostream & stdStream ()
 Access to underlying std::ostream. More...
 
virtual const std::ostream & stdStream () const
 Const access to underlying std::ostream. More...
 
- Public Member Functions inherited from iOstream
 iOstream ()
 Default. More...
 
 iOstream (writeFormat wF)
 Construct from writeFormat. More...
 
 iOstream (const iOstream &)=default
 Copy construct. More...
 
virtual ~iOstream ()=default
 Destructor. 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 iOstreambeginBlock (const word &kw)
 Write begin block group with a name Increments indentation, adds newline. More...
 
virtual iOstreambeginBlock ()
 Write begin block group without a name Increments indentation, adds newline. More...
 
virtual iOstreamendBlock ()
 Write end block group Decrements indentation, adds newline. More...
 
virtual iOstreambeginList ()
 Write begin list "(". More...
 
virtual iOstreambeginList (const word &kw)
 Write begin list with keyword "kw (". More...
 
virtual iOstreamendList ()
 Write end list ")". More...
 
virtual iOstreambeginSquare ()
 Write begin list "[". More...
 
virtual iOstreambeginSquare (const word &kw)
 Write begin list with keyword "kw [". More...
 
virtual iOstreamendSquare ()
 Write end list "]". More...
 
virtual iOstreamendEntry ()
 Write end entry (';') followed by newline. More...
 
virtual iOstreamnewLine ()
 Write a newLine to stream. More...
 
virtual iOstreamspace (int32 n=1)
 Write space to stream. More...
 
virtual iOstreamwriteWordKeyword (const word &kw)
 Write the keyword followed by an appropriate indentation. More...
 
template<class T >
iOstreamwriteWordEntry (const word &key, const T &value)
 Write a keyword/value entry. More...
 
iOstreamoperator() () const
 Return a non-const reference to const iOstream Needed for write functions where the stream argument is temporary: e.g. More...
 
- 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...
 
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...
 
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...
 

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 fileStream
void openInFile (const fileSystem &path)
 open input file More...
 
void openOutFile (const fileSystem &path)
 open output file More...
 
void close ()
 close streams 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 fileStream
uniquePtr< std::ifstream > inStream_
 in file stream More...
 
uniquePtr< std::ofstream > outStream_
 out file stream More...
 
bool binary_ = false
 
bool append_ = false
 
- Protected Attributes inherited from iOstream
unsigned short indentSize_ = 4
 Number of spaces per indent level. More...
 
unsigned short indentLevel_ = 0
 Current indent level. 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 constexpr const unsigned short entryIndentation_ = 16
 Indentation of the entry from the start of the keyword. More...
 
- Static Protected Attributes inherited from IOstream
static word staticName_
 Name for any generic stream - normally treat as readonly. More...
 

Detailed Description

Output file stream to send binary or ascii data to a file.


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

Definition at line 38 of file oFstream.hpp.

Constructor & Destructor Documentation

◆ oFstream() [1/2]

oFstream ( const fileSystem path,
bool  binary = false,
bool  append = false 
)

From file path and format.

Definition at line 25 of file oFstream.cpp.

◆ oFstream() [2/2]

oFstream ( const oFstream src)
delete

No copy constructor.

◆ ~oFstream()

virtual ~oFstream ( )
virtualdefault

Destructor.

Member Function Documentation

◆ operator=()

oFstream& operator= ( const oFstream rhs)
delete

No assignment.


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