mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
General tidy-up
This commit is contained in:
@ -22,9 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
Wrapper for stat() system call.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fileStat.H"
|
#include "fileStat.H"
|
||||||
@ -35,33 +32,15 @@ Description
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
|
|
||||||
/*
|
|
||||||
#undef major
|
|
||||||
#undef minor
|
|
||||||
#undef makedev
|
|
||||||
|
|
||||||
# define major(dev) ((int)(((dev) >> 8) & 0xff))
|
|
||||||
# define minor(dev) ((int)((dev) & 0xff))
|
|
||||||
# define makedev(major, minor) ((((unsigned int) (major)) << 8) \
|
|
||||||
| ((unsigned int) (minor)))
|
|
||||||
*/
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct null
|
Foam::fileStat::fileStat()
|
||||||
fileStat::fileStat()
|
|
||||||
:
|
:
|
||||||
isValid_(false)
|
isValid_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Construct from components
|
Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
|
||||||
fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
|
|
||||||
{
|
{
|
||||||
// Work on volatile
|
// Work on volatile
|
||||||
volatile bool locIsValid = false;
|
volatile bool locIsValid = false;
|
||||||
@ -85,8 +64,7 @@ fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct from Istream.
|
Foam::fileStat::fileStat(Istream& is)
|
||||||
fileStat::fileStat(Istream& is)
|
|
||||||
{
|
{
|
||||||
is >> *this;
|
is >> *this;
|
||||||
}
|
}
|
||||||
@ -94,8 +72,7 @@ fileStat::fileStat(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// compare two fileStates for same device
|
bool Foam::fileStat::sameDevice(const fileStat& stat2) const
|
||||||
bool fileStat::sameDevice(const fileStat& stat2) const
|
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
isValid_
|
isValid_
|
||||||
@ -105,14 +82,14 @@ bool fileStat::sameDevice(const fileStat& stat2) const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare two fileStates for same Inode
|
|
||||||
bool fileStat::sameINode(const fileStat& stat2) const
|
bool Foam::fileStat::sameINode(const fileStat& stat2) const
|
||||||
{
|
{
|
||||||
return isValid_ && (status_.st_ino == stat2.status().st_ino);
|
return isValid_ && (status_.st_ino == stat2.status().st_ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare state against inode
|
|
||||||
bool fileStat::sameINode(const label iNode) const
|
bool Foam::fileStat::sameINode(const label iNode) const
|
||||||
{
|
{
|
||||||
return isValid_ && (status_.st_ino == ino_t(iNode));
|
return isValid_ && (status_.st_ino == ino_t(iNode));
|
||||||
}
|
}
|
||||||
@ -120,8 +97,7 @@ bool fileStat::sameINode(const label iNode) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Input in list syntax
|
Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
|
||||||
Istream& operator>>(Istream& is, fileStat& fStat)
|
|
||||||
{
|
{
|
||||||
// Read beginning of machine info list
|
// Read beginning of machine info list
|
||||||
is.readBegin("fileStat");
|
is.readBegin("fileStat");
|
||||||
@ -172,8 +148,7 @@ Istream& operator>>(Istream& is, fileStat& fStat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Output in list syntax
|
Foam::Ostream& Foam::operator<<(Ostream& os, const fileStat& fStat)
|
||||||
Ostream& operator<<(Ostream& os, const fileStat& fStat)
|
|
||||||
{
|
{
|
||||||
// Set precision so 32bit unsigned int can be printed
|
// Set precision so 32bit unsigned int can be printed
|
||||||
// int oldPrecision = os.precision();
|
// int oldPrecision = os.precision();
|
||||||
@ -200,8 +175,4 @@ Ostream& operator<<(Ostream& os, const fileStat& fStat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user