The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
ServiceLocatorHelper.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
GaudiKernel/IService.h
>
12
#include <
GaudiKernel/ServiceLocatorHelper.h
>
13
14
SmartIF<IService>
ServiceLocatorHelper::service
( std::string_view name,
const
bool
quiet,
const
bool
createIf )
const
{
15
SmartIF<IService>
theSvc =
serviceLocator
()->
service
( name, createIf );
16
17
if
( theSvc ) {
18
if
( !quiet ) {
19
if
(
log
().level() <=
MSG::VERBOSE
)
20
log
() <<
MSG::VERBOSE
<<
"ServiceLocatorHelper::service: found service "
<< name <<
endmsg
;
21
}
22
}
else
{
23
// if not return an error
24
if
( !quiet ) {
log
() <<
MSG::ERROR
<<
"ServiceLocatorHelper::service: can not locate service "
<< name <<
endmsg
; }
25
}
26
return
theSvc;
27
}
IService.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
ServiceLocatorHelper.h
ISvcLocator::service
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
ServiceLocatorHelper::log
MsgStream & log() const
Definition
ServiceLocatorHelper.h:53
ServiceLocatorHelper::service
SmartIF< IService > service(std::string_view name, const bool quiet=false, const bool createIf=true) const
Definition
ServiceLocatorHelper.cpp:14
ServiceLocatorHelper::serviceLocator
ISvcLocator * serviceLocator() const
Definition
ServiceLocatorHelper.h:52
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition
SmartIF.h:28
MSG::ERROR
@ ERROR
Definition
IMessageSvc.h:22
MSG::VERBOSE
@ VERBOSE
Definition
IMessageSvc.h:22
GaudiKernel
src
Lib
ServiceLocatorHelper.cpp
Generated on
for The Gaudi Framework by
1.17.0