Public Member Functions | Private Attributes | Friends
fileStat Class Reference

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

Public Member Functions

 fileStat ()
 Empty constructor. More...
 
 fileStat (const fileName &fName, 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...
 

Private Attributes

struct stat status_
 
bool isValid_
 

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

◆ fileStat() [2/3]

fileStat ( const fileName fName,
const unsigned int  maxTime = 0 
)

Construct from components.

Definition at line 45 of file fileStat.C.

References timedOut.

◆ fileStat() [3/3]

fileStat ( Istream is)

Construct from Istream.

Definition at line 69 of file fileStat.C.

Member Function Documentation

◆ status()

const struct stat& status ( ) const
inline

Raw status.

Definition at line 93 of file fileStat.H.

References fileStat::status_.

Referenced by Foam::fileSize(), 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 99 of file fileStat.H.

References fileStat::isValid_.

Referenced by Foam::fileSize(), 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 77 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 88 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 94 of file fileStat.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
fileStat  
)
friend

◆ operator<<

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

Field Documentation

◆ status_

struct stat status_
private

Definition at line 69 of file fileStat.H.

Referenced by Foam::operator<<(), Foam::operator>>(), and fileStat::status().

◆ isValid_

bool isValid_
private

Definition at line 71 of file fileStat.H.

Referenced by fileStat::isValid(), Foam::operator<<(), and Foam::operator>>().


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