RSB
0.19.0
|
Factory for RSB user-level domain objects for communication patterns. More...
#include <Factory.h>
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::OutConnectorPtr > | createOutConnectors (const ParticipantConfig &config) |
std::vector< transport::InPullConnectorPtr > | createInPullConnectors (const ParticipantConfig &config) |
std::vector< transport::InPushConnectorPtr > | createInPushConnectors (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 | |
Factory & | getFactory () |
Returns a factory for client-level RSB objects. More... | |
Factory for RSB user-level domain objects for communication patterns.
|
virtual |
Definition at line 296 of file Factory.cpp.
|
private |
Singleton constructor.
Definition at line 193 of file Factory.cpp.
References rsb::ParticipantConfig::addTransport(), defaultConfig, rsb::transport::DIRECTION_IN_PULL, rsb::transport::DIRECTION_IN_PUSH, rsb::transport::DIRECTION_OUT, rsb::transport::getAvailableTransports(), rsb::ParticipantConfig::getTransports(), logger, rsb::ParticipantConfig::mutableTransport(), pluginManager, provideConfigOptions(), rsb::converter::registerDefaultConverters(), rsb::eventprocessing::registerDefaultEventProcessingStrategies(), rsb::transport::registerDefaultTransports(), and rsb::ParticipantConfig::Transport::setEnabled().
|
private |
|
inline |
Creates and returns a new Informer that publishes Event s under the Scope scope.
DataType | the C++ data type this informer publishes |
scope | the scope of the informer |
config | the configuration for the informer to use, defaults to the general config held in this factory. |
dataType | A string representation of the type of data sent via the new Informer |
parent | Optional. A Participant that should be considered to be the parent of the new Informer. |
RSBError | If 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().
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.
scope | the scope of the informer |
dataType | A string representation of the type of data sent via the new Informer. |
config | The configuration for the informer to use, defaults to the general config held in this factory. |
parent | Optional. A Participant which should be considered the parent of the new Informer. |
RSBError | If 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().
|
private |
Definition at line 409 of file Factory.cpp.
References rsb::transport::getInPullFactory(), rsb::ParticipantConfig::getTransports(), and logger.
Referenced by createReader().
|
private |
Definition at line 432 of file Factory.cpp.
References rsb::transport::getInPushFactory(), rsb::ParticipantConfig::getTransports(), and logger.
Referenced by createListener().
ListenerPtr rsb::Factory::createListener | ( | const Scope & | scope, |
const ParticipantConfig & | config = getFactory().getDefaultParticipantConfig() , |
||
ParticipantPtr | parent = ParticipantPtr() |
||
) |
Creates a new listener for the specified scope.
scope | the scope of the new listener |
config | the configuration for the LISTENER to use, defaults to the general config held in this factory. |
parent | Optional. A Participant which should be considered the parent of the new Listener. |
Definition at line 327 of file Factory.cpp.
References createInPushConnectors(), signalParticipantCreated, and signalParticipantDestroyed.
Referenced by rsb::createListener(), and rsb::patterns::Method::makeListener().
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.
scope | The scope, including the method name as its final component, on which the new method should be available. |
callback | The callback that should be executed to implement the behavior of the method when it is called. |
listenerConfig | configuration to use for the request listener |
informerConfig | configuration to use for the reply informer |
parent | Optional. A Participant that should be considered to be the parent of the newly created method. |
Definition at line 348 of file Factory.cpp.
References rsb::Scope::getComponents(), signalParticipantCreated, and signalParticipantDestroyed.
Referenced by createReader(), and rsb::patterns::LocalServer<>::registerMethod().
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.
scope | The scope under which the new server exposes its methods. |
listenerConfig | configuration to use for all request listeners |
informerConfig | configuration to use for all reply informers |
parent | Optional. A Participant which should be considered the parent of the new server. |
Definition at line 362 of file Factory.cpp.
References createRemoteMethod(), signalParticipantCreated, and signalParticipantDestroyed.
Referenced by rsb::createLocalServer().
|
private |
Definition at line 455 of file Factory.cpp.
References rsb::transport::getOutFactory(), rsb::ParticipantConfig::getTransports(), and logger.
Referenced by createInformerBase().
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.
scope | the scope of the new receiver |
config | The configuration the new Reader should use. Defaults to the global default configuration of the factory. |
parent | Optional. A Participant which should be considered the parent of the new Reader. |
RSBError | when the requested connection cannot be established. |
Definition at line 337 of file Factory.cpp.
References createInPullConnectors(), createLocalMethod(), signalParticipantCreated, and signalParticipantDestroyed.
Referenced by rsb::createReader().
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.
scope | The scope, including the method name as its final component, on which the new method should operate. |
listenerConfig | configuration to use for the request listener |
informerConfig | configuration to use for the reply informer |
parent | Optional. A Participant that should be considered to be the parent of the new method. |
Definition at line 374 of file Factory.cpp.
References rsb::Scope::getComponents(), signalParticipantCreated, and signalParticipantDestroyed.
Referenced by createLocalServer(), and rsb::patterns::RemoteServer::getMethod().
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.
scope | The scope at which the remote server object exposes itself. |
listenerConfig | configuration to use for all reply listeners |
informerConfig | configuration to use for all request informers |
parent | Optional. A Participant which should be considered the parent of the new server. |
Definition at line 387 of file Factory.cpp.
References signalParticipantCreated, and signalParticipantDestroyed.
Referenced by rsb::createRemoteServer().
ParticipantConfig rsb::Factory::getDefaultParticipantConfig | ( | ) | const |
Returns the default configuration for new participants.
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.
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.
|
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".
environmentVariablePrefix | TODO |
handler | the handler to inform about options |
Definition at line 299 of file Factory.cpp.
Referenced by Factory().
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.
config | new config |
Definition at line 403 of file Factory.cpp.
References configMutex, and defaultConfig.
|
friend |
Returns a factory for client-level RSB objects.
Definition at line 163 of file Factory.cpp.
|
mutableprivate |
Definition at line 336 of file Factory.h.
Referenced by getDefaultParticipantConfig(), and setDefaultParticipantConfig().
|
private |
Always acquire configMutex before reading or writing the config.
Definition at line 335 of file Factory.h.
Referenced by Factory(), getDefaultParticipantConfig(), and setDefaultParticipantConfig().
|
private |
Definition at line 328 of file Factory.h.
Referenced by createInPullConnectors(), createInPushConnectors(), createOutConnectors(), and Factory().
|
private |
Definition at line 330 of file Factory.h.
Referenced by Factory(), and getPluginManager().
|
private |
Definition at line 338 of file Factory.h.
Referenced by createInformerBase(), createListener(), createLocalMethod(), createLocalServer(), createReader(), createRemoteMethod(), createRemoteServer(), and getSignalParticipantCreated().
|
private |
Definition at line 339 of file Factory.h.
Referenced by createInformerBase(), createListener(), createLocalMethod(), createLocalServer(), createReader(), createRemoteMethod(), createRemoteServer(), and getSignalParticipantDestroyed().