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

The singleton instance of this class is responsible for managing bus provider objects. More...

#include <Factory.h>

Collaboration diagram for rsb::transport::socket::Factory:
Collaboration graph

Public Member Functions

 ~Factory ()
BusPtr getBus (const Server &serverMode, const std::string &host, const boost::uint16_t &port, bool tcpnodelay, ConnectorBase *connector)
 Returns either a BusClient or Server depending on the chosen serverMode and the existence of a server in the current process.

Private Types

typedef std::pair< std::string,
boost::uint16_t > 
Endpoint
typedef boost::shared_ptr
< boost::asio::ip::tcp::socket > 
SocketPtr
typedef boost::shared_ptr
< boost::asio::io_service::work > 
WorkPtr
typedef std::map< Endpoint,
BusPtr
BusClientMap
typedef std::map< Endpoint,
BusServerPtr
BusServerMap

Private Member Functions

 Factory ()
BusPtr getBusClientFor (const std::string &host, boost::uint16_t port, bool tcpnodelay, ConnectorBase *connector)
BusServerPtr getBusServerFor (const std::string &host, boost::uint16_t port, bool tcpnodelay, ConnectorBase *connector)
void removeBusClient (BusPtr bus)
void removeBusServer (BusPtr bus)

Static Private Member Functions

static void checkOptions (BusPtr bus, bool tcpnodelay)

Private Attributes

rsc::logging::LoggerPtr logger
BusClientMap busClients
BusServerMap busServers
boost::mutex busMutex
boost::asio::io_service service
WorkPtr keepAlive
boost::thread thread

Friends

class rsc::patterns::Singleton< Factory >
class Bus
class BusServer

Detailed Description

The singleton instance of this class is responsible for managing bus provider objects.

For each endpoint (i.e. address and port), at most one client or server bus provider can exist.

Attention
This class is not thread safe and needs to be accessed in a synchronized manner, except for getBus.
Author
jmoringe

Definition at line 59 of file Factory.h.

Member Typedef Documentation

Definition at line 82 of file Factory.h.

Definition at line 83 of file Factory.h.

typedef std::pair<std::string, boost::uint16_t> rsb::transport::socket::Factory::Endpoint
private

Definition at line 77 of file Factory.h.

typedef boost::shared_ptr<boost::asio::ip::tcp::socket> rsb::transport::socket::Factory::SocketPtr
private

Definition at line 78 of file Factory.h.

typedef boost::shared_ptr<boost::asio::io_service::work> rsb::transport::socket::Factory::WorkPtr
private

Definition at line 80 of file Factory.h.

Constructor & Destructor Documentation

rsb::transport::socket::Factory::~Factory ( )

Definition at line 57 of file Factory.cpp.

References busClients, keepAlive, logger, and thread.

rsb::transport::socket::Factory::Factory ( )
private

Definition at line 50 of file Factory.cpp.

References logger.

Member Function Documentation

void rsb::transport::socket::Factory::checkOptions ( BusPtr  bus,
bool  tcpnodelay 
)
staticprivate

Definition at line 249 of file Factory.cpp.

Referenced by getBusClientFor(), and getBusServerFor().

Here is the caller graph for this function:

BusPtr rsb::transport::socket::Factory::getBus ( const Server serverMode,
const std::string &  host,
const boost::uint16_t &  port,
bool  tcpnodelay,
ConnectorBase connector 
)

Returns either a BusClient or Server depending on the chosen serverMode and the existence of a server in the current process.

Definition at line 221 of file Factory.cpp.

References busMutex, getBusClientFor(), getBusServerFor(), logger, rsb::transport::socket::SERVER_AUTO, rsb::transport::socket::SERVER_NO, and rsb::transport::socket::SERVER_YES.

Referenced by rsb::transport::socket::ConnectorBase::activate().

Here is the call graph for this function:

Here is the caller graph for this function:

BusPtr rsb::transport::socket::Factory::getBusClientFor ( const std::string &  host,
boost::uint16_t  port,
bool  tcpnodelay,
ConnectorBase connector 
)
private

Definition at line 68 of file Factory.cpp.

References Bus, busClients, checkOptions(), logger, and service.

Referenced by getBus().

Here is the call graph for this function:

Here is the caller graph for this function:

BusServerPtr rsb::transport::socket::Factory::getBusServerFor ( const std::string &  host,
boost::uint16_t  port,
bool  tcpnodelay,
ConnectorBase connector 
)
private

Definition at line 173 of file Factory.cpp.

References BusServer, busServers, checkOptions(), logger, and service.

Referenced by getBus().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsb::transport::socket::Factory::removeBusClient ( BusPtr  bus)
private

Definition at line 158 of file Factory.cpp.

References busClients, busMutex, and logger.

void rsb::transport::socket::Factory::removeBusServer ( BusPtr  bus)
private

Definition at line 205 of file Factory.cpp.

References busMutex, busServers, and logger.

Friends And Related Function Documentation

friend class Bus
friend

Definition at line 61 of file Factory.h.

Referenced by getBusClientFor().

friend class BusServer
friend

Definition at line 62 of file Factory.h.

Referenced by getBusServerFor().

friend class rsc::patterns::Singleton< Factory >
friend

Definition at line 60 of file Factory.h.

Member Data Documentation

BusClientMap rsb::transport::socket::Factory::busClients
private

Definition at line 87 of file Factory.h.

Referenced by getBusClientFor(), removeBusClient(), and ~Factory().

boost::mutex rsb::transport::socket::Factory::busMutex
private

Definition at line 89 of file Factory.h.

Referenced by getBus(), removeBusClient(), and removeBusServer().

BusServerMap rsb::transport::socket::Factory::busServers
private

Definition at line 88 of file Factory.h.

Referenced by getBusServerFor(), and removeBusServer().

WorkPtr rsb::transport::socket::Factory::keepAlive
private

Definition at line 92 of file Factory.h.

Referenced by ~Factory().

rsc::logging::LoggerPtr rsb::transport::socket::Factory::logger
private
boost::asio::io_service rsb::transport::socket::Factory::service
private

Definition at line 91 of file Factory.h.

Referenced by getBusClientFor(), and getBusServerFor().

boost::thread rsb::transport::socket::Factory::thread
private

Definition at line 93 of file Factory.h.

Referenced by ~Factory().


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