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"
33 #include <boost/noncopyable.hpp>
38 PXR_NAMESPACE_OPEN_SCOPE
94 TF_API
bool Open(std::string* reason = 0);
101 TF_API
bool Commit(std::string* reason = 0);
104 TF_API
bool Cancel(std::string* reason = 0);
112 std::string _filePath;
113 std::string _tmpFilePath;
114 std::ofstream _stream;
117 PXR_NAMESPACE_CLOSE_SCOPE
119 #endif // PXR_BASE_TF_ATOMIC_OFSTREAM_WRAPPER_H
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 bool Open(std::string *reason=0)
Opens the temporary file for writing.
TF_API TfAtomicOfstreamWrapper(const std::string &filePath)
Constructor.
std::ofstream & GetStream()
Returns the stream.
A class that wraps a file output stream, providing improved tolerance for write failures.
TF_API bool Cancel(std::string *reason=0)
Closes the temporary file and removes it from disk, if it exists.
TF_API ~TfAtomicOfstreamWrapper()
Destructor. Calls Cancel().