CARMA C++
FdSet.h
Go to the documentation of this file.
1 #ifndef FDSET_H
2 #define FDSET_H
3 
11 #include <sys/select.h>
12 
13 namespace sza {
14  namespace util {
15 
16  class FdSet {
17  public:
18 
22  FdSet();
23 
27  virtual ~FdSet();
28 
33  void zeroReadFdSet();
34 
39  void zeroWriteFdSet();
40 
45  void registerReadFd(int fd);
46 
51  void registerWriteFd(int fd);
52 
57  void clearFromReadFdSet(int fd);
58 
63  void clearFromWriteFdSet(int fd);
64 
68  fd_set* readFdSet();
69 
73  fd_set* writeFdSet();
74 
78  int size();
79 
83  bool isSetInRead(int fd);
84 
88  bool isSetInWrite(int fd);
89 
93  void clear();
94 
98  void clear(int fd);
99 
103  void print();
104 
105  private:
106 
110  fd_set readFdSet_;
111 
116  fd_set readFdSetSave_;
117 
121  fd_set writeFdSet_;
122 
127  fd_set writeFdSetSave_;
128 
132  int fdSetSize_;
133 
134  }; // End class Fd
135 
136  }; // End namespace util
137 }; // End namespace sza
138 
139 #endif // End #ifndef
140 
141