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 (const fileMonitor &)=delete | |
Disallow default bitwise copy construction. 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... | |
void | operator= (const fileMonitor &)=delete |
Disallow default bitwise assignment. More... | |
Static Public Attributes | |
static const NamedEnum< fileState, 3 > | 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 61 of file fileMonitor.H.
enum fileState |
Enumeration defining the file state.
Enumerator | |
---|---|
UNMODIFIED | |
MODIFIED | |
DELETED |
Definition at line 69 of file fileMonitor.H.
fileMonitor | ( | const bool | useInotify | ) |
Construct null.
Definition at line 429 of file fileMonitor.C.
|
delete |
Disallow default bitwise copy construction.
~fileMonitor | ( | ) |
Destructor.
Definition at line 442 of file fileMonitor.C.
ClassName | ( | "fileMonitor" | ) |
Foam::label addWatch | ( | const fileName & | fName | ) |
Add file to watch. Return watch descriptor.
Definition at line 450 of file fileMonitor.C.
References Foam::endl(), Foam::Pout, DynamicList< T, SizeInc, SizeMult, SizeDiv >::setSize(), List< T >::size(), fileMonitor::UNMODIFIED, and WarningInFunction.
Referenced by fileOperation::addWatch().
bool removeWatch | ( | const label | watchFd | ) |
Remove file to watch. Return true if successful.
Definition at line 489 of file fileMonitor.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), Foam::endl(), and Foam::Pout.
Referenced by fileOperation::removeWatch().
const Foam::fileName & getFile | ( | const label | watchFd | ) | const |
Get name of file being watched.
Definition at line 502 of file fileMonitor.C.
Referenced by fileOperation::getFile().
Foam::fileMonitor::fileState getState | ( | const label | watchFd | ) | const |
Check state using handle.
Definition at line 508 of file fileMonitor.C.
References fileMonitor::updateStates().
Referenced by fileOperation::getState().
void updateStates | ( | const bool | masterOnly, |
const bool | syncPar | ||
) | const |
Check state of all files. Updates state_.
Definition at line 516 of file fileMonitor.C.
References Foam::endl(), forAll, Pstream::listCombineGather(), Pstream::listCombineScatter(), UPstream::master(), fileMonitor::MODIFIED, Foam::Pout, Foam::reduce(), Pstream::scatter(), List< T >::size(), and WarningInFunction.
Referenced by fileMonitor::getState(), and fileOperation::updateStates().
void setUnmodified | ( | const label | watchFd | ) |
Reset state (e.g. after having read it) using handle.
Definition at line 611 of file fileMonitor.C.
References Foam::highResLastModified(), and fileMonitor::UNMODIFIED.
Referenced by fileOperation::setUnmodified().
|
delete |
Disallow default bitwise assignment.
|
static |
Definition at line 76 of file fileMonitor.H.