gtkIOStream
1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
|
#include <FileWatchThreaded.H>
Public Member Functions | |
FileWatchThreaded () | |
Constructor. More... | |
virtual | ~FileWatchThreaded () |
Destructor. More... | |
virtual int | add (std::string path) |
virtual int | addFile (std::string path) |
Public Member Functions inherited from ThreadedMethod | |
virtual int | run (int priority=0) |
Public Member Functions inherited from Thread | |
Thread (void) | |
virtual | ~Thread (void) |
void * | stop (void) |
int | run (void *(*start_routine)(void *), void *data, int priority=0) |
int | setPriority (pthread_attr_t *attributes, int priority) |
int | getPriority () |
void * | meetThread (void) |
void | exit (void *retVal) |
bool | running () |
Private Member Functions | |
char eventBuf [BUF_SIZE] | __attribute__ ((aligned(__alignof__(struct inotify_event)))) |
The buffered events. More... | |
virtual void * | threadMain (void) |
virtual void | modified (char *name) |
virtual void | closeWrite (char *name) |
Private Attributes | |
int | fd |
The inotify file descriptor. More... | |
std::map< std::string, int > | pathFds |
This will contain a map between watch file descriptors and file/dir names. More... | |
Class to watch a file and execute on state change - based on inotify Usage is like so :
At this point, a thread has started and it is watching the directorys or files you specified. If they change, then you can overload modified or closeWrite below to catch those events. Here is an example of a class which overloads those methods :
Definition at line 47 of file FileWatchThreaded.H.
|
inline |
Constructor.
Definition at line 89 of file FileWatchThreaded.H.
|
inlinevirtual |
Destructor.
Definition at line 98 of file FileWatchThreaded.H.
|
private |
The buffered events.
|
inlinevirtual |
Add a file or directory to watch here
path | The directory or file to watch |
Definition at line 105 of file FileWatchThreaded.H.
|
inlinevirtual |
Add a file or directory to watch here, if it doesn't exist, then create
path | The directory or file to watch |
Definition at line 117 of file FileWatchThreaded.H.
|
inlineprivatevirtual |
Overload this function to deal with IN_CLOSE_WRITE events
name | When watching a directory, the file name modified is given here |
Definition at line 84 of file FileWatchThreaded.H.
|
inlineprivatevirtual |
Overload this function to deal with IN_MODIFY events
name | When watching a directory, the file name modified is given here |
Definition at line 78 of file FileWatchThreaded.H.
|
inlineprivatevirtual |
The inheriting class implements the thread's main method.
Implements ThreadedMethod.
Definition at line 55 of file FileWatchThreaded.H.
|
private |
The inotify file descriptor.
Definition at line 48 of file FileWatchThreaded.H.
|
private |
This will contain a map between watch file descriptors and file/dir names.
Definition at line 53 of file FileWatchThreaded.H.
GTK+ IOStream
Beta
|