|
CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <SafeOfstream.hh>
Write to a temporary file to ensure a good write, then rename.
Definition at line 31 of file SafeOfstream.hh.
Public Member Functions | |
| SafeOfstream () | |
| void | open (fs::path name, std::string tmp_ext="tmp") |
| Opens "file.tmp" for writing, with intended final target "file". More... | |
| fs::ofstream & | ofstream () |
| Access underlying stream. More... | |
| void | close () |
| Closes stream, and if not a failed write, removes "file" and renames "file.tmp" to "file". More... | |
Private Attributes | |
| fs::path | m_name |
| fs::path | m_tmp_name |
| fs::ofstream | m_sout |
|
inline |
Definition at line 33 of file SafeOfstream.hh.
|
inline |
Closes stream, and if not a failed write, removes "file" and renames "file.tmp" to "file".
Definition at line 84 of file SafeOfstream.hh.
|
inline |
Access underlying stream.
Definition at line 80 of file SafeOfstream.hh.
|
inline |
Opens "file.tmp" for writing, with intended final target "file".
| name | Name of target file |
| tmp_ext | String to be used as an extension for the temporary file that is written |
| if | name.tmp_ext already exists |
Example:
Definition at line 65 of file SafeOfstream.hh.
|
private |
Definition at line 93 of file SafeOfstream.hh.
|
private |
Definition at line 95 of file SafeOfstream.hh.
|
private |
Definition at line 94 of file SafeOfstream.hh.