reSIProcate/rutil  9694
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
resip::Poll Class Reference

This class abstracts the Unix system call "poll". More...

#include <Poll.hxx>

List of all members.

Classes

class  FDEntry

Public Member Functions

 Poll ()
 ~Poll ()
const std::vector
< Poll::FDEntry * > & 
beforeExternWait ()
bool setEntryFDStateForExternWait (int fd, Poll::FDEntry::StateBitMask fdStateBitMask)
const std::vector
< Poll::FDEntry * > & 
afterExternWait ()

Static Public Member Functions

static int findFDInWaitResult (int fd, const std::vector< Poll::FDEntry * > &waitResult)

Private Member Functions

 Poll (const Poll &from)
 defined(RESIP_POLL_EXTERN) }
Polloperator= (const Poll &from)

Private Attributes

std::vector< Poll::FDEntry * > _fdEntryVector
int _maxFDPlus1
fd_set _readFDSet
fd_set _writeFDSet
std::map< int, Poll::FDEntry * > _fdEntryMap
std::vector< Poll::FDEntry * > _waitResult

Friends

class Poll::FDEntry

Detailed Description

This class abstracts the Unix system call "poll".

It offers implementations in terms of "poll" itself, "epoll", and "select". (Respectively #ifdef'd by RESIP_POLL_IMPL_POLL, RESIP_POLL_IMPL_SELECT, and RESIP_POLL_IMPL_EPOLL.) File descriptors are wrapped by inner class "Poll::FDEntry". The actual "poll" call is represented by method "wait", or if an application wants to control the system call directly, it can instead use methods "beforeExternWait", "setEntryFDStateForExternWait", and "afterExternWait". (The latter are selected by #define-ing RESIP_POLL_EXTERN.)

Definition at line 51 of file Poll.hxx.


Constructor & Destructor Documentation

Poll::Poll ( )

Definition at line 127 of file Poll.cxx.

References _readFDSet, and _writeFDSet.

   :
_maxFDPlus1(0) 
#endif
{
#ifdef RESIP_POLL_IMPL_SELECT
   FD_ZERO(&_readFDSet);
   FD_ZERO(&_writeFDSet);
#endif
}
Poll::~Poll ( )

Definition at line 140 of file Poll.cxx.

{
}
resip::Poll::Poll ( const Poll from) [private]

defined(RESIP_POLL_EXTERN) }


Member Function Documentation

const std::vector<Poll::FDEntry *>& resip::Poll::afterExternWait ( )
const std::vector<Poll::FDEntry *>& resip::Poll::beforeExternWait ( )
int Poll::findFDInWaitResult ( int  fd,
const std::vector< Poll::FDEntry * > &  waitResult 
) [static]

Definition at line 105 of file Poll.cxx.

{
   unsigned int lowIndex = 0;
   unsigned int highIndex = (unsigned int)waitResult.size();
   while (lowIndex + 1 < highIndex) 
   {
      // The goal fd is in waitResult in the range [lowIndex, highIndex[.
      unsigned int midIndex = (lowIndex + highIndex) / 2;
      if (waitResult[midIndex]->_fd > fd) 
      {
         highIndex = midIndex - 1;
      } 
      else 
      {
         lowIndex = midIndex;
      }
   }//while
   return lowIndex;
}
Poll& resip::Poll::operator= ( const Poll from) [private]
bool resip::Poll::setEntryFDStateForExternWait ( int  fd,
Poll::FDEntry::StateBitMask  fdStateBitMask 
)

Friends And Related Function Documentation

friend class Poll::FDEntry [friend]

Definition at line 136 of file Poll.hxx.


Member Data Documentation

std::map<int, Poll::FDEntry *> resip::Poll::_fdEntryMap [private]

Definition at line 151 of file Poll.hxx.

Referenced by resip::Poll::FDEntry::FDEntry().

std::vector<Poll::FDEntry *> resip::Poll::_fdEntryVector [private]

Definition at line 141 of file Poll.hxx.

Referenced by resip::Poll::FDEntry::FDEntry().

int resip::Poll::_maxFDPlus1 [private]

Definition at line 146 of file Poll.hxx.

Referenced by resip::Poll::FDEntry::FDEntry().

fd_set resip::Poll::_readFDSet [private]

Definition at line 147 of file Poll.hxx.

Referenced by resip::Poll::FDEntry::FDEntry(), and Poll().

std::vector<Poll::FDEntry *> resip::Poll::_waitResult [private]

Definition at line 153 of file Poll.hxx.

fd_set resip::Poll::_writeFDSet [private]

Definition at line 148 of file Poll.hxx.

Referenced by Poll().


The documentation for this class was generated from the following files: