Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::FileStream Class Reference

#include <source/toolbox/stream/FileStream.h>

Inheritance diagram for SAMRAI::tbox::FileStream:

Inheritance graph
[legend]
List of all members.

Public Types

enum  StreamMode { Read, Write, Append }

Public Member Functions

 FileStream (const char *filename, const StreamMode mode)
 FileStream (FILE *file, const StreamMode mode)
virtual ~FileStream ()
void closeFileOnExit (const bool flag)
FILE * getFILE ()

Detailed Description

Class FileStream reads/writes files using XDRStream to convert data into a machine independent format required for portability across machine architectures.

There are two constructors to a file stream: (1) provide a FILE pointer to an existing file, or (2) provide a file name and let FileStream open the object. By default, FileStream calls fclose() on the file only for case (2). This default behavior can be changed by making a call to closeFileOnExit().

See also:
tbox::XDRStream


Member Enumeration Documentation

enum SAMRAI::tbox::FileStream::StreamMode
 

Enumeration values:
Read 
Write 
Append 


Constructor & Destructor Documentation

SAMRAI::tbox::FileStream::FileStream const char *  filename,
const StreamMode  mode
 

Open a file with the specified filename and the stream mode. The mode can be either FileStream::Read, FileStream::Write, or FileStream::Append. If the filename cannot be opened, then the program aborts with an error. By default, the filename will be closed when the destructor for FileStream is called.

SAMRAI::tbox::FileStream::FileStream FILE *  file,
const StreamMode  mode
 

Use an existing file for the XDR stream. The stream mode can be either FileStream::Read or FileStream::Write. The append mode is treated as a write. By default, the file is NOT closed when the destructor for FileStream is called.

SAMRAI::tbox::FileStream::~FileStream  )  [virtual]
 

The virtual destructor for a file stream. This optionally closes the file depending on the status of the closeFileOnExit() flag.


Member Function Documentation

void SAMRAI::tbox::FileStream::closeFileOnExit const bool  flag  )  [inline]
 

Flag to close or not close the file when the file streamfinishes. The default value for this flag is true if the filename constructor is used but false if the FILE constructor is used.

FILE * SAMRAI::tbox::FileStream::getFILE  )  [inline]
 

Return the FILE data structure corresponding to the file stream.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:34 2005 for SAMRAI by  doxygen 1.4.2