summaryrefslogtreecommitdiff
path: root/tools/select.h
diff options
context:
space:
mode:
authorzwer <zwer@1f4bef6d-8e0a-0410-8695-e467da8aaccf>2006-01-24 13:11:45 +0000
committerzwer <zwer@1f4bef6d-8e0a-0410-8695-e467da8aaccf>2006-01-24 13:11:45 +0000
commite1dadf2dbdd2bcf65517310498ded03c821e463e (patch)
treedec66c46bd95574cd935883c8339cc80a5518bfc /tools/select.h
parent8f713939e81110b37fb289081216b3550c708c1f (diff)
downloadvdr-plugin-ffnetdev-e1dadf2dbdd2bcf65517310498ded03c821e463e.tar.gz
vdr-plugin-ffnetdev-e1dadf2dbdd2bcf65517310498ded03c821e463e.tar.bz2
Im Projektarchiv verschoben
git-svn-id: svn://svn.berlios.de/ffnetdev/trunk@4 1f4bef6d-8e0a-0410-8695-e467da8aaccf
Diffstat (limited to 'tools/select.h')
-rw-r--r--tools/select.h75
1 files changed, 0 insertions, 75 deletions
diff --git a/tools/select.h b/tools/select.h
deleted file mode 100644
index 7e873e2..0000000
--- a/tools/select.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef TOOLBOX_SELECT_H
-#define TOOLBOX_SELECT_H
-
-#include "tools/tools.h"
-
-#include <sys/types.h>
-
-/* cTBSelect provides an interface for polling UNIX-like file descriptors. */
-
-class cTBSelect {
-private:
- int m_MaxFiled;
-
- fd_set m_Rfds;
- fd_set m_Wfds;
-
-public:
- cTBSelect(void);
- virtual ~cTBSelect();
-
- /* Clear() resets the object for use in a new Select() call. All file
- descriptors and their previous states are invalidated. */
- virtual void Clear(void);
-
- /* Add() adds a file descriptor to be polled in the next Select() call.
- That call polls if the file is readable if Output is set to false,
- writeable otherwise. */
- virtual bool Add(int Filed, bool Output = false);
-
- /* Select() polls all descriptors added by Add() and returns as soon as
- one of those changes state (gets readable/writeable), or after
- TimeoutMs milliseconds, whichever happens first. It returns the number
- of filedescriptors that have changed state. On error, -1 is returned
- and errno is set appropriately. */
- virtual int Select(uint TimeoutMs);
-
- /* Select() polls all descriptors added by Add() and returns as soon as
- one of those changes state (gets readable/writeable). It returns the
- number of filedescriptors that have changed state. On error, -1 is
- returned and errno is set appropriately. */
- virtual int Select(void);
-
- /* CanRead() returns true if the descriptor has changed to readable during
- the last Select() call. Otherwise false is returned. */
- virtual bool CanRead(int FileNo) const;
-
- /* CanWrite() returns true if the descriptor has changed to writeable
- during the last Select() call. Otherwise false is returned. */
- virtual bool CanWrite(int FileNo) const;
-};
-
-inline void cTBSelect::Clear(void) {
- FD_ZERO(&m_Rfds);
- FD_ZERO(&m_Wfds);
- m_MaxFiled = -1;
-}
-
-inline bool cTBSelect::Add(int Filed, bool Output /* = false */) {
- if (Filed < 0) return false;
- FD_SET(Filed, Output ? &m_Wfds : &m_Rfds);
- if (Filed > m_MaxFiled) m_MaxFiled = Filed;
- return true;
-}
-
-inline bool cTBSelect::CanRead(int FileNo) const {
- if (FileNo < 0) return false;
- return FD_ISSET(FileNo, &m_Rfds);
-}
-
-inline bool cTBSelect::CanWrite(int FileNo) const {
- if (FileNo < 0) return false;
- return FD_ISSET(FileNo, &m_Wfds);
-}
-
-#endif // TOOLBOX_SELECT_H