All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fileStat Class Reference

Wrapper for stat() system call. More...

Public Member Functions

 fileStat ()
 Empty constructor. More...
 
 fileStat (const fileName &fName, const bool checkVariants=true, const bool followLink=true, const unsigned int maxTime=0)
 Construct from components. More...
 
 fileStat (Istream &)
 Construct from Istream. More...
 
const struct stat & status () const
 Raw status. More...
 
bool isValid () const
 Did constructor fail. More...
 
bool sameDevice (const fileStat &stat2) const
 Compare two fileStats for same device. More...
 
bool sameINode (const fileStat &stat2) const
 Compare two fileStats for same Inode. More...
 
bool sameINode (const label iNode) const
 Compare state against inode. More...
 

Static Public Attributes

static const label nVariants_ = 2
 Number of file variants. More...
 
static const char * variantExts_ [] = {"gz", "orig"}
 Extensions of the file variants. More...
 

Friends

Istreamoperator>> (Istream &, fileStat &)
 
Ostreamoperator<< (Ostream &, const fileStat &)
 

Detailed Description

Wrapper for stat() system call.

Warning
on Linux (an maybe on others) a stat() of an nfs mounted (remote) file does never timeout and cannot be interrupted! So e.g. Foam::ping first and hope nfs is running.
Source files

Definition at line 65 of file fileStat.H.

Constructor & Destructor Documentation

◆ fileStat() [1/3]

fileStat ( )

Empty constructor.

Definition at line 43 of file fileStat.C.

◆ fileStat() [2/3]

fileStat ( const fileName fName,
const bool  checkVariants = true,
const bool  followLink = true,
const unsigned int  maxTime = 0 
)

Construct from components.

followLink : in case of link get status of pointed-to file maxTime : time out

Definition at line 50 of file fileStat.C.

References fileStat::nVariants_, timedOut, and fileStat::variantExts_.

◆ fileStat() [3/3]

fileStat ( Istream is)

Construct from Istream.

Definition at line 89 of file fileStat.C.

Member Function Documentation

◆ status()

const struct stat& status ( ) const
inline

Raw status.

Definition at line 110 of file fileStat.H.

Referenced by Foam::fileSize(), Foam::highResLastModified(), Foam::lastModified(), Foam::mode(), fileStat::sameDevice(), and fileStat::sameINode().

Here is the caller graph for this function:

◆ isValid()

bool isValid ( ) const
inline

Did constructor fail.

Definition at line 116 of file fileStat.H.

References fileStat::operator<<, fileStat::operator>>, fileStat::sameDevice(), and fileStat::sameINode().

Referenced by Foam::fileSize(), Foam::highResLastModified(), Foam::lastModified(), and Foam::mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameDevice()

bool sameDevice ( const fileStat stat2) const

Compare two fileStats for same device.

Definition at line 97 of file fileStat.C.

References fileStat::status().

Referenced by fileStat::isValid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameINode() [1/2]

bool sameINode ( const fileStat stat2) const

Compare two fileStats for same Inode.

Definition at line 108 of file fileStat.C.

References fileStat::status().

Referenced by fileStat::isValid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameINode() [2/2]

bool sameINode ( const label  iNode) const

Compare state against inode.

Definition at line 114 of file fileStat.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
fileStat  
)
friend

Referenced by fileStat::isValid().

◆ operator<<

Ostream& operator<< ( Ostream ,
const fileStat  
)
friend

Referenced by fileStat::isValid().

Member Data Documentation

◆ nVariants_

const Foam::label nVariants_ = 2
static

Number of file variants.

Definition at line 79 of file fileStat.H.

Referenced by fileStat::fileStat(), Foam::readDir(), and Foam::rm().

◆ variantExts_

const char * variantExts_ = {"gz", "orig"}
static

Extensions of the file variants.

Definition at line 82 of file fileStat.H.

Referenced by fileStat::fileStat(), Foam::readDir(), and Foam::rm().


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