Path Integral Quantum Monte Carlo
|
A basic input/output file class. More...
#include <communicator.h>
Public Member Functions | |
File (string, string, string, string) | |
Constructor. More... | |
File (string) | |
Constructor. More... | |
fstream & | stream () |
void | open (ios_base::openmode) |
Open the file. More... | |
void | reset () |
Reset a file. More... | |
void | rename () |
Rename a file. More... | |
void | close () |
Close the file. | |
bool | exists () |
did the file exist before opening? | |
Protected Member Functions | |
void | open (ios_base::openmode, string) |
Open the file. More... | |
Protected Attributes | |
string | name |
string | bakname |
bool | exists_ |
fstream | rwfile |
Friends | |
class | Communicator |
A basic input/output file class.
Definition at line 25 of file communicator.h.
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.
_type | The file type: state, log, etc |
_data | The unique data string identifier |
ensemble | ce: canonical, gce: grand canonical |
outDir | The output directory |
Definition at line 28 of file communicator.cpp.
File::File | ( | string | _name | ) |
Constructor.
Create a filename from a string.
_name | A file name. |
Definition at line 47 of file communicator.cpp.
void File::open | ( | ios_base::openmode | mode | ) |
Open the file.
mode | A valid file rw mode |
Definition at line 64 of file communicator.cpp.
|
protected |
Open the file.
mode | A valid file rw mode |
_name | A valid file name |
Definition at line 80 of file communicator.cpp.
void File::rename | ( | ) |
Rename a file.
After we have performed a write to a .bak file, we rename it to .dat
Definition at line 112 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 96 of file communicator.cpp.