Checking for changes to files. More...
Public Types | |
enum | fileState { UNMODIFIED = 0, MODIFIED = 1, DELETED = 2 } |
Enumeration defining the file state. More... | |
Public Member Functions | |
ClassName ("fileMonitor") | |
fileMonitor (const bool useInotify) | |
Construct null. More... | |
~fileMonitor () | |
Destructor. More... | |
label | addWatch (const fileName &) |
Add file to watch. Return watch descriptor. More... | |
bool | removeWatch (const label watchFd) |
Remove file to watch. Return true if successful. More... | |
const fileName & | getFile (const label watchFd) const |
Get name of file being watched. More... | |
fileState | getState (const label watchFd) const |
Check state using handle. More... | |
void | updateStates (const bool masterOnly, const bool syncPar) const |
Check state of all files. Updates state_. More... | |
void | setUnmodified (const label watchFd) |
Reset state (e.g. after having read it) using handle. More... | |
Static Public Attributes | |
static const Enum< fileState > | fileStateNames_ |
Checking for changes to files.
Compile with FOAM_USE_INOTIFY to use the inotify (Linux specific, since 2.6.13) framework. The problem is that inotify does not work on nfs3 mounted directories!!
Definition at line 62 of file fileMonitor.H.
enum fileState |
Enumeration defining the file state.
Enumerator | |
---|---|
UNMODIFIED | |
MODIFIED | |
DELETED |
Definition at line 71 of file fileMonitor.H.
|
explicit |
Construct null.
Definition at line 438 of file fileMonitor.C.
~fileMonitor | ( | ) |
Destructor.
Definition at line 451 of file fileMonitor.C.
ClassName | ( | "fileMonitor" | ) |
Foam::label addWatch | ( | const fileName & | fName | ) |
Add file to watch. Return watch descriptor.
Definition at line 459 of file fileMonitor.C.
References Foam::ensightOutput::debug, Foam::endl(), Foam::Pout, and WarningInFunction.
bool removeWatch | ( | const label | watchFd | ) |
Remove file to watch. Return true if successful.
Definition at line 500 of file fileMonitor.C.
References Foam::ensightOutput::debug, Foam::endl(), and Foam::Pout.
const Foam::fileName & getFile | ( | const label | watchFd | ) | const |
Get name of file being watched.
Definition at line 514 of file fileMonitor.C.
Foam::fileMonitor::fileState getState | ( | const label | watchFd | ) | const |
Check state using handle.
Definition at line 520 of file fileMonitor.C.
void updateStates | ( | const bool | masterOnly, |
const bool | syncPar | ||
) | const |
Check state of all files. Updates state_.
Definition at line 528 of file fileMonitor.C.
References Pstream::broadcast(), Foam::ensightOutput::debug, Foam::endl(), forAll, Pstream::listCombineGather(), UPstream::master(), Foam::Pout, Foam::reduce(), and WarningInFunction.
void setUnmodified | ( | const label | watchFd | ) |
Reset state (e.g. after having read it) using handle.
Definition at line 624 of file fileMonitor.C.
References Foam::highResLastModified().
|
static |
Definition at line 78 of file fileMonitor.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.