Debian Codegraph @

protolib/include/protoNotify.h

raw
1 #ifndef _PROTO_NOTIFY
2 #define _PROTO_NOTIFY
3
4 // This defines a base class used for Protolib classes
5 // that support or use asynchronous I/O notifications
6 class ProtoNotify
7 {
8 public:
9 ProtoNotify() : notify_flags(0) {}
10
11 enum NotifyFlag
12 {
13 NOTIFY_NONE = 0x00,
14 NOTIFY_INPUT = 0x01,
15 NOTIFY_OUTPUT = 0x02,
16 NOTIFY_EXCEPTION = 0x04,
17 NOTIFY_ERROR = 0x08
18 };
19 bool NotifyFlagIsSet(NotifyFlag theFlag) const
20 {return (0 != (notify_flags & theFlag));}
21 void SetNotifyFlag(NotifyFlag theFlag)
22 {notify_flags |= theFlag;}
23 void UnsetNotifyFlag(NotifyFlag theFlag)
24 {notify_flags &= ~theFlag;}
25 void SetNotifyFlags(int theFlags)
26 {notify_flags = theFlags;}
27 bool HasNotifyFlags() const
28 {return (0 != notify_flags);}
29 int GetNotifyFlags() const
30 {return notify_flags;}
31 void ClearNotifyFlags()
32 {notify_flags = 0;}
33
34 private:
35 int notify_flags;
36
37 }; // end class ProtoNotify
38
39
40 #endif // _PROTO_NOTIFY