RSB  0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rsb::transport::socket::Bus Class Reference

Instances of this class provide access to a socket-based bus. More...

#include <Bus.h>

Inheritance diagram for rsb::transport::socket::Bus:
Inheritance graph
Collaboration diagram for rsb::transport::socket::Bus:
Collaboration graph

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, SinkListSinkMap

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

Detailed Description

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.

Author
jmoringe

Definition at line 71 of file Bus.h.

Member Typedef Documentation

Definition at line 105 of file Bus.h.

Definition at line 115 of file Bus.h.

typedef std::list<boost::weak_ptr<InConnector> > rsb::transport::socket::Bus::SinkList
private

Definition at line 117 of file Bus.h.

Definition at line 118 of file Bus.h.

Constructor & Destructor Documentation

rsb::transport::socket::Bus::Bus ( boost::asio::io_service &  service,
bool  tcpnodelay = false 
)
rsb::transport::socket::Bus::~Bus ( )
virtual

Definition at line 56 of file Bus.cpp.

Member Function Documentation

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.

Parameters
connectionThe connection that should be added.

Definition at line 145 of file Bus.cpp.

Referenced by rsb::transport::socket::BusServer::handleAccept().

Here is the caller graph for this function:

void rsb::transport::socket::Bus::addConnector ( ConnectorBase connector)

Definition at line 125 of file Bus.cpp.

void rsb::transport::socket::Bus::addSink ( InConnectorPtr  sink)

Definition at line 87 of file Bus.cpp.

boost::recursive_mutex & rsb::transport::socket::Bus::getConnectionLock ( )
protected

Definition at line 83 of file Bus.cpp.

Referenced by rsb::transport::socket::BusServer::handleIncoming().

Here is the caller graph for this function:

Bus::ConnectionList rsb::transport::socket::Bus::getConnections ( ) const
protected

Definition at line 79 of file Bus.cpp.

Referenced by rsb::transport::socket::BusServer::handleIncoming().

Here is the caller graph for this function:

void rsb::transport::socket::Bus::handle ( EventPtr  event)
virtual

Handle event.

Parameters
eventThe event that should be handled.

Implements rsb::eventprocessing::Handler.

Definition at line 189 of file Bus.cpp.

void rsb::transport::socket::Bus::handleIncoming ( EventPtr  event,
BusConnectionPtr  connection 
)
protectedvirtual

Reimplemented in rsb::transport::socket::BusServer.

Definition at line 161 of file Bus.cpp.

bool rsb::transport::socket::Bus::isTcpnodelay ( ) const

Definition at line 75 of file Bus.cpp.

Referenced by rsb::transport::socket::BusServer::handleAccept().

Here is the caller graph for this function:

void rsb::transport::socket::Bus::printContents ( std::ostream &  stream) const
private

Definition at line 249 of file Bus.cpp.

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.

Parameters
connectionThe connection that should be removed.

Definition at line 153 of file Bus.cpp.

Referenced by rsb::transport::socket::BusServer::handleIncoming().

Here is the caller graph for this function:

void rsb::transport::socket::Bus::removeConnector ( ConnectorBase connector)

Definition at line 132 of file Bus.cpp.

void rsb::transport::socket::Bus::removeSink ( InConnector sink)

Definition at line 96 of file Bus.cpp.

References rsb::transport::socket::InConnector::getScope().

Here is the call graph for this function:

void rsb::transport::socket::Bus::suicide ( )
protectedvirtual

Definition at line 245 of file Bus.cpp.

Friends And Related Function Documentation

friend class BusConnection
friend

Definition at line 73 of file Bus.h.

Referenced by rsb::transport::socket::BusServer::handleAccept().

Member Data Documentation

boost::recursive_mutex rsb::transport::socket::Bus::connectionLock
private

Definition at line 125 of file Bus.h.

ConnectionList rsb::transport::socket::Bus::connections
private

Definition at line 124 of file Bus.h.

Referenced by rsb::transport::socket::BusServer::handleIncoming().

boost::recursive_mutex rsb::transport::socket::Bus::connectorLock
private

Definition at line 129 of file Bus.h.

ConnectorList rsb::transport::socket::Bus::connectors
private

Definition at line 127 of file Bus.h.

rsc::logging::LoggerPtr rsb::transport::socket::Bus::logger
private

Definition at line 120 of file Bus.h.

boost::asio::io_service& rsb::transport::socket::Bus::service
private

Definition at line 122 of file Bus.h.

SinkMap rsb::transport::socket::Bus::sinks
private

Definition at line 128 of file Bus.h.

bool rsb::transport::socket::Bus::tcpnodelay
private

Definition at line 131 of file Bus.h.


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