Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
OutputDirectoryFifoQueue Class Reference

#include <OutputDirectoryFifoQueue.hpp>

+ Collaboration diagram for OutputDirectoryFifoQueue:

Public Member Functions

 OutputDirectoryFifoQueue (const std::string &rBaseDirectory, unsigned queueMaxSize)
 
std::string CreateNextDir (const std::string &rSubdirectoryName)
 

Private Attributes

std::string mBaseDirectory
 
unsigned mQueueMaxSize
 
std::queue< std::string > mQueue
 

Detailed Description

This is a helper class to handle a FIFO collection of subdirectories.

All the subdirectories will be created inside a base directory provided in the constructor. The maximum number of concurrent subdirectories is specified in the the constructor. Once this number is reached, the next call to CreateNextDir() will delete the oldest directory as a side effect.

Definition at line 50 of file OutputDirectoryFifoQueue.hpp.

Constructor & Destructor Documentation

◆ OutputDirectoryFifoQueue()

OutputDirectoryFifoQueue::OutputDirectoryFifoQueue ( const std::string &  rBaseDirectory,
unsigned  queueMaxSize 
)

Constructor.

Parameters
rBaseDirectorybase directory for all the subdirectories to be created
queueMaxSizemaximum number of subdirectories

Definition at line 43 of file OutputDirectoryFifoQueue.cpp.

References mBaseDirectory, and mQueue.

Member Function Documentation

◆ CreateNextDir()

std::string OutputDirectoryFifoQueue::CreateNextDir ( const std::string &  rSubdirectoryName)

Creates a subdirectory called rSubdirectoryName deleting the oldest subdirectory if the maximum number has been reached.

Note
Must be called collectively.
Parameters
rSubdirectoryNamesubdirectory name
Returns
new directory name relative to the base directory

Definition at line 54 of file OutputDirectoryFifoQueue.cpp.

References ABORT_IF_THROWS, PetscTools::AmMaster(), PetscTools::Barrier(), RelativeTo::ChasteTestOutput, mBaseDirectory, mQueue, mQueueMaxSize, and FileFinder::Remove().

Referenced by CardiacSimulation::CreateAndRun().

Member Data Documentation

◆ mBaseDirectory

std::string OutputDirectoryFifoQueue::mBaseDirectory
private

Base directory for all the subdirectories to be created.

Definition at line 54 of file OutputDirectoryFifoQueue.hpp.

Referenced by OutputDirectoryFifoQueue(), and CreateNextDir().

◆ mQueue

std::queue<std::string> OutputDirectoryFifoQueue::mQueue
private

The queue of names of subdirectories currently on the disk

Definition at line 56 of file OutputDirectoryFifoQueue.hpp.

Referenced by OutputDirectoryFifoQueue(), and CreateNextDir().

◆ mQueueMaxSize

unsigned OutputDirectoryFifoQueue::mQueueMaxSize
private

Maximum number of subdirectories

Definition at line 55 of file OutputDirectoryFifoQueue.hpp.

Referenced by CreateNextDir().


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