#include <monitor.h>
Public Types | |
enum | { evRead = 0x0001, evWrite = 0x0002 } |
Public Member Functions | |
Monitor (std::string const &name, size_t hint) | |
Constructor. | |
virtual | ~Monitor () |
Destructor. | |
virtual void | do_events () |
Do events. | |
virtual bool | add (Socket *socket, int fd, unsigned int events) |
Monitors a socket. | |
virtual bool | update (Socket *socket, int fd, unsigned int events) |
Updates events monitored for a socket. | |
virtual void | remove (Socket *socket, int fd) |
Unmonitors a socket. | |
std::string const & | name () const |
Returns the name of the monitor. | |
Protected Types | |
typedef containers::VectorSP< Socket *, size_t > | sockets_list |
Type of the list of sockets. | |
Protected Member Functions | |
Socket * | get_socket (int fd) const |
Gets a socket for a given fd. | |
void | set_socket (int fd, Socket *s) |
Sets a socket for a given fd. | |
size_t | hint () const |
Returns the hint. | |
Protected Attributes | |
sockets_list | m_sockets |
The sockets list. |
The do_events(), add(), update() and remove() function must be overriden in derived classes.
|
|
|
Constructor.
|
|
Adds a socket to the monitor. This socket will be watched for the given events and receive notifications when they happen. The default implementation calls set_socket() for the given socket/fd pair.
|
|
This function checks for new events on the monitored sockets. The default implementation does nothing. |
|
Unmonitors a socket. The socket must have been added previously through the add() function. The default implementation removes the socket from the internal socket list.
|
|
Updates events monitored for a socket. The socket must have been added previously through the add() function. The default implementation does nothing.
|