The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
ISvcLocator Class Referenceabstract

The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to locate services in the framework. More...

#include <GaudiKernel/ISvcLocator.h>

Inheritance diagram for ISvcLocator:
Collaboration diagram for ISvcLocator:

Public Member Functions

 DeclareInterfaceID (ISvcLocator, 3, 0)
 InterfaceID.
 
virtual const std::list< IService * > & getServices () const =0
 Return the list of Services.
 
virtual bool existsService (std::string_view name) const =0
 Check the existence of a service given a service name.
 
virtual SmartIF< IService > & service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
 Returns a smart pointer to a service.
 
template<typename T>
SmartIF< T > service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
 Returns a smart pointer to the requested interface of a service.
 
template<typename IFace>
SmartIF< IFace > as ()
 
Gaudi::Interfaces::IOptionsSvcgetOptsSvc ()
 Direct access to Gaudi::Interfaces::IOptionsSvc implementation.
 
Gaudi::Monitoring::HubmonitoringHub ()
 
- Public Member Functions inherited from IInterface
template<Gaudi::IsInterface TARGET>
TARGET * cast ()
 
template<Gaudi::IsInterface TARGET>
TARGET const * cast () const
 
template<typename TARGET>
requires ( !Gaudi::IsInterface<TARGET> )
TARGET * cast ()
 
template<typename TARGET>
requires ( !Gaudi::IsInterface<TARGET> )
TARGET const * cast () const
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces.
 
virtual unsigned long addRef () const =0
 Increment the reference count of Interface instance.
 
virtual unsigned long release () const =0
 Release Interface instance.
 
virtual unsigned long refCount () const =0
 Current reference count.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance.
 
virtual ~IInterface ()=default
 Virtual destructor.
 
virtual void const * i_cast (const InterfaceID &) const =0
 
void * i_cast (const InterfaceID &iid)
 

Additional Inherited Members

- Public Types inherited from IInterface
enum class  Status : StatusCode::code_t {
  FAILURE = 0 , SUCCESS = 1 , NO_INTERFACE , VERSMISMATCH ,
  LAST_ERROR
}
 Return status. More...
 
using iid = Gaudi::InterfaceId<IInterface, 0, 0>
 Interface ID.
 
using ext_iids = Gaudi::interface_list<iid>
 Extra interfaces.
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
- Protected Member Functions inherited from IInterface
virtual unsigned long decRef () const =0
 Decrement reference count and return the new reference count.
 

Detailed Description

The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to locate services in the framework.

Clients use this interface to locate references to interfaces of services existing in the application. This operation needs to be done before the service can be used by the client. Typically "locating the services" is done at the initialization phase of the clients.

Author
Pere Mato

Definition at line 42 of file ISvcLocator.h.

Member Function Documentation

◆ as()

template<typename IFace>
SmartIF< IFace > ISvcLocator::as ( )
inline

Definition at line 64 of file ISvcLocator.h.

64 {
65 return SmartIF<IFace>{ this };
66 }

◆ DeclareInterfaceID()

ISvcLocator::DeclareInterfaceID ( ISvcLocator ,
3 ,
0  )

◆ existsService()

virtual bool ISvcLocator::existsService ( std::string_view name) const
pure virtual

Check the existence of a service given a service name.

◆ getOptsSvc()

Gaudi::Interfaces::IOptionsSvc & ISvcLocator::getOptsSvc ( )

Direct access to Gaudi::Interfaces::IOptionsSvc implementation.

Definition at line 17 of file ISvcLocator.cpp.

17 {
18 using namespace Gaudi::Interfaces;
19 auto p = dynamic_cast<IOptionsSvc*>( service( "JobOptionsSvc" ).get() );
20 if ( !p ) throw std::runtime_error( "cannot dynamic_cast JobOptionsSvc to IOptionsSvc*" );
21 return *p;
22}
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
TYPE * get() const
Get interface pointer.
Definition SmartIF.h:82

◆ getServices()

virtual const std::list< IService * > & ISvcLocator::getServices ( ) const
pure virtual

Return the list of Services.

◆ monitoringHub()

Gaudi::Monitoring::Hub & ISvcLocator::monitoringHub ( )

Definition at line 24 of file ISvcLocator.cpp.

24{ return as<IAppMgrUI>()->monitoringHub(); }
SmartIF< IFace > as()
Definition ISvcLocator.h:64

◆ service() [1/2]

template<typename T>
SmartIF< T > ISvcLocator::service ( const Gaudi::Utils::TypeNameString & typeName,
const bool createIf = true )
inline

Returns a smart pointer to the requested interface of a service.

Definition at line 58 of file ISvcLocator.h.

58 {
59 return SmartIF<T>{ service( typeName, createIf ) };
60 }

◆ service() [2/2]

virtual SmartIF< IService > & ISvcLocator::service ( const Gaudi::Utils::TypeNameString & typeName,
const bool createIf = true )
pure virtual

Returns a smart pointer to a service.


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