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 49 of file fileStat.C.

References timedOut.

◆ 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.

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

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().

Here is the call 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().

Here is the call 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

◆ operator<<

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

Member Data Documentation

◆ nVariants_

const Foam::label nVariants_ = 2
static

Number of file variants.

Definition at line 79 of file fileStat.H.

◆ variantExts_

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

Extensions of the file variants.

Definition at line 82 of file fileStat.H.


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