#include <XmlRpcSource.h>
Inheritance diagram for XmlRpc::XmlRpcSource:
Public Member Functions | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
virtual | ~XmlRpcSource () |
Destructor. | |
int | getfd () const |
Return the file descriptor being monitored. | |
void | setfd (int fd) |
Specify the file descriptor to monitor. | |
bool | getKeepOpen () const |
Return whether the file descriptor should be kept open if it is no longer monitored. | |
void | setKeepOpen (bool b=true) |
Specify whether the file descriptor should be kept open if it is no longer monitored. | |
virtual void | close () |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted. | |
virtual unsigned | handleEvent (unsigned eventType)=0 |
Return true to continue monitoring this source. | |
Private Attributes | |
int | _fd |
bool | _deleteOnClose |
bool | _keepOpen |
Definition at line 14 of file XmlRpcSource.h.
XmlRpc::XmlRpcSource::XmlRpcSource | ( | int | fd = -1 , |
|
bool | deleteOnClose = false | |||
) |
Constructor
fd | The socket file descriptor to monitor. | |
deleteOnClose | If true, the object deletes itself when close is called. |
Definition at line 9 of file XmlRpcSource.cpp.
00010 : _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false) 00011 { 00012 }
XmlRpc::XmlRpcSource::~XmlRpcSource | ( | ) | [virtual] |
void XmlRpc::XmlRpcSource::close | ( | ) | [virtual] |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted.
Reimplemented in XmlRpc::XmlRpcClient.
Definition at line 20 of file XmlRpcSource.cpp.
References _deleteOnClose, _fd, XmlRpc::XmlRpcSocket::close(), and XmlRpc::XmlRpcUtil::log().
Referenced by XmlRpc::XmlRpcServer::bindAndListen(), XmlRpc::XmlRpcClient::close(), XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::work().
00021 { 00022 if (_fd != -1) { 00023 XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd); 00024 XmlRpcSocket::close(_fd); 00025 XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd); 00026 _fd = -1; 00027 } 00028 if (_deleteOnClose) { 00029 XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this"); 00030 _deleteOnClose = false; 00031 delete this; 00032 } 00033 }
int XmlRpc::XmlRpcSource::getfd | ( | ) | const [inline] |
Return the file descriptor being monitored.
Definition at line 25 of file XmlRpcSource.h.
References _fd.
Referenced by XmlRpc::XmlRpcClient::close(), XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::work().
00025 { return _fd; }
bool XmlRpc::XmlRpcSource::getKeepOpen | ( | ) | const [inline] |
Return whether the file descriptor should be kept open if it is no longer monitored.
Definition at line 30 of file XmlRpcSource.h.
References _keepOpen.
Referenced by XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::work().
00030 { return _keepOpen; }
virtual unsigned XmlRpc::XmlRpcSource::handleEvent | ( | unsigned | eventType | ) | [pure virtual] |
Return true to continue monitoring this source.
Implemented in XmlRpc::XmlRpcClient, XmlRpc::XmlRpcServer, and XmlRpc::XmlRpcServerConnection.
Referenced by XmlRpc::XmlRpcDispatch::work().
void XmlRpc::XmlRpcSource::setfd | ( | int | fd | ) | [inline] |
Specify the file descriptor to monitor.
Definition at line 27 of file XmlRpcSource.h.
References _fd.
Referenced by XmlRpc::XmlRpcServer::bindAndListen(), and XmlRpc::XmlRpcClient::doConnect().
00027 { _fd = fd; }
void XmlRpc::XmlRpcSource::setKeepOpen | ( | bool | b = true |
) | [inline] |
Specify whether the file descriptor should be kept open if it is no longer monitored.
Definition at line 32 of file XmlRpcSource.h.
References _keepOpen.
Referenced by XmlRpc::XmlRpcClient::XmlRpcClient().
00032 { _keepOpen = b; }
bool XmlRpc::XmlRpcSource::_deleteOnClose [private] |
int XmlRpc::XmlRpcSource::_fd [private] |
bool XmlRpc::XmlRpcSource::_keepOpen [private] |