RSB
0.7.0
|
Factory for RSB user-level domain objects for communication patterns. More...
#include <Factory.h>
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::OutFactory & | getOutFactoryInstance () |
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 > |
Factory for RSB user-level domain objects for communication patterns.
|
virtual |
Definition at line 145 of file Factory.cpp.
|
private |
Singleton constructor.
Definition at line 78 of file Factory.cpp.
References rsb::ParticipantConfig::addTransport(), configureLogging(), defaultConfig, rsb::ParticipantConfig::fromConfiguration(), rsb::transport::ConnectorFactory< Interface >::getConnectorInfos(), rsb::transport::getInPullFactory(), rsb::transport::getInPushFactory(), rsb::transport::getOutFactory(), rsb::ParticipantConfig::getTransports(), logger, rsb::ParticipantConfig::mutableTransport(), rsb::converter::registerDefaultConverters(), rsb::eventprocessing::registerDefaultEventProcessingStrategies(), rsb::transport::registerDefaultTransports(), and rsb::ParticipantConfig::Transport::setEnabled().
|
private |
Definition at line 148 of file Factory.cpp.
References logger.
Referenced by Factory().
|
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 |
RSBError | If the requested informer cannot be created. |
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.
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. |
RSBError | If the requested informer cannot be created. |
Definition at line 201 of file Factory.cpp.
References createOutConnectors().
|
private |
Definition at line 247 of file Factory.cpp.
References rsb::transport::getInPullFactory(), rsb::ParticipantConfig::getTransports(), and logger.
Referenced by createReader().
|
private |
Definition at line 276 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 = Factory::getInstance().getDefaultParticipantConfig() |
||
) |
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.f |
Definition at line 208 of file Factory.cpp.
References createInPushConnectors().
|
private |
Definition at line 305 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 = 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.
scope | the scope of the new receiver |
RSBError | when the requested connection cannot be established. |
Definition at line 213 of file Factory.cpp.
References createInPullConnectors().
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.
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 |
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.
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 |
Definition at line 218 of file Factory.cpp.
ServicePtr rsb::Factory::createService | ( | const Scope & | scope | ) |
Creates a Service instance operating on the given scope.
scope | parent-scope of the new service |
Definition at line 242 of file Factory.cpp.
ParticipantConfig rsb::Factory::getDefaultParticipantConfig | ( | ) | const |
Returns the default configuration for new participants.
Definition at line 232 of file Factory.cpp.
References configMutex, and defaultConfig.
|
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.
config | new config |
Definition at line 237 of file Factory.cpp.
References configMutex, and defaultConfig.
|
mutableprivate |
Definition at line 216 of file Factory.h.
Referenced by getDefaultParticipantConfig(), and setDefaultParticipantConfig().
|
private |
Always acquire configMutex before reading or writing the config.
Definition at line 215 of file Factory.h.
Referenced by Factory(), getDefaultParticipantConfig(), and setDefaultParticipantConfig().
|
private |
Definition at line 210 of file Factory.h.
Referenced by configureLogging(), createInPullConnectors(), createInPushConnectors(), createOutConnectors(), and Factory().