27 #include <boost/filesystem.hpp>
28 #include <boost/filesystem/fstream.hpp>
42 m_motif(motif), m_keep_var(keep_var) {
44 using boost::filesystem::temp_directory_path;
45 using boost::filesystem::unique_path;
48 log.warn() <<
"The '" <<
m_motif <<
"' motif is not random";
54 m_path = temp_directory_path() / unique_path();
63 log.debug() <<
"Automatic destruction of the " <<
path()
65 boost::filesystem::remove_all(
m_path);
67 log.info() <<
m_keep_var <<
" set: I do not remove the "
68 <<
m_path.string() <<
" temporary path";
84 log.debug() <<
"Creation of the " <<
path() <<
" temporary directory";
86 boost::filesystem::create_directory(
path());
96 log.debug() <<
"Creation of the " <<
path() <<
" temporary file";
98 boost::filesystem::ofstream ofs(
path());
static bool hasKey(const std::string &)
Handling of temporary files, directories and environments.
const std::string m_keep_var
TempDir(const std::string &motif=DEFAULT_TMP_MOTIF, const std::string &keep_var=DEFAULT_TMP_KEEP_VAR)
const std::string m_motif
boost::filesystem::path m_path
boost::filesystem::path path() const
boost::filesystem::path path
TempPath(const std::string &motif=DEFAULT_TMP_MOTIF, const std::string &keep_var=DEFAULT_TMP_KEEP_VAR)
std::string motif() const
TempFile(const std::string &motif=DEFAULT_TMP_MOTIF, const std::string &keep_var=DEFAULT_TMP_KEEP_VAR)
Defines a class to handle the Environment.
static Logging getLogger(const std::string &name="")