JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
joda::filesystem::DirectoryRegister Class Reference

#include <DirectoryRegister.h>

Collaboration diagram for joda::filesystem::DirectoryRegister:
[legend]

Public Member Functions

 DirectoryRegister (DirectoryRegister const &)=delete
 
void operator= (DirectoryRegister const &)=delete
 
virtual ~DirectoryRegister ()
 
bool registerDirectory (const std::string &dir, bool checkDuplicate)
 
bool registerDirectory (const fs::path &dir, bool checkDuplicate)
 
bool removeDirectory (const std::string &dir)
 
bool removeDirectory (const fs::path &dir)
 
boost::optional< std::string > getTMPDir (const std::string &name)
 
std::string getUniqueDir ()
 

Static Public Member Functions

static DirectoryRegistergetInstance ()
 

Protected Member Functions

bool createDir (const fs::path &dir, bool checkExisting=false)
 
bool removeDir (const fs::path &dir)
 

Protected Attributes

std::unordered_set< std::string > dirs {}
 
unsigned long currID = 0
 
std::mutex mut
 

Detailed Description

This class manages the lifetime of (temporary) directories. All registered directories are deleted on deletion of the register

Constructor & Destructor Documentation

◆ DirectoryRegister()

joda::filesystem::DirectoryRegister::DirectoryRegister ( DirectoryRegister const &  )
delete

◆ ~DirectoryRegister()

joda::filesystem::DirectoryRegister::~DirectoryRegister ( )
virtual

Deletes all directories on deletion of the Register

Here is the call graph for this function:

Member Function Documentation

◆ createDir()

bool joda::filesystem::DirectoryRegister::createDir ( const fs::path &  dir,
bool  checkExisting = false 
)
protected

◆ getInstance()

static DirectoryRegister& joda::filesystem::DirectoryRegister::getInstance ( )
inlinestatic
Here is the caller graph for this function:

◆ getTMPDir()

boost::optional< std::string > joda::filesystem::DirectoryRegister::getTMPDir ( const std::string &  name)

Creates a new named directory in the configured temporary directory

Parameters
nameThe name of the directory to be created
Returns
The path to the directory if successful; Nothing else
Here is the caller graph for this function:

◆ getUniqueDir()

std::string joda::filesystem::DirectoryRegister::getUniqueDir ( )

Returns an arbitrary unique directory path. This directory is not yet registered or created. The uniqueness is only ensured per system run.

Returns
A path to a unique directory.
Here is the caller graph for this function:

◆ operator=()

void joda::filesystem::DirectoryRegister::operator= ( DirectoryRegister const &  )
delete

◆ registerDirectory() [1/2]

bool joda::filesystem::DirectoryRegister::registerDirectory ( const fs::path &  dir,
bool  checkDuplicate = true 
)

Creates and registers a directory

Parameters
dirThe path to the directory
checkDuplicateIf true, the function fails if the chosen directory was already created
Returns
False if a duplicate was found and checkDuplicate is True or another error occurs; True else

◆ registerDirectory() [2/2]

bool joda::filesystem::DirectoryRegister::registerDirectory ( const std::string &  dir,
bool  checkDuplicate 
)

Creates and registers a directory

Parameters
dirThe path to the directory
checkDuplicateIf true, the function fails if the chosen directory was already created
Returns
False if a duplicate was found and checkDuplicate is True or another error occurs; True else
Here is the caller graph for this function:

◆ removeDir()

bool joda::filesystem::DirectoryRegister::removeDir ( const fs::path &  dir)
protected
Here is the caller graph for this function:

◆ removeDirectory() [1/2]

bool joda::filesystem::DirectoryRegister::removeDirectory ( const fs::path &  dir)

Deletes a registered directory

Parameters
dirThe directory to delete
Returns
True if the directory was successfully deleted; False if an error occured

◆ removeDirectory() [2/2]

bool joda::filesystem::DirectoryRegister::removeDirectory ( const std::string &  dir)

Deletes a registered directory

Parameters
dirThe directory to delete
Returns
True if the directory was successfully deleted; False if an error occured
Here is the caller graph for this function:

Field Documentation

◆ currID

unsigned long joda::filesystem::DirectoryRegister::currID = 0
protected

◆ dirs

std::unordered_set<std::string> joda::filesystem::DirectoryRegister::dirs {}
protected

◆ mut

std::mutex joda::filesystem::DirectoryRegister::mut
protected

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