TempDirectory Class Reference

#include <TempDirectory.h>

Collaboration diagram for TempDirectory:

Collaboration graph
[legend]
List of all members.

Detailed Description

A class that manages the creation and removal of a temporary directory tree to store data during the program run.

There is one root temporary directory for the program, created on demand and deleted when the program exits.

This class is thread safe.

Definition at line 33 of file TempDirectory.h.

Public Member Functions

virtual ~TempDirectory ()
QString getPath ()
 Create the root temporary directory if necessary, and return its path.
QString getSubDirectoryPath (QString subdir)
 Create an immediate subdirectory of the root temporary directory of the given name, if it doesn't already exist, and return its path.
void cleanup ()
 Delete the temporary directory (before exiting).

Static Public Member Functions

static TempDirectorygetInstance ()

Protected Member Functions

 TempDirectory ()
QString createTempDirectoryIn (QString inDir)
void cleanupDirectory (QString tmpDir)
void cleanupAbandonedDirectories (QString svDir)

Protected Attributes

QString m_tmpdir
QMutex m_mutex

Static Protected Attributes

static TempDirectorym_instance


Constructor & Destructor Documentation

TempDirectory::~TempDirectory (  )  [virtual]

Definition at line 42 of file TempDirectory.cpp.

References cleanup().

TempDirectory::TempDirectory (  )  [protected]

Definition at line 37 of file TempDirectory.cpp.


Member Function Documentation

TempDirectory * TempDirectory::getInstance (  )  [static]

Definition at line 32 of file TempDirectory.cpp.

References m_instance.

Referenced by FileSource::createCacheFile(), AudioGenerator::getSampleDir(), CodedAudioFileReader::initialiseDecodeCache(), main(), MatrixFile::MatrixFile(), StorageAdviser::recommend(), signalHandler(), and WritableWaveFileModel::WritableWaveFileModel().

QString TempDirectory::getPath (  ) 

Create the root temporary directory if necessary, and return its path.

Throw DirectoryCreationFailed if the directory cannot be created.

Definition at line 56 of file TempDirectory.cpp.

References cleanupAbandonedDirectories(), createTempDirectoryIn(), m_mutex, and m_tmpdir.

Referenced by getSubDirectoryPath(), and StorageAdviser::recommend().

QString TempDirectory::getSubDirectoryPath ( QString  subdir  ) 

Create an immediate subdirectory of the root temporary directory of the given name, if it doesn't already exist, and return its path.

Throw DirectoryCreationFailed if the directory cannot be created.

Definition at line 146 of file TempDirectory.cpp.

References getPath(), and m_mutex.

Referenced by FileSource::createCacheFile(), and AudioGenerator::getSampleDir().

void TempDirectory::cleanup (  ) 

Delete the temporary directory (before exiting).

Definition at line 50 of file TempDirectory.cpp.

References cleanupDirectory().

Referenced by main(), signalHandler(), and ~TempDirectory().

QString TempDirectory::createTempDirectoryIn ( QString  inDir  )  [protected]

Definition at line 87 of file TempDirectory.cpp.

References m_tmpdir.

Referenced by getPath().

void TempDirectory::cleanupDirectory ( QString  tmpDir  )  [protected]

Definition at line 169 of file TempDirectory.cpp.

References m_mutex, and m_tmpdir.

Referenced by cleanup(), and cleanupAbandonedDirectories().

void TempDirectory::cleanupAbandonedDirectories ( QString  svDir  )  [protected]

Definition at line 228 of file TempDirectory.cpp.

References cleanupDirectory(), GetProcessStatus(), and ProcessNotRunning.

Referenced by getPath().


Member Data Documentation

QString TempDirectory::m_tmpdir [protected]

Definition at line 67 of file TempDirectory.h.

Referenced by cleanupDirectory(), createTempDirectoryIn(), and getPath().

QMutex TempDirectory::m_mutex [protected]

Definition at line 68 of file TempDirectory.h.

Referenced by cleanupDirectory(), getPath(), and getSubDirectoryPath().

TempDirectory * TempDirectory::m_instance [static, protected]

Definition at line 70 of file TempDirectory.h.

Referenced by getInstance().


The documentation for this class was generated from the following files:
Generated on Wed Feb 20 15:45:36 2008 for SonicVisualiser by  doxygen 1.5.1