IOSS 2.0
|
Return information about the specified file. More...
#include <Ioss_FileInfo.h>
Public Member Functions | |
FileInfo () | |
Empty class referring to no file. | |
FileInfo (std::string my_filename) | |
FileInfo (const char *my_filename) | |
FileInfo (const FileInfo &) | |
Copy constructor. | |
FileInfo (const std::string &dirpath, const std::string &my_filename) | |
IOSS_NODISCARD int | parallel_exists (Ioss_MPI_Comm communicator, std::string &where) const |
IOSS_NODISCARD bool | exists () const |
returns True if file exists, false if nonexistent | |
IOSS_NODISCARD bool | is_readable () const |
Exists and is readable. | |
IOSS_NODISCARD bool | is_writable () const |
Exists and is writable. | |
IOSS_NODISCARD bool | is_executable () const |
Exists and is executable. | |
IOSS_NODISCARD bool | is_file () const |
Is a plain file. | |
IOSS_NODISCARD bool | is_dir () const |
Is a directory. | |
IOSS_NODISCARD bool | is_symlink () const |
Is a symbolic link to a file or directory. | |
IOSS_NODISCARD bool | is_nfs () const |
Is on an NFS filesystem. | |
IOSS_NODISCARD time_t | modified () const |
Time of last data modification. See 'man stat(2)'. | |
IOSS_NODISCARD time_t | accessed () const |
Time of last access. | |
IOSS_NODISCARD time_t | created () const |
Time of last status change. (creation, chmod, ...) | |
IOSS_NODISCARD off_t | size () const |
File size in bytes. Only if is_file() == true. | |
IOSS_NODISCARD std::string | filename () const |
Complete filename including path. | |
IOSS_NODISCARD std::string | basename () const |
strip path and extension | |
IOSS_NODISCARD std::string | tailname () const |
basename() + extension() | |
IOSS_NODISCARD std::string | extension () const |
file extension. | |
IOSS_NODISCARD std::string | pathname () const |
directory path, no filename | |
IOSS_NODISCARD std::string | realpath () const |
canonicalized absolute path | |
void | set_filename (const std::string &name) |
void | set_filename (const char *name) |
IOSS_NODISCARD bool | operator== (const FileInfo &other) const |
IOSS_NODISCARD bool | operator!= (const FileInfo &other) const |
bool | remove_file () |
Static Public Member Functions | |
static void | create_path (const std::string &filename, IOSS_MAYBE_UNUSED Ioss_MPI_Comm communicator) |
static void | create_path (const std::string &filename) |
Private Attributes | |
std::string | filename_ {} |
bool | exists_ {false} |
this is used frequently, check on creation | |
bool | readable_ {false} |
this is used frequently, check on creation | |
Return information about the specified file.
A very minimal class (at least it used to be) for providing information about a file. FileInfo provides information about a file's name, path, and type (directory, symbolic link, file). Other information could be added as needed. It currently does not cache any information, so if it is heavily used, a caching capability should be added. See the Qt Toolkit QFileInfo class for a richer file class.
|
default |
Empty class referring to no file.
|
explicit |
Create object referring to file with name filename
my_filename | name of file |
|
explicit |
Create object referring to file with name filename
my_filename | name of file |
|
default |
Copy constructor.
Ioss::FileInfo::FileInfo | ( | const std::string & | dirpath, |
const std::string & | my_filename ) |
Constructor
dirpath | Directory Path |
my_filename | base filename |
time_t Ioss::FileInfo::accessed | ( | ) | const |
Time of last access.
std::string Ioss::FileInfo::basename | ( | ) | const |
strip path and extension
|
static |
|
static |
This function is used to create the path to an output directory (or history, restart, etc.) if it does not exist. Called by all processors. Will throw exception if path does not specify a valid directory or if the path cannot be created.
time_t Ioss::FileInfo::created | ( | ) | const |
Time of last status change. (creation, chmod, ...)
bool Ioss::FileInfo::exists | ( | ) | const |
returns True if file exists, false if nonexistent
std::string Ioss::FileInfo::extension | ( | ) | const |
file extension.
std::string Ioss::FileInfo::filename | ( | ) | const |
Complete filename including path.
bool Ioss::FileInfo::is_dir | ( | ) | const |
Is a directory.
bool Ioss::FileInfo::is_executable | ( | ) | const |
Exists and is executable.
bool Ioss::FileInfo::is_file | ( | ) | const |
Is a plain file.
bool Ioss::FileInfo::is_nfs | ( | ) | const |
Is on an NFS filesystem.
bool Ioss::FileInfo::is_readable | ( | ) | const |
Exists and is readable.
bool Ioss::FileInfo::is_symlink | ( | ) | const |
Is a symbolic link to a file or directory.
bool Ioss::FileInfo::is_writable | ( | ) | const |
Exists and is writable.
time_t Ioss::FileInfo::modified | ( | ) | const |
Time of last data modification. See 'man stat(2)'.
|
inline |
|
inline |
int Ioss::FileInfo::parallel_exists | ( | Ioss_MPI_Comm | communicator, |
std::string & | where ) const |
returns the number of processors that this file exists. 0: Exists nowhere #proc: Exists everywhere else: exists on some proc, but not all. In the last case, a list of processors where it is missing is returned in 'where' on processor 0.
std::string Ioss::FileInfo::pathname | ( | ) | const |
directory path, no filename
std::string Ioss::FileInfo::realpath | ( | ) | const |
canonicalized absolute path
bool Ioss::FileInfo::remove_file | ( | ) |
void Ioss::FileInfo::set_filename | ( | const char * | name | ) |
void Ioss::FileInfo::set_filename | ( | const std::string & | name | ) |
off_t Ioss::FileInfo::size | ( | ) | const |
File size in bytes. Only if is_file() == true.
std::string Ioss::FileInfo::tailname | ( | ) | const |
|
private |
this is used frequently, check on creation
|
private |
|
private |
this is used frequently, check on creation