![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
RAII guard around a freshly mkdtemp'd /tmp directory. More...
#include "scoped_tempdir.h"
Public Member Functions | |
| ScopedTempDir () | |
| ~ScopedTempDir () | |
| ScopedTempDir (const ScopedTempDir &)=delete | |
| ScopedTempDir & | operator= (const ScopedTempDir &)=delete |
| std::string | file (const std::string &basename) |
| Build a path under the temp dir and register it for cleanup. | |
| void | track (const std::string &p) |
Also track a file we did not create through file() (e.g. | |
| void | keep () |
| Leave the directory on disk; cleanup is skipped at scope exit. | |
| const std::string & | path () const |
Private Attributes | |
| std::string | path_ |
| std::vector< std::string > | files_ |
| bool | keep_ = false |
RAII guard around a freshly mkdtemp'd /tmp directory.
Wraps the boilerplate every external-tool launch shares: create a private 0700 directory, write the Tseytin CNF and any sibling files into it, and on scope exit unlink each tracked file and rmdir the directory. If the body throws (missing tool, runtime failure, malformed output), the destructor still runs and the /tmp leak is avoided. Pass keep() in the verbose-debug arm to leave the artifacts on disk for inspection.
Best-effort: the destructor swallows unlink/rmdir errors because it must not throw during stack unwinding.
Definition at line 29 of file scoped_tempdir.h.
|
inline |
|
inline |
Definition at line 37 of file scoped_tempdir.h.
|
delete |

|
inline |
Build a path under the temp dir and register it for cleanup.
Definition at line 46 of file scoped_tempdir.h.

|
inline |
Leave the directory on disk; cleanup is skipped at scope exit.
Definition at line 55 of file scoped_tempdir.h.

|
delete |

|
inline |
|
inline |
Also track a file we did not create through file() (e.g.
a helper tool's scratch output sitting in path_).
Definition at line 53 of file scoped_tempdir.h.
|
private |
Definition at line 60 of file scoped_tempdir.h.
|
private |
Definition at line 61 of file scoped_tempdir.h.
|
private |
Definition at line 59 of file scoped_tempdir.h.