CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlRpc::XmlRpcSource Class Referenceabstract

An RPC source represents a file descriptor to monitor. More...

#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.
 

Detailed Description

An RPC source represents a file descriptor to monitor.

Definition at line 14 of file XmlRpcSource.h.

Constructor & Destructor Documentation

◆ XmlRpcSource()

XmlRpc::XmlRpcSource::XmlRpcSource ( int fd = -1,
bool deleteOnClose = false )

Constructor

Parameters
fdThe socket file descriptor to monitor.
deleteOnCloseIf true, the object deletes itself when close is called.

Definition at line 9 of file XmlRpcSource.cpp.

10 : _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false)
11 {
12 }

◆ ~XmlRpcSource()

XmlRpc::XmlRpcSource::~XmlRpcSource ( )
virtual

Destructor.

Definition at line 14 of file XmlRpcSource.cpp.

15 {
16 }

Member Function Documentation

◆ close()

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.

21 {
22 if (_fd != -1) {
23 XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd);
25 XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd);
26 _fd = -1;
27 }
28 if (_deleteOnClose) {
29 XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this");
30 _deleteOnClose = false;
31 delete this;
32 }
33 }
static void close(int socket)
Closes a socket.
static void log(int level, const char *fmt,...)
Dump messages somewhere.

Referenced by XmlRpc::XmlRpcServer::bindAndListen(), XmlRpc::XmlRpcClient::close(), XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::work().

◆ getfd()

◆ getKeepOpen()

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.

30{ return _keepOpen; }

Referenced by XmlRpc::XmlRpcClient::readHeader(), and XmlRpc::XmlRpcDispatch::work().

◆ handleEvent()

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().

◆ setfd()

void XmlRpc::XmlRpcSource::setfd ( int fd)
inline

Specify the file descriptor to monitor.

Definition at line 27 of file XmlRpcSource.h.

27{ _fd = fd; }

Referenced by XmlRpc::XmlRpcServer::bindAndListen(), and XmlRpc::XmlRpcClient::doConnect().

◆ setKeepOpen()

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.

32{ _keepOpen = b; }

Referenced by XmlRpc::XmlRpcClient::XmlRpcClient().


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