RSB  0.19.0
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 ()
 
SignalParticipantCreatedPtr getSignalParticipantCreated ()
 
SignalParticipantDestroyedPtr getSignalParticipantDestroyed ()
 
template<class DataType >
Informer< DataType >::Ptr createInformer (const Scope &scope, const ParticipantConfig &config=getFactory().getDefaultParticipantConfig(), const std::string &dataType=detail::TypeName< DataType >()(), ParticipantPtr parent=ParticipantPtr())
 Creates and returns a new Informer that publishes Event s under the Scope scope. More...
 
InformerBasePtr createInformerBase (const Scope &scope, const std::string &dataType="", const ParticipantConfig &config=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates and returns a new Informer that publishes Event s under the Scope scope. More...
 
ListenerPtr createListener (const Scope &scope, const ParticipantConfig &config=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a new listener for the specified scope. More...
 
ReaderPtr createReader (const Scope &scope, const ParticipantConfig &config=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a new Reader object for the specified scope. More...
 
patterns::LocalServer::LocalMethodPtr createLocalMethod (const Scope &scope, patterns::LocalServer::CallbackPtr callback, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a patterns::LocalServer::LocalMethod. More...
 
patterns::LocalServerPtr createLocalServer (const Scope &scope, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a Server object that exposes methods under the scope scope. More...
 
patterns::RemoteServer::RemoteMethodPtr createRemoteMethod (const Scope &scope, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a patterns::RemoteServer::RemoteMethod. More...
 
patterns::RemoteServerPtr createRemoteServer (const Scope &scope, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig(), ParticipantPtr parent=ParticipantPtr())
 Creates a RemoteServer object for the server at scope scope. More...
 
ParticipantConfig getDefaultParticipantConfig () const
 Returns the default configuration for new participants. More...
 
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. More...
 
rsc::plugins::ManagerPtr getPluginManager () const
 Returns the plugin manager instance used by the RSB core. More...
 

Static Public Member Functions

static void provideConfigOptions (const std::string &environmentVariablePrefix, rsc::config::OptionHandler &handler, bool stripPrefix=true)
 Provides the default configuration options for RSB to the specified handler. More...
 

Private Member Functions

 Factory ()
 Singleton constructor. More...
 
std::vector< transport::OutConnectorPtrcreateOutConnectors (const ParticipantConfig &config)
 
std::vector< transport::InPullConnectorPtrcreateInPullConnectors (const ParticipantConfig &config)
 
std::vector< transport::InPushConnectorPtrcreateInPushConnectors (const ParticipantConfig &config)
 
void configureSubsystem (rsc::config::OptionHandler &handler, const std::string &environmentVariablePrefix="RSB_")
 

Private Attributes

rsc::logging::LoggerPtr logger
 
rsc::plugins::ManagerPtr pluginManager
 
ParticipantConfig defaultConfig
 Always acquire configMutex before reading or writing the config. More...
 
boost::recursive_mutex configMutex
 
SignalParticipantCreatedPtr signalParticipantCreated
 
SignalParticipantDestroyedPtr signalParticipantDestroyed
 

Friends

FactorygetFactory ()
 Returns a factory for client-level RSB objects. More...
 

Detailed Description

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

Author
jwienke
jmoringe

Definition at line 77 of file Factory.h.

Constructor & Destructor Documentation

rsb::Factory::~Factory ( )
virtual

Definition at line 296 of file Factory.cpp.

Member Function Documentation

void rsb::Factory::configureSubsystem ( rsc::config::OptionHandler &  handler,
const std::string &  environmentVariablePrefix = "RSB_" 
)
private
template<class DataType >
Informer<DataType>::Ptr rsb::Factory::createInformer ( const Scope scope,
const ParticipantConfig config = getFactory().getDefaultParticipantConfig(),
const std::string &  dataType = detail::TypeName<DataType>()(),
ParticipantPtr  parent = ParticipantPtr() 
)
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
parentOptional. A Participant that should be considered to be the parent of the new Informer.
Returns
a shared_ptr pointing to the new Informer instance.
Exceptions
RSBErrorIf the requested informer cannot be created.

Definition at line 107 of file Factory.h.

References rsb::createListener(), rsb::createLocalServer(), rsb::createReader(), rsb::createRemoteServer(), and rsb::getFactory().

Referenced by rsb::createInformer().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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.
parentOptional. A Participant which should be considered the parent of the new Informer.
Returns
A shared_ptr pointing to the a InformerBase instance.
Exceptions
RSBErrorIf the requested informer cannot be created.

Definition at line 315 of file Factory.cpp.

References createOutConnectors(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by rsb::crateInformerBase(), and rsb::patterns::Method::makeInformer().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 409 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 432 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 = getFactory().getDefaultParticipantConfig(),
ParticipantPtr  parent = ParticipantPtr() 
)

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.
parentOptional. A Participant which should be considered the parent of the new Listener.
Returns
a shared_ptr pointing to the new Listener instance.

Definition at line 327 of file Factory.cpp.

References createInPushConnectors(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by rsb::createListener(), and rsb::patterns::Method::makeListener().

Here is the call graph for this function:

Here is the caller graph for this function:

patterns::LocalServer::LocalMethodPtr rsb::Factory::createLocalMethod ( const Scope scope,
patterns::LocalServer::CallbackPtr  callback,
const ParticipantConfig listenerConfig = getFactory().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = getFactory().getDefaultParticipantConfig(),
ParticipantPtr  parent = ParticipantPtr() 
)

Creates a patterns::LocalServer::LocalMethod.

Parameters
scopeThe scope, including the method name as its final component, on which the new method should be available.
callbackThe callback that should be executed to implement the behavior of the method when it is called.
listenerConfigconfiguration to use for the request listener
informerConfigconfiguration to use for the reply informer
parentOptional. A Participant that should be considered to be the parent of the newly created method.
Returns
A shared_ptr to the new patterns::LocalServer::LocalMethod object.

Definition at line 348 of file Factory.cpp.

References rsb::Scope::getComponents(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by createReader(), and rsb::patterns::LocalServer<>::registerMethod().

Here is the call graph for this function:

Here is the caller graph for this function:

patterns::LocalServerPtr rsb::Factory::createLocalServer ( const Scope scope,
const ParticipantConfig listenerConfig = getFactory().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = getFactory().getDefaultParticipantConfig(),
ParticipantPtr  parent = ParticipantPtr() 
)

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
parentOptional. A Participant which should be considered the parent of the new server.
Returns
A shared_ptr to the new Server object.

Definition at line 362 of file Factory.cpp.

References createRemoteMethod(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by rsb::createLocalServer().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 455 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 = getFactory().getDefaultParticipantConfig(),
ParticipantPtr  parent = ParticipantPtr() 
)

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
configThe configuration the new Reader should use. Defaults to the global default configuration of the factory.
parentOptional. A Participant which should be considered the parent of the new Reader.
Returns
A shared_ptr to the new Reader object.
Exceptions
RSBErrorwhen the requested connection cannot be established.

Definition at line 337 of file Factory.cpp.

References createInPullConnectors(), createLocalMethod(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by rsb::createReader().

Here is the call graph for this function:

Here is the caller graph for this function:

patterns::RemoteServer::RemoteMethodPtr rsb::Factory::createRemoteMethod ( const Scope scope,
const ParticipantConfig listenerConfig = getFactory().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = getFactory().getDefaultParticipantConfig(),
ParticipantPtr  parent = ParticipantPtr() 
)

Creates a patterns::RemoteServer::RemoteMethod.

Parameters
scopeThe scope, including the method name as its final component, on which the new method should operate.
listenerConfigconfiguration to use for the request listener
informerConfigconfiguration to use for the reply informer
parentOptional. A Participant that should be considered to be the parent of the new method.
Returns
A shared_ptr to the new patterns::RemoteServer::RemoteMethod object.

Definition at line 374 of file Factory.cpp.

References rsb::Scope::getComponents(), signalParticipantCreated, and signalParticipantDestroyed.

Referenced by createLocalServer(), and rsb::patterns::RemoteServer::getMethod().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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
parentOptional. A Participant which should be considered the parent of the new server.
Returns
A shared_ptr to the new RemoteServer object.

Definition at line 387 of file Factory.cpp.

References signalParticipantCreated, and signalParticipantDestroyed.

Referenced by rsb::createRemoteServer().

Here is the caller graph for this function:

ParticipantConfig rsb::Factory::getDefaultParticipantConfig ( ) const

Returns the default configuration for new participants.

Returns
copy of the default configuration

Definition at line 398 of file Factory.cpp.

References configMutex, and defaultConfig.

rsc::plugins::ManagerPtr rsb::Factory::getPluginManager ( ) const

Returns the plugin manager instance used by the RSB core.

Returns
plugin manager instance

Definition at line 477 of file Factory.cpp.

References pluginManager.

SignalParticipantCreatedPtr rsb::Factory::getSignalParticipantCreated ( )

Definition at line 307 of file Factory.cpp.

References signalParticipantCreated.

SignalParticipantDestroyedPtr rsb::Factory::getSignalParticipantDestroyed ( )

Definition at line 311 of file Factory.cpp.

References signalParticipantDestroyed.

void rsb::Factory::provideConfigOptions ( const std::string &  environmentVariablePrefix,
rsc::config::OptionHandler &  handler,
bool  stripPrefix = true 
)
static

Provides the default configuration options for RSB to the specified handler.

This method can e.g. be used by plugins to get options from the default configuration system. Options are presented to the handler without any prefix like "rsb".

Note
that the option processing performed by this method can be expensive.
Parameters
environmentVariablePrefixTODO
handlerthe handler to inform about options

Definition at line 299 of file Factory.cpp.

Referenced by Factory().

Here is the caller graph for this function:

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 403 of file Factory.cpp.

References configMutex, and defaultConfig.

Friends And Related Function Documentation

Factory& getFactory ( )
friend

Returns a factory for client-level RSB objects.

Returns
the factory instance to create client level RSB objects.

Definition at line 163 of file Factory.cpp.

Member Data Documentation

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

Definition at line 336 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 335 of file Factory.h.

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

rsc::logging::LoggerPtr rsb::Factory::logger
private
rsc::plugins::ManagerPtr rsb::Factory::pluginManager
private

Definition at line 330 of file Factory.h.

Referenced by Factory(), and getPluginManager().


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