fw4spl
fwServices::registry::ServiceConfig Class Reference

This class allows to register all the service configuration which has the point extension "::fwServices::registry::ServiceConfig". More...

#include <ServiceConfig.hpp>

+ Inheritance diagram for fwServices::registry::ServiceConfig:
+ Collaboration diagram for fwServices::registry::ServiceConfig:

Public Member Functions

virtual bool isA (const std::string &type) const override
 
virtual FWSERVICES_API ~ServiceConfig ()
 Destructor.
 
FWSERVICES_API void parseBundleInformation ()
 Parses bundle information to retrieve service declaration. More...
 
FWSERVICES_API void addServiceConfigInfo (const std::string &configId, const std::string &service, const std::string &desc,::fwRuntime::ConfigurationElement::csptr config)
 Register a new service configuration. More...
 
FWSERVICES_API::fwRuntime::ConfigurationElement::csptr getServiceConfig (const std::string &configId, const std::string &serviceImpl="") const
 Returns the configuration with the given id for the service with the given implementation. More...
 
FWSERVICES_API const std::string & getConfigDesc (const std::string &configId) const
 Returns the description of the given configuration name. More...
 
FWSERVICES_API std::vector< std::string > getAllConfigForService (std::string serviceImpl, bool matchingOnly=false) const
 Returns a vector containing the names of the available config for the service with the given implementation. More...
 
FWSERVICES_API void clearRegistry ()
 Clear the registry. More...
 
- Public Member Functions inherited from fwCore::BaseObject

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
static FWSERVICES_API ServiceConfig::sptr getDefault ()
 Return the default global instance of ServiceConfig.
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Protected Types

typedef std::map< std::string, ServiceConfigInfo::sptr > Registry
 

Protected Member Functions

FWSERVICES_API ServiceConfig ()
 Constructor.
 

Protected Attributes

Registry m_reg
 Container of service information <configId, service config information>
 
mutable::fwCore::mt::ReadWriteMutex m_registryMutex
 Used to protect the registry access.
 

Static Protected Attributes

static const std::string CONFIG_EXT_POINT = "::fwServices::registry::ServiceConfig"
 
static ServiceConfig::sptr s_currentServiceConfig = ServiceConfig::New()
 The global instance of the service config.
 

Friends

template<class , class , class >
class ::fwTools::ClassFactory
 
class ::fwTools::Factory
 

Demangling methods

virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Detailed Description

This class allows to register all the service configuration which has the point extension "::fwServices::registry::ServiceConfig".

Registry config like :

1 <extension implements="::fwServices::registry::ServiceConfig">
2  <id>SDBOpenIOSelectorConfig</id>
3  <service>::uiIO::editor::SIOSelector</service>
4  <desc>"Open" action's IOSelector config</desc>
5  <config>
6  <type mode="reader" />
7  <selection mode="include" />
8  <addSelection service="::ioAtoms::SReader" />
9  <config id="MDAtomsConfig" service="::ioAtoms::SReader" />
10  </config>
11 </extension>

Definition at line 65 of file ServiceConfig.hpp.

Member Function Documentation

void fwServices::registry::ServiceConfig::addServiceConfigInfo ( const std::string &  configId,
const std::string &  service,
const std::string &  desc,
::fwRuntime::ConfigurationElement::csptr  config 
)

Register a new service configuration.

Parameters
configIdthe identifier of the registered configuration.
servicethe implementation of the service
descthe description of the configuration
configthe registered config
Note
This method is thread safe

Definition at line 74 of file ServiceConfig.cpp.

References m_reg, m_registryMutex, OSLM_DEBUG, and SLM_ASSERT.

Referenced by parseBundleInformation().

+ Here is the caller graph for this function:

void fwServices::registry::ServiceConfig::clearRegistry ( )

Clear the registry.

Note
This method is thread safe.

Definition at line 105 of file ServiceConfig.cpp.

References m_reg, and m_registryMutex.

std::vector< std::string > fwServices::registry::ServiceConfig::getAllConfigForService ( std::string  serviceImpl,
bool  matchingOnly = false 
) const

Returns a vector containing the names of the available config for the service with the given implementation.

Note
This method is thread safe

Definition at line 138 of file ServiceConfig.cpp.

References m_reg, and m_registryMutex.

const std::string & fwServices::registry::ServiceConfig::getConfigDesc ( const std::string &  configId) const

Returns the description of the given configuration name.

Note
This method is thread safe

Definition at line 127 of file ServiceConfig.cpp.

References m_reg, m_registryMutex, and SLM_ASSERT.

fwRuntime::ConfigurationElement::csptr fwServices::registry::ServiceConfig::getServiceConfig ( const std::string &  configId,
const std::string &  serviceImpl = "" 
) const

Returns the configuration with the given id for the service with the given implementation.

Note
This method is thread safe

Definition at line 113 of file ServiceConfig.cpp.

References m_reg, m_registryMutex, and SLM_ASSERT.

void fwServices::registry::ServiceConfig::parseBundleInformation ( )

Parses bundle information to retrieve service declaration.

Warning
This method must be launch only once. The same extension will not be parsed twice.
Note
This method is thread safe.

Definition at line 37 of file ServiceConfig.cpp.

References addServiceConfigInfo(), and SLM_ASSERT.

+ Here is the call graph for this function:


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