Last change
on this file since 2961 was
2889,
checked in by adrfried, 16 years ago
|
FDWatcher and GGZClient Objects introduced
|
File size:
634 bytes
|
Rev | Line | |
---|
[2889] | 1 | #ifndef _FDWATCHER_H__ |
---|
| 2 | #define _FDWATCHER_H__ |
---|
| 3 | |
---|
| 4 | #include "objects/Tickable.h" |
---|
| 5 | |
---|
| 6 | #include <map> |
---|
| 7 | #include <poll.h> |
---|
| 8 | |
---|
| 9 | namespace orxonox |
---|
| 10 | { |
---|
| 11 | class _OrxonoxExport FDWatcher : public Tickable |
---|
| 12 | { |
---|
| 13 | typedef void (*intfunction) (int fd); |
---|
| 14 | |
---|
| 15 | public: |
---|
| 16 | FDWatcher(); |
---|
| 17 | ~FDWatcher(); |
---|
| 18 | |
---|
| 19 | virtual void tick(const float dt); |
---|
| 20 | |
---|
| 21 | void add(const int fd, intfunction cb); |
---|
| 22 | void remove(const int fd); |
---|
| 23 | |
---|
| 24 | private: |
---|
| 25 | std::map<int, intfunction> watches; |
---|
| 26 | pollfd * pollfds; |
---|
| 27 | int npollfds; |
---|
| 28 | |
---|
| 29 | void rebuild(); |
---|
| 30 | }; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | #endif /* _FDWATCHER_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.