Path Integral Quantum Monte Carlo
 All Classes Files Functions Variables Typedefs Enumerations Defines
Public Member Functions | Protected Member Functions | Protected Attributes
File Class Reference

A basic input/output file class. More...

#include <communicator.h>

List of all members.

Public Member Functions

 File (string, string, string, string)
 Constructor.
 File (string)
 Constructor.
fstream & stream ()
void open (ios_base::openmode)
 Open the file.
void reset ()
 Reset a file.
void rename ()
 Rename a file.
void close ()
 Close the file.

Protected Member Functions

void open (ios_base::openmode, string)
 Open the file.

Protected Attributes

string name
string bakname
fstream rwfile

Detailed Description

A basic input/output file class.

Definition at line 24 of file communicator.h.


Constructor & Destructor Documentation

File::File ( string  _type,
string  _data,
string  ensemble,
string  outDir 
)

Constructor.

Given a file type/label, ensemble type, data label and out directory, create a unique file name and backup file name.

Parameters:
_typeThe file type: state, log, etc
_dataThe unique data string identifier
ensemblece: canonical, gce: grand canonical
outDirThe output directory

Definition at line 28 of file communicator.cpp.

File::File ( string  _name)

Constructor.

Create a filename from a string.

Parameters:
_nameA file name.

Definition at line 44 of file communicator.cpp.


Member Function Documentation

void File::open ( ios_base::openmode  mode)

Open the file.

Parameters:
modeA valid file rw mode

Definition at line 61 of file communicator.cpp.

void File::open ( ios_base::openmode  mode,
string  _name 
) [protected]

Open the file.

Parameters:
modeA valid file rw mode
_nameA valid file name

Definition at line 77 of file communicator.cpp.

void File::rename ( )

Rename a file.

After we have performed a write to a .bak file, we rename it to the .dat file using boost::filesystem.

Definition at line 110 of file communicator.cpp.

void File::reset ( )

Reset a file.

This method is used to prepare a file for writing that is meant to be overwritten. In order to be safe, we write to a .bak version of the file.

Definition at line 93 of file communicator.cpp.


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