ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
CSMonitorFD Class Reference

Class to tie sockets to for monitoring by Csocket at either the Csock or TSockManager. More...

#include <Csocket.h>

+ Inheritance diagram for CSMonitorFD:
+ Collaboration diagram for CSMonitorFD:

Public Member Functions

 CSMonitorFD ()
 
virtual ~CSMonitorFD ()
 
virtual bool GatherFDsForSelect (std::map< cs_sock_t, short > &miiReadyFds, long &iTimeoutMS)
 called before select, typically you don't need to reimplement this just add sockets via Add and let the default implementation have its way More...
 
virtual bool FDsThatTriggered (const std::map< cs_sock_t, short > &miiReadyFds)
 called when there are fd's belonging to this class that have triggered More...
 
virtual bool CheckFDs (const std::map< cs_sock_t, short > &miiReadyFds)
 gets called to diff miiReadyFds with m_miiMonitorFDs, and calls FDsThatTriggered when appropriate. More...
 
void Add (cs_sock_t iFD, short iMonitorEvents)
 adds a file descriptor to be monitored More...
 
void Remove (cs_sock_t iFD)
 removes this fd from monitoring More...
 
void DisableMonitor ()
 causes this monitor to be removed More...
 
bool IsEnabled () const
 

Protected Attributes

std::map< cs_sock_t, short > m_miiMonitorFDs
 
bool m_bEnabled
 

Detailed Description

Class to tie sockets to for monitoring by Csocket at either the Csock or TSockManager.

Constructor & Destructor Documentation

CSMonitorFD::CSMonitorFD ( )
inline
virtual CSMonitorFD::~CSMonitorFD ( )
inlinevirtual

Member Function Documentation

void CSMonitorFD::Add ( cs_sock_t  iFD,
short  iMonitorEvents 
)
inline

adds a file descriptor to be monitored

Parameters
iFDthe file descriptor
iMonitorEventsbitset of events to monitor for (
See Also
CSockManager::ECheckType)
virtual bool CSMonitorFD::CheckFDs ( const std::map< cs_sock_t, short > &  miiReadyFds)
virtual

gets called to diff miiReadyFds with m_miiMonitorFDs, and calls FDsThatTriggered when appropriate.

Typically you don't need to reimplement this.

Parameters
miiReadyFdsthe map of all triggered fd's, not just the fd's from this class
Returns
returning false will remove this from monitoring
void CSMonitorFD::DisableMonitor ( )
inline

causes this monitor to be removed

virtual bool CSMonitorFD::FDsThatTriggered ( const std::map< cs_sock_t, short > &  miiReadyFds)
inlinevirtual

called when there are fd's belonging to this class that have triggered

Parameters
miiReadyFdsthe map of fd's with the bits that triggered them (
See Also
CSockManager::ECheckType)
Returns
returning false will remove this from monitoring
virtual bool CSMonitorFD::GatherFDsForSelect ( std::map< cs_sock_t, short > &  miiReadyFds,
long &  iTimeoutMS 
)
virtual

called before select, typically you don't need to reimplement this just add sockets via Add and let the default implementation have its way

Parameters
miiReadyFdsfill with fd's to monitor and the associated bit to check them for (
See Also
CSockManager::ECheckType)
Parameters
iTimeoutMSthe timeout to change to, setting this to -1 (the default)
Returns
returning false will remove this from monitoring. The same effect can be had by setting m_bEnabled to false as it is returned from this
bool CSMonitorFD::IsEnabled ( ) const
inline
void CSMonitorFD::Remove ( cs_sock_t  iFD)
inline

removes this fd from monitoring

Member Data Documentation

bool CSMonitorFD::m_bEnabled
protected
std::map< cs_sock_t, short > CSMonitorFD::m_miiMonitorFDs
protected

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