Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
76bf1609
Commit
76bf1609
authored
17 years ago
by
Mattijs Janssens
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev
parents
2491068f
9a3f9332
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OSspecific/Unix/fileStat.C
+14
-43
14 additions, 43 deletions
src/OSspecific/Unix/fileStat.C
with
14 additions
and
43 deletions
src/OSspecific/Unix/fileStat.C
+
14
−
43
View file @
76bf1609
...
...
@@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Wrapper for stat() system call.
\*---------------------------------------------------------------------------*/
#include
"fileStat.H"
...
...
@@ -35,33 +32,15 @@ Description
#include
<unistd.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 * * * * * * * * * * * * * * //
// Construct null
fileStat
::
fileStat
()
Foam
::
fileStat
::
fileStat
()
:
isValid_
(
false
)
{}
// Construct from components
fileStat
::
fileStat
(
const
fileName
&
fName
,
const
unsigned
int
maxTime
)
Foam
::
fileStat
::
fileStat
(
const
fileName
&
fName
,
const
unsigned
int
maxTime
)
{
// Work on volatile
volatile
bool
locIsValid
=
false
;
...
...
@@ -85,8 +64,7 @@ fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
}
// Construct from Istream.
fileStat
::
fileStat
(
Istream
&
is
)
Foam
::
fileStat
::
fileStat
(
Istream
&
is
)
{
is
>>
*
this
;
}
...
...
@@ -94,10 +72,9 @@ fileStat::fileStat(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// compare two fileStates for same device
bool
fileStat
::
sameDevice
(
const
fileStat
&
stat2
)
const
bool
Foam
::
fileStat
::
sameDevice
(
const
fileStat
&
stat2
)
const
{
return
return
isValid_
&&
(
major
(
status_
.
st_dev
)
==
major
(
stat2
.
status
().
st_dev
)
...
...
@@ -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
);
}
// 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
));
}
...
...
@@ -120,13 +97,12 @@ bool fileStat::sameINode(const label iNode) const
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// Input in list syntax
Istream
&
operator
>>
(
Istream
&
is
,
fileStat
&
fStat
)
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
fileStat
&
fStat
)
{
// Read beginning of machine info list
is
.
readBegin
(
"fileStat"
);
label
label
devMaj
,
devMin
,
ino
,
mode
,
uid
,
gid
,
rdevMaj
,
rdevMin
,
...
...
@@ -172,11 +148,10 @@ Istream& operator>>(Istream& is, fileStat& fStat)
}
// Output in list syntax
Ostream
&
operator
<<
(
Ostream
&
os
,
const
fileStat
&
fStat
)
Foam
::
Ostream
&
Foam
::
operator
<<
(
Ostream
&
os
,
const
fileStat
&
fStat
)
{
//Set precision so 32bit unsigned int can be printed
//
int oldPrecision = os.precision();
//
Set precision so 32bit unsigned int can be printed
//
int oldPrecision = os.precision();
int
oldPrecision
=
0
;
os
.
precision
(
10
);
...
...
@@ -200,8 +175,4 @@ Ostream& operator<<(Ostream& os, const fileStat& fStat)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// ************************************************************************* //
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment