mxnet
Public Member Functions | Public Attributes | List of all members
dmlc::TemporaryDirectory Class Reference

Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed, a temporary directory is created. The directory is deleted when the object is deleted or goes out of scope. Note: no symbolic links are allowed inside the temporary directory. More...

#include <filesystem.h>

Collaboration diagram for dmlc::TemporaryDirectory:
Collaboration graph

Public Member Functions

 TemporaryDirectory (bool verbose=false)
 Default constructor. Creates a new temporary directory with a unique name. More...
 
 ~TemporaryDirectory ()
 Destructor. Will perform recursive deletion via RecursiveDelete() More...
 

Public Attributes

std::string path
 Full path of the temporary directory. More...
 

Detailed Description

Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed, a temporary directory is created. The directory is deleted when the object is deleted or goes out of scope. Note: no symbolic links are allowed inside the temporary directory.

Usage example:

void foo() {
// Create a file my_file.txt inside the temporary directory
std::ofstream of(tempdir.path + "/my_file.txt");
// ... write to my_file.txt ...
// ... use my_file.txt
// When tempdir goes out of scope, the temporary directory is deleted
}

Constructor & Destructor Documentation

dmlc::TemporaryDirectory::TemporaryDirectory ( bool  verbose = false)
inlineexplicit

Default constructor. Creates a new temporary directory with a unique name.

Parameters
verbosewhether to emit extra messages
dmlc::TemporaryDirectory::~TemporaryDirectory ( )
inline

Destructor. Will perform recursive deletion via RecursiveDelete()

Member Data Documentation

std::string dmlc::TemporaryDirectory::path

Full path of the temporary directory.


The documentation for this class was generated from the following file: