RSB
0.16.1
|
Instances of this class provide access to a socket-based bus. More...
#include <Bus.h>
Public Member Functions | |
Bus (AsioServiceContextPtr asioService, bool tcpnodelay=false) | |
virtual | ~Bus () |
virtual void | addSink (InConnectorPtr sink) |
virtual void | removeSink (InConnector *sink) |
virtual void | addConnection (BusConnectionPtr connection) |
Adds connection to the list of connections of the bus. More... | |
virtual void | removeConnection (BusConnectionPtr connection) |
Removes connection from the list of connections of this bus. More... | |
virtual bool | isTcpnodelay () const |
virtual void | handle (EventPtr event) |
Handle event. More... | |
virtual AsioServiceContextPtr | getService () const |
virtual void | printContents (std::ostream &stream) const |
virtual const std::string | getTransportURL () const |
Public Member Functions inherited from rsb::eventprocessing::Handler | |
virtual | ~Handler () |
Protected Types | |
typedef std::list< BusConnectionPtr > | ConnectionList |
Protected Member Functions | |
ConnectionList | getConnections () const |
boost::recursive_mutex & | getConnectionLock () |
virtual void | handleIncoming (EventPtr event, BusConnectionPtr connection) |
Private Types | |
typedef std::list< boost::weak_ptr< InConnector > > | SinkList |
typedef std::map< Scope, SinkList > | SinkMap |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
AsioServiceContextPtr | asioService |
ConnectionList | connections |
boost::recursive_mutex | connectionLock |
SinkMap | sinks |
boost::recursive_mutex | connectorLock |
bool | tcpnodelay |
Friends | |
class | BusConnection |
Instances of this class provide access to a socket-based bus.
It is transparent for clients (connectors) of this class whether is accessed by running the bus server or by connecting to the bus server as a client.
In-direction connectors add themselves as event sinks using the addSink method.
Out-direction connectors submit events to the bus using the handle method.
|
protected |
|
private |
|
private |
rsb::transport::socket::Bus::Bus | ( | AsioServiceContextPtr | asioService, |
bool | tcpnodelay = false |
||
) |
|
virtual |
Definition at line 57 of file Bus.cpp.
References connections, logger, and sinks.
|
virtual |
Adds connection to the list of connections of the bus.
connection should start receiving events, only after being added to the bus.
connection | The connection that should be added. |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 134 of file Bus.cpp.
References connectionLock, connections, and logger.
Referenced by rsb::transport::socket::BusServerImpl::handleAccept().
|
virtual |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 96 of file Bus.cpp.
References connectorLock, logger, and sinks.
|
protected |
Definition at line 92 of file Bus.cpp.
References connectionLock.
Referenced by rsb::transport::socket::BusServerImpl::handleIncoming().
|
protected |
Definition at line 88 of file Bus.cpp.
References connections.
Referenced by rsb::transport::socket::BusServerImpl::handleIncoming().
|
virtual |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 80 of file Bus.cpp.
References asioService.
Referenced by rsb::transport::socket::BusServerImpl::acceptOne().
|
virtual |
Reimplemented in rsb::transport::socket::BusServerImpl, and rsb::transport::socket::LifecycledBusServer.
Definition at line 239 of file Bus.cpp.
References connections.
|
virtual |
Handle event.
event | The event that should be handled. |
Implements rsb::eventprocessing::Handler.
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 178 of file Bus.cpp.
References connectionLock, connections, connectorLock, logger, removeConnection(), and sinks.
|
protectedvirtual |
Reimplemented in rsb::transport::socket::BusServerImpl, rsb::transport::socket::LifecycledBusServer, and rsb::transport::socket::BusServer.
Definition at line 150 of file Bus.cpp.
References connectorLock, logger, and sinks.
Referenced by rsb::transport::socket::BusServerImpl::handleIncoming().
|
virtual |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 84 of file Bus.cpp.
References tcpnodelay.
Referenced by rsb::transport::socket::BusServerImpl::handleAccept().
|
virtual |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 234 of file Bus.cpp.
References connections, and sinks.
|
virtual |
Removes connection from the list of connections of this bus.
connection is not closed or otherwise modified.
connection | The connection that should be removed. |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 142 of file Bus.cpp.
References connectionLock, connections, and logger.
Referenced by handle(), and rsb::transport::socket::BusServerImpl::handleIncoming().
|
virtual |
Reimplemented in rsb::transport::socket::LifecycledBusServer.
Definition at line 105 of file Bus.cpp.
References connectorLock, rsb::transport::socket::ConnectorBase::getScope(), logger, and sinks.
|
friend |
Definition at line 76 of file Bus.h.
Referenced by rsb::transport::socket::BusServerImpl::handleAccept().
|
private |
Definition at line 129 of file Bus.h.
Referenced by getService().
|
private |
Definition at line 132 of file Bus.h.
Referenced by addConnection(), getConnectionLock(), handle(), and removeConnection().
|
private |
Definition at line 131 of file Bus.h.
Referenced by addConnection(), getConnections(), getTransportURL(), handle(), rsb::transport::socket::BusServerImpl::handleIncoming(), printContents(), removeConnection(), and ~Bus().
|
private |
Definition at line 135 of file Bus.h.
Referenced by addSink(), handle(), handleIncoming(), and removeSink().
|
private |
Definition at line 125 of file Bus.h.
Referenced by addConnection(), addSink(), handle(), handleIncoming(), removeConnection(), removeSink(), and ~Bus().
|
private |
Definition at line 134 of file Bus.h.
Referenced by addSink(), handle(), handleIncoming(), printContents(), removeSink(), and ~Bus().
|
private |
Definition at line 137 of file Bus.h.
Referenced by isTcpnodelay().