fw4spl
fwServices::registry::ServiceFactory Class Reference

#include <ServiceFactory.hpp>

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

Public Types

typedef std::string KeyType
 
typedef std::vector< KeyType > KeyVectorType
 
typedef std::pair< std::string, std::string > StringPair
 
typedef ::boost::unordered_map< StringPair, bool > SupportMapType
 We keep boost here because std implementation does not support a pair of std::string as key.
 
typedef std::function< std::shared_ptr< ::fwServices::IService >) > FactoryType
 

Public Member Functions

virtual bool isA (const std::string &type) const override
 
FWSERVICES_API void parseBundleInformation ()
 Parse bundle information to retrieve service declaration.
 
FWSERVICES_API void addServiceFactory (FactoryType _factory, const std::string &simpl, const std::string &stype)
 
FWSERVICES_API void addObjectFactory (const std::string &simpl, const std::string &oimpl)
 
FWSERVICES_API std::shared_ptr< IServicecreate (const std::string &_srvImpl) const
 Create a service from a factory type.
 
FWSERVICES_API std::shared_ptr< IServicecreate (const std::string &_srvType, const std::string &_srvImpl) const
 Create a service from a factory type and verify that it is an inherited type of _srvType.
 
FWSERVICES_API void clearFactory ()
 
FWSERVICES_API std::vector< std::string > getImplementationIdFromObjectAndType (const std::string &object, const std::string &type) const
 return a vector of service implementation
 
FWSERVICES_API std::string getDefaultImplementationIdFromObjectAndType (const std::string &object, const std::string &type) const
 return the default service implementation for an object
 
FWSERVICES_API const std::vector< std::string > & getServiceObjects (const std::string &srvImpl) const
 return the objects registered for a given service.
 
FWSERVICES_API std::string getServiceDescription (const std::string &srvImpl) const
 return the service description.
 
FWSERVICES_API std::string getServiceTags (const std::string &srvImpl) const
 return the service capabilities.
 
FWSERVICES_API bool checkServiceValidity (const std::string &object, const std::string &srvImpl) const
 Check if the service with given object and implementation is valid.
 
FWSERVICES_API bool support (const std::string &object, const std::string &srvType)
 Check whether an object (object) supports service of type srvType. More...
 
FWSERVICES_API bool support (const std::string &object, const std::string &srvType, const std::string &srvImpl) const
 Check whether an object (object) supports service of type srvType and implementation srvImpl. More...
 
virtual FWSERVICES_API KeyVectorType getFactoryKeys () const
 returns the registered factory keys.
 
- Public Member Functions inherited from fwCore::BaseObject

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
static FWSERVICES_API ServiceFactory::sptr getDefault ()
 Return the unique Instance, create it if required at first access.
 
- 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
 

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

The ServiceFactory is a registrar of all the services. It allows to retrieve the informations necessary to instantiate the services.

Definition at line 33 of file ServiceFactory.hpp.

Member Function Documentation

bool fwServices::registry::ServiceFactory::support ( const std::string &  object,
const std::string &  srvType 
)

Check whether an object (object) supports service of type srvType.

Returns
true if service type supported

Definition at line 497 of file ServiceFactory.cpp.

bool fwServices::registry::ServiceFactory::support ( const std::string &  object,
const std::string &  srvType,
const std::string &  srvImpl 
) const

Check whether an object (object) supports service of type srvType and implementation srvImpl.

Returns
true if service type supported

Definition at line 469 of file ServiceFactory.cpp.


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