summaryrefslogtreecommitdiff
path: root/lib/common/EventWatchFilesystemObject.h
blob: f9175a49435af4a5c7a7b35dcfc38c73da356954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// --------------------------------------------------------------------------
//
// File
//		Name:    EventWatchFilesystemObject.h
//		Purpose: WaitForEvent compatible object for watching directories
//		Created: 12/3/04
//
// --------------------------------------------------------------------------

#ifndef EVENTWATCHFILESYSTEMOBJECT__H
#define EVENTWATCHFILESYSTEMOBJECT__H

#ifdef HAVE_KQUEUE
	#include <sys/event.h>
#endif


// --------------------------------------------------------------------------
//
// Class
//		Name:    EventWatchFilesystemObject
//		Purpose: WaitForEvent compatible object for watching files and directories
//		Created: 12/3/04
//
// --------------------------------------------------------------------------
class EventWatchFilesystemObject
{
public:
	EventWatchFilesystemObject(const char *Filename);
	~EventWatchFilesystemObject();
	EventWatchFilesystemObject(const EventWatchFilesystemObject &rToCopy);
private:
	// Assignment not allowed
	EventWatchFilesystemObject &operator=(const EventWatchFilesystemObject &);
public:

#ifdef HAVE_KQUEUE
	void FillInKEvent(struct kevent &rEvent, int Flags = 0) const;
#else
	void FillInPoll(int &fd, short &events, int Flags = 0) const;
#endif

private:
	int mDescriptor;
};

#endif // EventWatchFilesystemObject__H