24#ifndef PXR_BASE_TF_ATOMIC_OFSTREAM_WRAPPER_H
25#define PXR_BASE_TF_ATOMIC_OFSTREAM_WRAPPER_H
31#include "pxr/base/tf/api.h"
36PXR_NAMESPACE_OPEN_SCOPE
95 TF_API
bool Open(std::string* reason = 0);
102 TF_API
bool Commit(std::string* reason = 0);
105 TF_API
bool Cancel(std::string* reason = 0);
113 std::string _filePath;
114 std::string _tmpFilePath;
115 std::ofstream _stream;
118PXR_NAMESPACE_CLOSE_SCOPE
A class that wraps a file output stream, providing improved tolerance for write failures.
TF_API bool Commit(std::string *reason=0)
Synchronizes the temporary file contents to disk, and renames the temporary file into the file path p...
TF_API ~TfAtomicOfstreamWrapper()
Destructor. Calls Cancel().
TF_API bool Cancel(std::string *reason=0)
Closes the temporary file and removes it from disk, if it exists.
TF_API TfAtomicOfstreamWrapper(const std::string &filePath)
Constructor.
std::ofstream & GetStream()
Returns the stream.
TF_API bool Open(std::string *reason=0)
Opens the temporary file for writing.