7#ifndef PXR_BASE_TF_ATOMIC_OFSTREAM_WRAPPER_H
8#define PXR_BASE_TF_ATOMIC_OFSTREAM_WRAPPER_H
14#include "pxr/base/tf/api.h"
19PXR_NAMESPACE_OPEN_SCOPE
78 TF_API
bool Open(std::string* reason = 0);
85 TF_API
bool Commit(std::string* reason = 0);
88 TF_API
bool Cancel(std::string* reason = 0);
96 std::string _filePath;
97 std::string _tmpFilePath;
98 std::ofstream _stream;
101PXR_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.