Workspace 6.21.5
Public Member Functions | Protected Attributes | List of all members
oautogzstream Class Reference

File stream output with gzip functionality.

#include <Mesh/FileIO/Compression/oautogzstream.h>

Inherits ostream.

Public Member Functions

 oautogzstream ()
 Constructs a stream not connected to anything.
 
 oautogzstream (std::ostream &os)
 
 oautogzstream (std::string fName)
 Construct a stream by opening the file named fName.
 
 oautogzstream (std::string fName, bool useCompression)
 
 ~oautogzstream () override
 
void Close ()
 Close the currently open file. If one is not open, nothing is done.
 
void Flush ()
 Flush the currently open file. If one is not open, nothing is done.
 
const std::string & GetFileName () const
 
bool IsReady () const
 
void Open (std::string fName)
 
void Open (std::string fName, bool useCompression)
 
bool UsingCompression ()
 

Protected Attributes

std::string fileName
 

Constructor & Destructor Documentation

◆ oautogzstream() [1/4]

◆ oautogzstream() [2/4]

oautogzstream ( std::ostream &  os)

Constructs a stream that writes to the same stream buffer as os. Writing to the constructed stream is then just like writing to os.

◆ oautogzstream() [3/4]

oautogzstream ( std::string  fName)

◆ oautogzstream() [4/4]

oautogzstream ( std::string  fName,
bool  useCompression 
)

Construct a stream by opening the file named fName, and if useCompression is true, then use compression on the output file on-the-fly.

◆ ~oautogzstream()

~oautogzstream ( )
inlineoverride

Member Function Documentation

◆ Close()

void Close ( )

◆ Flush()

void Flush ( )
inline

◆ GetFileName()

const std::string & GetFileName ( ) const
inline

◆ IsReady()

bool IsReady ( ) const
inline
Returns
TRUE if the file is ready for output.

◆ Open() [1/2]

void Open ( std::string  fName)

This form of Open() automatically detects whether on-the-fly gzip compression is required by checking for a .gz extension on the file name.

◆ Open() [2/2]

void Open ( std::string  fName,
bool  useCompression 
)
Parameters
fNameName of file to open.
useCompressionIf TRUE, on-the-fly gzip compression will be used. Otherwise the file is opened as plain text.

Opens a file for output with the specified gzip behaviour. If useCompression==TRUE and fName does not end in .gz, it will be appended to the file name automatically.

You should check the success of this operation with the IsReady() function.

◆ UsingCompression()

bool UsingCompression ( )
inline

Public member function so that user can enquire if compression is being used. Hiding the usingCompression data member stops an ignorant user from wrongly trying to switch the file type.

Member Data Documentation

◆ fileName

std::string fileName
protected