fileMonitor Class Reference

Checking for changes to files. More...

Collaboration diagram for fileMonitor:
[legend]

Public Types

enum  fileState {
  UNMODIFIED = 0, MODIFIED = 1, DELETED = 2, UNMODIFIED = 0,
  MODIFIED = 1, DELETED = 2
}
 Enumeration defining the file state. More...
 
enum  fileState {
  UNMODIFIED = 0, MODIFIED = 1, DELETED = 2, 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 fileNamegetFile (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...
 
 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 fileNamegetFile (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< fileStatefileStateNames_
 

Detailed Description

Checking for changes to files.

Note
The default is to use stat to get the timestamp.

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!!

Source files

Note
The default is to use stat to get the timestamp.

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!!

Source files

Definition at line 66 of file fileMonitor.H.

Member Enumeration Documentation

◆ fileState [1/2]

enum fileState

Enumeration defining the file state.

Enumerator
UNMODIFIED 
MODIFIED 
DELETED 
UNMODIFIED 
MODIFIED 
DELETED 

Definition at line 73 of file fileMonitor.H.

◆ fileState [2/2]

enum fileState

Enumeration defining the file state.

Enumerator
UNMODIFIED 
MODIFIED 
DELETED 
UNMODIFIED 
MODIFIED 
DELETED 

Definition at line 73 of file fileMonitor.H.

Constructor & Destructor Documentation

◆ fileMonitor() [1/2]

fileMonitor ( const bool  useInotify)

Construct null.

Definition at line 431 of file fileMonitor.C.

◆ ~fileMonitor() [1/2]

Destructor.

Definition at line 444 of file fileMonitor.C.

◆ fileMonitor() [2/2]

fileMonitor ( const bool  useInotify)
explicit

Construct null.

◆ ~fileMonitor() [2/2]

Destructor.

Member Function Documentation

◆ ClassName() [1/2]

ClassName ( "fileMonitor"  )

◆ addWatch() [1/2]

Foam::label addWatch ( const fileName fName)

Add file to watch. Return watch descriptor.

Definition at line 452 of file fileMonitor.C.

References Foam::expressions::patchExpr::debug, Foam::endl(), Foam::Pout, and WarningInFunction.

Here is the call graph for this function:

◆ removeWatch() [1/2]

bool removeWatch ( const label  watchFd)

Remove file to watch. Return true if successful.

Definition at line 493 of file fileMonitor.C.

References Foam::expressions::patchExpr::debug, Foam::endl(), and Foam::Pout.

Here is the call graph for this function:

◆ getFile() [1/2]

const Foam::fileName & getFile ( const label  watchFd) const

Get name of file being watched.

Definition at line 507 of file fileMonitor.C.

◆ getState() [1/2]

Foam::fileMonitor::fileState getState ( const label  watchFd) const

Check state using handle.

Definition at line 513 of file fileMonitor.C.

◆ updateStates() [1/2]

void updateStates ( const bool  masterOnly,
const bool  syncPar 
) const

Check state of all files. Updates state_.

Definition at line 521 of file fileMonitor.C.

References Foam::expressions::patchExpr::debug, Foam::endl(), forAll, Pstream::listCombineGather(), Pstream::listCombineScatter(), UPstream::master(), Foam::Pout, Foam::reduce(), Pstream::scatter(), and WarningInFunction.

Here is the call graph for this function:

◆ setUnmodified() [1/2]

void setUnmodified ( const label  watchFd)

Reset state (e.g. after having read it) using handle.

Definition at line 617 of file fileMonitor.C.

References Foam::highResLastModified().

Here is the call graph for this function:

◆ ClassName() [2/2]

ClassName ( "fileMonitor"  )

◆ addWatch() [2/2]

label addWatch ( const fileName )

Add file to watch. Return watch descriptor.

◆ removeWatch() [2/2]

bool removeWatch ( const label  watchFd)

Remove file to watch. Return true if successful.

◆ getFile() [2/2]

const fileName& getFile ( const label  watchFd) const

Get name of file being watched.

◆ getState() [2/2]

fileState getState ( const label  watchFd) const

Check state using handle.

◆ updateStates() [2/2]

void updateStates ( const bool  masterOnly,
const bool  syncPar 
) const

Check state of all files. Updates state_.

◆ setUnmodified() [2/2]

void setUnmodified ( const label  watchFd)

Reset state (e.g. after having read it) using handle.

Member Data Documentation

◆ fileStateNames_

static const Enum< fileState > fileStateNames_
static

Definition at line 80 of file fileMonitor.H.


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