RSB  0.9.6
 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>

Inheritance diagram for rsb::Factory:
Inheritance graph
Collaboration diagram for rsb::Factory:
Collaboration graph

Public Member Functions

 DEPRECATED (static Factory &getInstance())
 
virtual ~Factory ()
 
template<class DataType >
Informer< DataType >::Ptr createInformer (const Scope &scope, const ParticipantConfig &config=getFactory().getDefaultParticipantConfig(), const std::string &dataType=detail::TypeName< DataType >()())
 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())
 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())
 Creates a new listener for the specified scope. More...
 
ReaderPtr createReader (const Scope &scope, const ParticipantConfig &config=getFactory().getDefaultParticipantConfig())
 Creates a new Reader object for the specified scope. More...
 
ServicePtr createService (const Scope &scope)
 Creates a Service instance operating on the given scope. More...
 
patterns::ServerPtr createServer (const Scope &scope, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig())
 Creates a Server object that exposes methods under the scope scope. More...
 
patterns::RemoteServerPtr createRemoteServer (const Scope &scope, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig())
 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...
 

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_")
 

Static Private Member Functions

static FactorygetInstanceBase ()
 

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
 

Friends

class rsc::patterns::Singleton< Factory >
 
FactorygetFactory ()
 Returns a factory for client-level RSB objects. More...
 

Detailed Description

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

Author
jwienke

Definition at line 71 of file Factory.h.

Constructor & Destructor Documentation

rsb::Factory::~Factory ( )
virtual

Definition at line 196 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>()() 
)
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 99 of file Factory.h.

Referenced by rsb::createInformer(), rsb::patterns::RemoteServer::getMethodSet(), and rsb::patterns::Server<>::registerMethod().

Here is the caller graph for this function:

InformerBasePtr rsb::Factory::createInformerBase ( const Scope scope,
const std::string &  dataType = "",
const ParticipantConfig config = getFactory().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 199 of file Factory.cpp.

References createOutConnectors().

Referenced by rsb::crateInformerBase().

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 245 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 279 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() 
)

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

References createInPushConnectors().

Referenced by rsb::createListener(), rsb::patterns::RemoteServer::getMethodSet(), and rsb::patterns::Server<>::registerMethod().

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 313 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() 
)

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

References createInPullConnectors().

Referenced by rsb::createReader().

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() 
)

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

Referenced by rsb::createRemoteServer().

Here is the caller graph for this function:

patterns::ServerPtr rsb::Factory::createServer ( const Scope scope,
const ParticipantConfig listenerConfig = getFactory().getDefaultParticipantConfig(),
const ParticipantConfig informerConfig = getFactory().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 216 of file Factory.cpp.

Referenced by rsb::createServer().

Here is the caller graph for this function:

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

Referenced by rsb::createService().

Here is the caller graph for this function:

rsb::Factory::DEPRECATED ( static Factory getInstance())
Deprecated:
Singletons will be removed from RSB (see bug 1245). Please use getFactory instead.
Todo:
Remove this after the 0.8 release.
ParticipantConfig rsb::Factory::getDefaultParticipantConfig ( ) const

Returns the default configuration for new participants.

Returns
copy of the default configuration

Definition at line 230 of file Factory.cpp.

References configMutex, and defaultConfig.

Factory & rsb::Factory::getInstanceBase ( )
staticprivate

Definition at line 93 of file Factory.cpp.

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

Returns the plugin manager instance used by the RSB core.

Returns
plugin manager instance

Definition at line 346 of file Factory.cpp.

References pluginManager.

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

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

Definition at line 218 of file Factory.h.

Member Data Documentation

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

Definition at line 237 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 236 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 231 of file Factory.h.

Referenced by Factory(), and getPluginManager().


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