Path Integral Quantum Monte Carlo
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
File Class Reference

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.
 

Protected Member Functions

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

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() [1/2]

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() [2/2]

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

◆ open() [1/2]

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

Open the file.

Parameters
modeA valid file rw mode

Definition at line 61 of file communicator.cpp.

◆ open() [2/2]

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.

◆ rename()

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.

◆ reset()

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: