HOPS
HOPS class reference
Public Member Functions | Static Public Member Functions | List of all members
hops::MHO_DirectoryInterface Class Reference

Class MHO_DirectoryInterface. More...

#include <MHO_DirectoryInterface.hh>

Public Member Functions

 MHO_DirectoryInterface ()
 
virtual ~MHO_DirectoryInterface ()
 
bool CreateDirectory (const std::string &dirname) const
 Creates a directory with given name and owner permissions. More...
 
void GetCorelFiles (const std::vector< std::string > &files, std::vector< std::string > &corel_files) const
 extracts legacy mk4 corel files from list of files More...
 
std::string GetCurrentDirectory () const
 Getter for current directory. More...
 
std::string GetCurrentParentDirectory () const
 Getter for current parent directory. More...
 
void GetFileList (std::vector< std::string > &aFileList) const
 Getter for file list. More...
 
void GetFilesMatchingExtention (std::vector< std::string > &aFileList, const char *anExt) const
 Getter for files matching extention. More...
 
void GetFilesMatchingExtention (std::vector< std::string > &aFileList, const std::string &anExt) const
 Getter for files matching extention. More...
 
void GetFilesMatchingPrefix (std::vector< std::string > &aFileList, const char *aPrefix) const
 Getter for files matching prefix. More...
 
void GetFilesMatchingPrefix (std::vector< std::string > &aFileList, const std::string &aPrefix) const
 Getter for files matching prefix. More...
 
void GetFringeFiles (const std::vector< std::string > &files, std::vector< std::string > &fringe_files, int &max_sequence_num) const
 extracts legacy mk4 fringe files from list of files More...
 
void GetRootFile (const std::vector< std::string > &files, std::string &root_file) const
 extracts legacy mk4 root file from list of files More...
 
void GetStationFiles (const std::vector< std::string > &files, std::vector< std::string > &station_files) const
 extracts legacy mk4 station files from list of files More...
 
void GetSubDirectoriesMatchingExtention (std::vector< std::string > &aDirList, const char *anExt) const
 
void GetSubDirectoriesMatchingExtention (std::vector< std::string > &aDirList, const std::string &anExt) const
 Getter for sub directories matching extention. More...
 
void GetSubDirectoryList (std::vector< std::string > &aSubDirList) const
 Getter for sub directory list. More...
 
bool ReadCurrentDirectory ()
 Checks if current directory exists and reads its files and directories. More...
 
void SetCurrentDirectory (const std::string &dirname)
 Setter for current directory. More...
 
void SplitCorelFileBasename (const std::string &corel_basename, std::string &st_pair, std::string &root_code) const
 splits out baseline and root code from basename of a legacy mk4 corel file More...
 
void SplitStationFileBasename (const std::string &station_basename, std::string &st, std::string &root_code) const
 splits out station char and root code from basename of a legacy mk4 station file More...
 

Static Public Member Functions

static bool DoesDirectoryExist (const std::string &dirname)
 Checks if a directory exists by attempting to open it. More...
 
static std::string GetBasename (const std::string &filename)
 gets the file name from a path to a file More...
 
static std::string GetDirectoryFullPath (const std::string &dirname)
 Getter for directory full path. More...
 
static std::string GetDirectoryFullPathPreserveSymlinks (const std::string &dirname)
 Getter for directory full path preserve symlinks. More...
 
static std::string GetFileModifcationTime (const std::string &name)
 Getter for file modifcation time. More...
 
static std::string GetPrefix (const std::string &filename)
 gets the directory prefix from a full path to a file More...
 
static bool IsDirectory (const std::string &name)
 Checks if a given path is a directory. More...
 
static bool IsFile (const std::string &name)
 Checks if a given path is a regular file. More...
 
static std::string StripExtensionFromBasename (const std::string &file_basename)
 removes the extention (anything after last '.') from a file (base) name More...
 

Detailed Description

Class MHO_DirectoryInterface.

implements utility functions to access a directory and locate files

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Tue Jun 1 16:14:04 2021 -0400

Constructor & Destructor Documentation

◆ MHO_DirectoryInterface()

hops::MHO_DirectoryInterface::MHO_DirectoryInterface ( )

◆ ~MHO_DirectoryInterface()

hops::MHO_DirectoryInterface::~MHO_DirectoryInterface ( )
virtual

Member Function Documentation

◆ CreateDirectory()

bool hops::MHO_DirectoryInterface::CreateDirectory ( const std::string &  dirname) const

Creates a directory with given name and owner permissions.

Parameters
dirnameThe name of the directory to create.
Returns
True if directory creation was successful, false otherwise.

◆ DoesDirectoryExist()

bool hops::MHO_DirectoryInterface::DoesDirectoryExist ( const std::string &  dirname)
static

Checks if a directory exists by attempting to open it.

Parameters
dirnameThe name of the directory to check.
Returns
True if the directory exists and can be opened, false otherwise.
Note
This is a static function.

◆ GetBasename()

std::string hops::MHO_DirectoryInterface::GetBasename ( const std::string &  filename)
static

gets the file name from a path to a file

◆ GetCorelFiles()

void hops::MHO_DirectoryInterface::GetCorelFiles ( const std::vector< std::string > &  files,
std::vector< std::string > &  corel_files 
) const

extracts legacy mk4 corel files from list of files

◆ GetCurrentDirectory()

std::string hops::MHO_DirectoryInterface::GetCurrentDirectory ( ) const

Getter for current directory.

Returns
The full path of the current directory as a std::string.

◆ GetCurrentParentDirectory()

std::string hops::MHO_DirectoryInterface::GetCurrentParentDirectory ( ) const

Getter for current parent directory.

Returns
The current parent directory as a std::string.

◆ GetDirectoryFullPath()

std::string hops::MHO_DirectoryInterface::GetDirectoryFullPath ( const std::string &  dirname)
static

Getter for directory full path.

Parameters
dirnameThe directory name to resolve.
Returns
The full absolute path as a string.
Note
This is a static function.

◆ GetDirectoryFullPathPreserveSymlinks()

std::string hops::MHO_DirectoryInterface::GetDirectoryFullPathPreserveSymlinks ( const std::string &  dirname)
static

Getter for directory full path preserve symlinks.

Parameters
dirnameInput directory name
Returns
Full path of the directory as a string
Note
This is a static function.

◆ GetFileList()

void hops::MHO_DirectoryInterface::GetFileList ( std::vector< std::string > &  aFileList) const

Getter for file list.

Parameters
aFileListOutput parameter: vector of strings to store file list

◆ GetFileModifcationTime()

std::string hops::MHO_DirectoryInterface::GetFileModifcationTime ( const std::string &  name)
static

Getter for file modifcation time.

Parameters
nameThe name of the file to retrieve modification time for.
Returns
A string representing the modification time of the file in timestamp format.
Note
This is a static function.

◆ GetFilesMatchingExtention() [1/2]

void hops::MHO_DirectoryInterface::GetFilesMatchingExtention ( std::vector< std::string > &  aFileList,
const char *  anExt 
) const

Getter for files matching extention.

Parameters
aFileListOutput vector to store matching file names
anExtExtension to match against

◆ GetFilesMatchingExtention() [2/2]

void hops::MHO_DirectoryInterface::GetFilesMatchingExtention ( std::vector< std::string > &  aFileList,
const std::string &  anExt 
) const

Getter for files matching extention.

Parameters
aFileListOutput vector to store matching file names.
anExtExtension pattern to match.

◆ GetFilesMatchingPrefix() [1/2]

void hops::MHO_DirectoryInterface::GetFilesMatchingPrefix ( std::vector< std::string > &  aFileList,
const char *  aPrefix 
) const

Getter for files matching prefix.

Parameters
aFileListOutput vector of matching file names
aPrefixInput string prefix to match against file names

◆ GetFilesMatchingPrefix() [2/2]

void hops::MHO_DirectoryInterface::GetFilesMatchingPrefix ( std::vector< std::string > &  aFileList,
const std::string &  aPrefix 
) const

Getter for files matching prefix.

Parameters
aFileListOutput vector of matching file names
aPrefixInput string prefix to match against file names

◆ GetFringeFiles()

void hops::MHO_DirectoryInterface::GetFringeFiles ( const std::vector< std::string > &  files,
std::vector< std::string > &  fringe_files,
int &  max_sequence_num 
) const

extracts legacy mk4 fringe files from list of files

◆ GetPrefix()

std::string hops::MHO_DirectoryInterface::GetPrefix ( const std::string &  filename)
static

gets the directory prefix from a full path to a file

◆ GetRootFile()

void hops::MHO_DirectoryInterface::GetRootFile ( const std::vector< std::string > &  files,
std::string &  root_file 
) const

extracts legacy mk4 root file from list of files

◆ GetStationFiles()

void hops::MHO_DirectoryInterface::GetStationFiles ( const std::vector< std::string > &  files,
std::vector< std::string > &  station_files 
) const

extracts legacy mk4 station files from list of files

◆ GetSubDirectoriesMatchingExtention() [1/2]

void hops::MHO_DirectoryInterface::GetSubDirectoriesMatchingExtention ( std::vector< std::string > &  aDirList,
const char *  anExt 
) const

◆ GetSubDirectoriesMatchingExtention() [2/2]

void hops::MHO_DirectoryInterface::GetSubDirectoriesMatchingExtention ( std::vector< std::string > &  aDirList,
const std::string &  anExt 
) const

Getter for sub directories matching extention.

Parameters
aDirListOutput vector to store matching directories
anExtExtension to match for filtering directories

◆ GetSubDirectoryList()

void hops::MHO_DirectoryInterface::GetSubDirectoryList ( std::vector< std::string > &  aSubDirList) const

Getter for sub directory list.

Parameters
aSubDirListOutput parameter: vector to store subdirectory list

◆ IsDirectory()

bool hops::MHO_DirectoryInterface::IsDirectory ( const std::string &  name)
static

Checks if a given path is a directory.

Parameters
namePath to check.
Returns
True if it's a directory, false otherwise.
Note
This is a static function.

◆ IsFile()

bool hops::MHO_DirectoryInterface::IsFile ( const std::string &  name)
static

Checks if a given path is a regular file.

Parameters
namePath to check as std::string&.
Returns
True if it's a regular file, false otherwise.
Note
This is a static function.

◆ ReadCurrentDirectory()

bool hops::MHO_DirectoryInterface::ReadCurrentDirectory ( )

Checks if current directory exists and reads its files and directories.

Returns
bool indicating success/failure.

◆ SetCurrentDirectory()

void hops::MHO_DirectoryInterface::SetCurrentDirectory ( const std::string &  dirname)

Setter for current directory.

Parameters
dirnameThe new directory path to set.

◆ SplitCorelFileBasename()

void hops::MHO_DirectoryInterface::SplitCorelFileBasename ( const std::string &  corel_basename,
std::string &  st_pair,
std::string &  root_code 
) const

splits out baseline and root code from basename of a legacy mk4 corel file

◆ SplitStationFileBasename()

void hops::MHO_DirectoryInterface::SplitStationFileBasename ( const std::string &  station_basename,
std::string &  st,
std::string &  root_code 
) const

splits out station char and root code from basename of a legacy mk4 station file

◆ StripExtensionFromBasename()

std::string hops::MHO_DirectoryInterface::StripExtensionFromBasename ( const std::string &  file_basename)
static

removes the extention (anything after last '.') from a file (base) name


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