|
OpenNN
Open-source neural networks library
|
Streaming writer that finalises by atomic-renaming a .tmp file to its final path. More...
#include <io_utilities.h>
Public Member Functions | |
| FileWriter ()=default | |
| ~FileWriter () | |
| FileWriter (const FileWriter &)=delete | |
| FileWriter & | operator= (const FileWriter &)=delete |
| FileWriter (FileWriter &&)=delete | |
| FileWriter & | operator= (FileWriter &&)=delete |
| void | open (const filesystem::path &tmp_path) |
| Opens a temporary file to which subsequent write() calls are appended. | |
| bool | is_open () const |
| Returns true while the underlying stream is open. | |
| void | write (const void *buffer, size_t bytes) |
| Appends the given byte range to the open file. | |
| void | finish_with_rename (const filesystem::path &final_path) |
| Closes the stream and atomically renames the tmp file to final_path. | |
| void | abort () |
| Closes and deletes the tmp file, discarding any written data. | |
Streaming writer that finalises by atomic-renaming a .tmp file to its final path.
|
default |
| opennn::FileWriter::~FileWriter | ( | ) |
|
delete |
|
delete |
| void opennn::FileWriter::abort | ( | ) |
Closes and deletes the tmp file, discarding any written data.
| void opennn::FileWriter::finish_with_rename | ( | const filesystem::path & | final_path | ) |
Closes the stream and atomically renames the tmp file to final_path.
|
nodiscard |
Returns true while the underlying stream is open.
| void opennn::FileWriter::open | ( | const filesystem::path & | tmp_path | ) |
Opens a temporary file to which subsequent write() calls are appended.
|
delete |
|
delete |
| void opennn::FileWriter::write | ( | const void * | buffer, |
| size_t | bytes ) |
Appends the given byte range to the open file.