00001 #ifndef CLASSLIB_IOSELECT_SELECT_H 00002 # define CLASSLIB_IOSELECT_SELECT_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "IOSelectFdMap.h" 00007 # ifndef _WIN32 00008 # include <sys/time.h> 00009 # include <sys/types.h> 00010 # include <sys/select.h> 00011 # include <unistd.h> 00012 # include <string.h> 00013 # include <errno.h> 00014 00015 // # include <fcntl.h> 00016 // # if TIME_WITH_SYS_TIME 00017 // # include <sys/time.h> 00018 // # include <time.h> 00019 // # else 00020 // # if HAVE_SYS_TIME_H 00021 // # include <sys/time.h> 00022 // # else 00023 // # include <time.h> 00024 // # endif 00025 // # endif 00026 00027 namespace lat { 00028 //<<<<<< PUBLIC DEFINES >>>>>> 00029 //<<<<<< PUBLIC CONSTANTS >>>>>> 00030 //<<<<<< PUBLIC TYPES >>>>>> 00031 //<<<<<< PUBLIC VARIABLES >>>>>> 00032 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00033 //<<<<<< CLASS DECLARATIONS >>>>>> 00034 00036 class IOSelectSelect : public IOSelectFdMap 00037 { 00038 public: 00039 IOSelectSelect (void); 00040 ~IOSelectSelect (void); 00041 00042 // Attaching and detaching descriptors 00043 virtual void attach (const IOSelectRequest &req); 00044 virtual void detach (const IOSelectRequest &req); 00045 virtual void clear (void); 00046 00047 // Descriptor listening states 00048 virtual void setMask (IOFD fd, unsigned value); 00049 virtual void andMask (IOFD fd, unsigned value); 00050 virtual void orMask (IOFD fd, unsigned value); 00051 00052 // Selection 00053 virtual bool wait (long msecs); 00054 virtual IOFD next (IOSelectEvent &event, IOSelectCB &cb); 00055 00056 private: 00058 IOFD m_maxfd; 00059 00061 IOFD m_current; 00062 00066 int m_nready; 00067 00069 fd_set m_r; 00070 00072 fd_set m_w; 00073 00075 fd_set m_e; 00076 00078 fd_set m_rstatus; 00079 00081 fd_set m_wstatus; 00082 00084 fd_set m_estatus; 00085 }; 00086 00087 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00088 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00089 00090 } // namespace lat 00091 # endif // ! _WIN32 00092 #endif // CLASSLIB_IOSELECT_SELECT_H