RSB
0.7.0
|
Instances of this class provide access to a socket-based bus. More...
#include <Bus.h>
Public Member Functions | |
Bus (boost::asio::io_service &service, bool tcpnodelay=false) | |
virtual | ~Bus () |
void | addSink (InConnectorPtr sink) |
void | removeSink (InConnector *sink) |
void | addConnector (ConnectorBase *connector) |
void | removeConnector (ConnectorBase *connector) |
void | addConnection (BusConnectionPtr connection) |
Adds connection to the list of connections of the bus. | |
void | removeConnection (BusConnectionPtr connection) |
Removes connection from the list of connections of this bus. | |
bool | isTcpnodelay () const |
void | handle (EventPtr event) |
Handle event. | |
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) |
virtual void | suicide () |
Private Types | |
typedef std::list < ConnectorBase * > | ConnectorList |
typedef std::list < boost::weak_ptr< InConnector > > | SinkList |
typedef std::map< Scope, SinkList > | SinkMap |
Private Member Functions | |
void | printContents (std::ostream &stream) const |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
boost::asio::io_service & | service |
ConnectionList | connections |
boost::recursive_mutex | connectionLock |
ConnectorList | connectors |
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 |
|
private |
rsb::transport::socket::Bus::Bus | ( | boost::asio::io_service & | service, |
bool | tcpnodelay = false |
||
) |
void rsb::transport::socket::Bus::addConnection | ( | BusConnectionPtr | connection | ) |
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. |
Definition at line 145 of file Bus.cpp.
Referenced by rsb::transport::socket::BusServer::handleAccept().
void rsb::transport::socket::Bus::addConnector | ( | ConnectorBase * | connector | ) |
void rsb::transport::socket::Bus::addSink | ( | InConnectorPtr | sink | ) |
|
protected |
Definition at line 83 of file Bus.cpp.
Referenced by rsb::transport::socket::BusServer::handleIncoming().
|
protected |
Definition at line 79 of file Bus.cpp.
Referenced by rsb::transport::socket::BusServer::handleIncoming().
|
virtual |
Handle event.
event | The event that should be handled. |
Implements rsb::eventprocessing::Handler.
|
protectedvirtual |
Reimplemented in rsb::transport::socket::BusServer.
bool rsb::transport::socket::Bus::isTcpnodelay | ( | ) | const |
Definition at line 75 of file Bus.cpp.
Referenced by rsb::transport::socket::BusServer::handleAccept().
|
private |
void rsb::transport::socket::Bus::removeConnection | ( | BusConnectionPtr | connection | ) |
Removes connection from the list of connections of this bus.
connection is not closed or otherwise modified.
connection | The connection that should be removed. |
Definition at line 153 of file Bus.cpp.
Referenced by rsb::transport::socket::BusServer::handleIncoming().
void rsb::transport::socket::Bus::removeConnector | ( | ConnectorBase * | connector | ) |
void rsb::transport::socket::Bus::removeSink | ( | InConnector * | sink | ) |
Definition at line 96 of file Bus.cpp.
References rsb::transport::socket::InConnector::getScope().
|
protectedvirtual |
|
friend |
Definition at line 73 of file Bus.h.
Referenced by rsb::transport::socket::BusServer::handleAccept().
|
private |
|
private |
Definition at line 124 of file Bus.h.
Referenced by rsb::transport::socket::BusServer::handleIncoming().
|
private |
|
private |
|
private |
|
private |