Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvwatcher.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * Provides support for monitoring file changes. 00006 */ 00007 #ifndef __WVWATCHER_H 00008 #define __WVWATCHER_H 00009 00010 #include "wvfile.h" 00011 #include <sys/stat.h> 00012 00013 struct stat; 00014 00015 /** 00016 * The WvFileWatcher class provides support for files which sometimes 00017 * have data appended at the end. It only polls as often as your select() 00018 * delay, so be careful! 00019 * 00020 * The file is rewound and reopened if its inode changes or its 00021 * length gets shorter, under the assumption that we will want to see the 00022 * entire contents of the new file. 00023 */ 00024 class WvFileWatcher : public WvFile 00025 { 00026 WvString filename; 00027 int openmode; 00028 bool once_ok; 00029 struct stat last_st; 00030 off_t fpos; 00031 00032 protected: 00033 bool make_ok(bool retry); 00034 00035 public: 00036 WvFileWatcher(const char *_filename, int _mode); 00037 virtual bool isok() const; 00038 virtual size_t uread(void *buf, size_t size); 00039 virtual size_t uwrite(const void *buf, size_t size); 00040 virtual bool pre_select(SelectInfo &si); 00041 }; 00042 00043 #endif // __WVWATCHER_H

Generated on Tue Oct 5 01:09:21 2004 for WvStreams by doxygen 1.3.7