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

Factory for RSB user-level domain objects for communication patterns. More...

#include <Factory.h>

Collaboration diagram for rsb::Factory:
Collaboration graph

Public Member Functions

virtual ~Factory ()
template<class DataType >
Informer< DataType >::Ptr createInformer (const Scope &scope, const ParticipantConfig &config=Factory::getInstance().getDefaultParticipantConfig(), const std::string &dataType=detail::TypeName< DataType >()())
 Creates and returns a new Informer that publishes Event s under the Scope scope.
InformerBasePtr createInformerBase (const Scope &scope, const std::string &dataType="", const ParticipantConfig &config=Factory::getInstance().getDefaultParticipantConfig())
 Creates and returns a new Informer that publishes Event s under the Scope scope.
ListenerPtr createListener (const Scope &scope, const ParticipantConfig &config=Factory::getInstance().getDefaultParticipantConfig())
 Creates a new listener for the specified scope.
ReaderPtr createReader (const Scope &scope, const ParticipantConfig &config=Factory::getInstance().getDefaultParticipantConfig())
 Creates a new Reader object for the specified scope.
ServicePtr createService (const Scope &scope)
 Creates a Service instance operating on the given scope.
patterns::ServerPtr createServer (const Scope &scope, const ParticipantConfig &listenerConfig=Factory::getInstance().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=Factory::getInstance().getDefaultParticipantConfig())
 Creates a Server object that exposes methods under the scope scope.
patterns::RemoteServerPtr createRemoteServer (const Scope &scope, const ParticipantConfig &listenerConfig=Factory::getInstance().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=Factory::getInstance().getDefaultParticipantConfig())
 Creates a RemoteServer object for the server at scope scope.
ParticipantConfig getDefaultParticipantConfig () const
 Returns the default configuration for new participants.
void setDefaultParticipantConfig (const ParticipantConfig &config)
 Sets the default config for participants that will be used for every new participant that is created after this call.

Private Member Functions

transport::OutFactorygetOutFactoryInstance ()
 This function is only required to have the same factory instance on windows because there the Singleton template is instantiated once per compilation unit.
 Factory ()
 Singleton constructor.
std::vector
< transport::OutConnectorPtr
createOutConnectors (const ParticipantConfig &config)
std::vector
< transport::InPullConnectorPtr
createInPullConnectors (const ParticipantConfig &config)
std::vector
< transport::InPushConnectorPtr
createInPushConnectors (const ParticipantConfig &config)
void configureLogging ()

Private Attributes

rsc::logging::LoggerPtr logger
ParticipantConfig defaultConfig
 Always acquire configMutex before reading or writing the config.
boost::recursive_mutex configMutex

Friends

class rsc::patterns::Singleton< Factory >

Detailed Description

Factory for RSB user-level domain objects for communication patterns.

Author
jwienke

Definition at line 60 of file Factory.h.

Constructor & Destructor Documentation

rsb::Factory::~Factory ( )
virtual

Definition at line 145 of file Factory.cpp.

Member Function Documentation

void rsb::Factory::configureLogging ( )
private

Definition at line 148 of file Factory.cpp.

References logger.

Referenced by Factory().

Here is the caller graph for this function:

template<class DataType >
Informer<DataType>::Ptr rsb::Factory::createInformer ( const Scope scope,
const ParticipantConfig config = Factory::getInstance().getDefaultParticipantConfig(),
const std::string &  dataType = detail::TypeName<DataType>()() 
)
inline

Creates and returns a new Informer that publishes Event s under the Scope scope.

Template Parameters
DataTypethe C++ data type this informer publishes
Parameters
scopethe scope of the informer
configthe configuration for the informer to use, defaults to the general config held in this factory.
dataTypeA string representation of the type of data sent via the new Informer
Returns
a shared_ptr pointing to the new Informer instance.
Exceptions
RSBErrorIf the requested informer cannot be created.

Definition at line 81 of file Factory.h.

InformerBasePtr rsb::Factory::createInformerBase ( const Scope scope,
const std::string &  dataType = "",
const ParticipantConfig config = Factory::getInstance().getDefaultParticipantConfig() 
)

Creates and returns a new Informer that publishes Event s under the Scope scope.

Parameters
scopethe scope of the informer
dataTypeA string representation of the type of data sent via the new Informer.
configThe configuration for the informer to use, defaults to the general config held in this factory.
Returns
A shared_ptr pointing to the a InformerBase instance.
Exceptions
RSBErrorIf the requested informer cannot be created.

Definition at line 201 of file Factory.cpp.

References createOutConnectors().

Here is the call graph for this function:

vector< InPullConnectorPtr > rsb::Factory::createInPullConnectors ( const ParticipantConfig config)
private

Definition at line 247 of file Factory.cpp.

References rsb::transport::getInPullFactory(), rsb::ParticipantConfig::getTransports(), and logger.

Referenced by createReader().

Here is the call graph for this function:

Here is the caller graph for this function:

vector< InPushConnectorPtr > rsb::Factory::createInPushConnectors ( const ParticipantConfig config)
private

Definition at line 276 of file Factory.cpp.

References rsb::transport::getInPushFactory(), rsb::ParticipantConfig::getTransports(), and logger.

Referenced by createListener().

Here is the call graph for this function:

Here is the caller graph for this function:

ListenerPtr rsb::Factory::createListener ( const Scope scope,
const ParticipantConfig config = Factory::getInstance().getDefaultParticipantConfig() 
)

Creates a new listener for the specified scope.

Parameters
scopethe scope of the new listener
configthe configuration for the LISTENER to use, defaults to the general config held in this factory.f
Returns
new listener instance

Definition at line 208 of file Factory.cpp.

References createInPushConnectors().

Here is the call graph for this function:

vector< OutConnectorPtr > rsb::Factory::createOutConnectors ( const ParticipantConfig config)
private

Definition at line 305 of file Factory.cpp.

References rsb::transport::getOutFactory(), rsb::ParticipantConfig::getTransports(), and logger.

Referenced by createInformerBase().

Here is the call graph for this function:

Here is the caller graph for this function:

ReaderPtr rsb::Factory::createReader ( const Scope scope,
const ParticipantConfig config = Factory::getInstance().getDefaultParticipantConfig() 
)

Creates a new Reader object for the specified scope.

Reader objects receive event via a pull-style interface by calls to Reader::read.

Parameters
scopethe scope of the new receiver
Exceptions
RSBErrorwhen the requested connection cannot be established.
Returns
A shared_ptr to the new Reader object.

Definition at line 213 of file Factory.cpp.

References createInPullConnectors().

Here is the call graph for this function:

patterns::RemoteServerPtr rsb::Factory::createRemoteServer ( const Scope scope,
const ParticipantConfig listenerConfig = Factory::getInstance().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = Factory::getInstance().getDefaultParticipantConfig() 
)

Creates a RemoteServer object for the server at scope scope.

Parameters
scopeThe scope at which the remote server object exposes itself.
listenerConfigconfiguration to use for all reply listeners
informerConfigconfiguration to use for all request informers
Returns
A shared_ptr to the new RemoteServer object.

Definition at line 225 of file Factory.cpp.

patterns::ServerPtr rsb::Factory::createServer ( const Scope scope,
const ParticipantConfig listenerConfig = Factory::getInstance().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = Factory::getInstance().getDefaultParticipantConfig() 
)

Creates a Server object that exposes methods under the scope scope.

Parameters
scopeThe scope under which the new server exposes its methods.
listenerConfigconfiguration to use for all request listeners
informerConfigconfiguration to use for all reply informers
Returns
A shared_ptr to the new Server object.

Definition at line 218 of file Factory.cpp.

ServicePtr rsb::Factory::createService ( const Scope scope)

Creates a Service instance operating on the given scope.

Parameters
scopeparent-scope of the new service
Returns
new service instance

Definition at line 242 of file Factory.cpp.

ParticipantConfig rsb::Factory::getDefaultParticipantConfig ( ) const

Returns the default configuration for new participants.

Returns
copy of the default configuration

Definition at line 232 of file Factory.cpp.

References configMutex, and defaultConfig.

transport::OutFactory & rsb::Factory::getOutFactoryInstance ( )
private

This function is only required to have the same factory instance on windows because there the Singleton template is instantiated once per compilation unit.

For the template-based createInformer method this will then be in the caller's compilation unit. :/

Definition at line 197 of file Factory.cpp.

void rsb::Factory::setDefaultParticipantConfig ( const ParticipantConfig config)

Sets the default config for participants that will be used for every new participant that is created after this call.

Parameters
confignew config

Definition at line 237 of file Factory.cpp.

References configMutex, and defaultConfig.

Friends And Related Function Documentation

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

Definition at line 193 of file Factory.h.

Member Data Documentation

boost::recursive_mutex rsb::Factory::configMutex
mutableprivate

Definition at line 216 of file Factory.h.

Referenced by getDefaultParticipantConfig(), and setDefaultParticipantConfig().

ParticipantConfig rsb::Factory::defaultConfig
private

Always acquire configMutex before reading or writing the config.

Definition at line 215 of file Factory.h.

Referenced by Factory(), getDefaultParticipantConfig(), and setDefaultParticipantConfig().

rsc::logging::LoggerPtr rsb::Factory::logger
private

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