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

#include <Poll.hxx>

Collaboration diagram for resip::Poll::FDEntry:
Collaboration graph
[legend]

List of all members.

Public Types

enum  FDStateBitMaskEnum { fdsbmReadable = 0x0001, fdsbmWritable = 0x0004, fdsbmError = 0x0008, fdsbmAll }
enum  ResipStateBitMaskEnum { rsbmIsTransport = 0x0040, rsbmIsWritePending = 0x0080 }
typedef unsigned short StateBitMask
typedef StateBitMask FDStateBitMask
typedef StateBitMask ResipStateBitMask

Public Member Functions

 FDEntry (Poll *poll, bool isTransport, int fd)
virtual ~FDEntry ()
int getFD () const
Poll::FDEntry::StateBitMask getStateBitMask () const
void clearFDState ()

Protected Member Functions

void setIsWritePending (bool isWritePending)
virtual void doRead ()
virtual void doWrite ()
virtual void doError ()

Private Member Functions

 FDEntry (const Poll::FDEntry &from)
Poll::FDEntryoperator= (const Poll::FDEntry &from)

Static Private Member Functions

static int compare (const Poll::FDEntry *leftFDEntry, const Poll::FDEntry *rightFDEntry)

Private Attributes

Poll_poll
int _fd
Poll::FDEntry::StateBitMask _stateBitMask
unsigned short _index

Friends

class Poll

Detailed Description

Definition at line 55 of file Poll.hxx.


Member Typedef Documentation

Definition at line 70 of file Poll.hxx.

Definition at line 75 of file Poll.hxx.

typedef unsigned short resip::Poll::FDEntry::StateBitMask

Definition at line 61 of file Poll.hxx.


Member Enumeration Documentation

Enumerator:
fdsbmReadable 
fdsbmWritable 
fdsbmError 
fdsbmAll 

Definition at line 62 of file Poll.hxx.

                                    {
               fdsbmReadable       = 0x0001, // (POLLIN)
               fdsbmWritable       = 0x0004, // (POLLOUT)
               fdsbmError          = 0x0008, // (POLLERR)
               fdsbmAll            = Poll::FDEntry::fdsbmReadable |
               Poll::FDEntry::fdsbmWritable |
               Poll::FDEntry::fdsbmError
            };
Enumerator:
rsbmIsTransport 
rsbmIsWritePending 

Definition at line 71 of file Poll.hxx.

                                       {
               rsbmIsTransport    = 0x0040,
               rsbmIsWritePending = 0x0080
            };

Constructor & Destructor Documentation

Poll::FDEntry::FDEntry ( Poll poll,
bool  isTransport,
int  fd 
)

Definition at line 14 of file Poll.cxx.

References _fd, resip::Poll::_fdEntryMap, resip::Poll::_fdEntryVector, resip::Poll::_maxFDPlus1, _poll, and resip::Poll::_readFDSet.

                                 :
   _poll(poll),
   _fd(fd),
   _stateBitMask(isTransport ? Poll::FDEntry::rsbmIsTransport : 0),
   _index((unsigned short)poll->_fdEntryVector.size())
{
   _poll->_fdEntryVector.push_back(this);
#ifdef RESIP_POLL_IMPL_POLL
   pollfd pollFD;
   pollFD.fd = fd;
   pollFD.events = POLLIN;
   _poll->_pollFDVector.push_back(pollFD);
#endif
#ifdef RESIP_POLL_IMPL_SELECT
   if (_fd >= _poll->_maxFDPlus1) 
   {
      _poll->_maxFDPlus1 = _fd + 1;
   }
   FD_SET(_fd, &(_poll->_readFDSet));
#endif
#ifdef RESIP_POLL_EXTERN
   _poll->_fdEntryMap.insert(std::pair<int/*FD*/, Poll::FDEntry *>(_fd, this));
#endif
}
Poll::FDEntry::~FDEntry ( ) [virtual]

Definition at line 42 of file Poll.cxx.

References _index.

{
   vector<Poll::FDEntry *> &fdEntryVector = _poll->_fdEntryVector;
   Poll::FDEntry *lastFDEntry = fdEntryVector[fdEntryVector.size() - 1];
   lastFDEntry->_index = _index;
   fdEntryVector[_index] = lastFDEntry;
   fdEntryVector.pop_back();
#ifdef RESIP_POLL_IMPL_POLL
   vector<pollfd> &pollFDVector = _poll->_pollFDVector;
   pollFDVector[_index] = pollFDVector[pollFDVector.size() - 1];
   pollFDVector.pop_back();
#endif
#ifdef RESIP_POLL_IMPL_SELECT
   FD_CLR(_fd, &(_poll->_readFDSet));
   FD_CLR(_fd, &(_poll->_writeFDSet));
#endif
#ifdef RESIP_POLL_EXTERN
   _poll->_fdEntryMap.erase(_fd);
#endif
}
resip::Poll::FDEntry::FDEntry ( const Poll::FDEntry from) [private]

Member Function Documentation

void Poll::FDEntry::clearFDState ( )

Definition at line 64 of file Poll.cxx.

int Poll::FDEntry::compare ( const Poll::FDEntry leftFDEntry,
const Poll::FDEntry rightFDEntry 
) [static, private]

Definition at line 95 of file Poll.cxx.

References getFD().

{
   return (leftFDEntry->getFD() - rightFDEntry->getFD());
}

Here is the call graph for this function:

virtual void resip::Poll::FDEntry::doError ( ) [inline, protected, virtual]

Definition at line 124 of file Poll.hxx.

{};
virtual void resip::Poll::FDEntry::doRead ( ) [inline, protected, virtual]

Definition at line 122 of file Poll.hxx.

{};
virtual void resip::Poll::FDEntry::doWrite ( ) [inline, protected, virtual]

Definition at line 123 of file Poll.hxx.

{};
int resip::Poll::FDEntry::getFD ( ) const [inline]

Definition at line 102 of file Poll.hxx.

References _fd.

Referenced by compare().

            {
               return _fd;
            }
Poll::FDEntry::StateBitMask resip::Poll::FDEntry::getStateBitMask ( ) const [inline]

Definition at line 109 of file Poll.hxx.

References _stateBitMask.

            {
               return _stateBitMask;
            }
Poll::FDEntry& resip::Poll::FDEntry::operator= ( const Poll::FDEntry from) [private]
void Poll::FDEntry::setIsWritePending ( bool  isWritePending) [protected]

Definition at line 70 of file Poll.cxx.

References fdsbmWritable, and rsbmIsWritePending.

{
   if (isWritePending) 
   {
      _stateBitMask |= Poll::FDEntry::rsbmIsWritePending;
#ifdef RESIP_POLL_IMPL_POLL
      _poll->_pollFDVector[_index].events |= Poll::FDEntry::fdsbmWritable;
#endif
#ifdef RESIP_POLL_IMPL_SELECT
      FD_SET(_fd, &(_poll->_writeFDSet));
#endif
   } else 
   {
      _stateBitMask &= ~Poll::FDEntry::rsbmIsWritePending;
#ifdef RESIP_POLL_IMPL_POLL
      _poll->_pollFDVector[_index].events &= ~Poll::FDEntry::fdsbmWritable;
#endif
#ifdef RESIP_POLL_IMPL_SELECT
      FD_CLR(_fd, &(_poll->_writeFDSet));
#endif
   }
}

Friends And Related Function Documentation

friend class Poll [friend]

Definition at line 57 of file Poll.hxx.


Member Data Documentation

Definition at line 86 of file Poll.hxx.

Referenced by FDEntry(), and getFD().

unsigned short resip::Poll::FDEntry::_index [private]

Definition at line 88 of file Poll.hxx.

Referenced by ~FDEntry().

Definition at line 85 of file Poll.hxx.

Referenced by FDEntry().

Definition at line 87 of file Poll.hxx.

Referenced by getStateBitMask().


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