Go to the documentation of this file.
11 #ifndef GAUDIKERNEL_SERVICEHANDLE_H
12 #define GAUDIKERNEL_SERVICEHANDLE_H
26 #include <type_traits>
31 class ServiceHandleProperty;
54 :
GaudiHandle<T>( serviceName,
"Service", theParentName ) {}
57 template <
typename CT = T,
typename NCT = std::remove_const_t<T>,
58 typename = std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>>
63 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
66 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( PropName ), *
this,
std::move( doc ) );
67 p->template setOwnerType<OWNER>();
175 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
180 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
183 #endif // ! GAUDIKERNEL_SERVICEHANDLE_H
virtual bool push_back(const std::string &serviceTypeAndName)
Add a handle to the array with "type/name" given in <myHandleTypeAndName>.
const std::string & parentName() const
The name of the parent.
std::string messageName() const
name used for printing messages
SmartIF< ISvcLocator > & serviceLocator() const
ServiceHandleArray(const std::string &myParentName)
virtual bool push_back(const std::string &myHandleTypeAndName)=0
Add a handle with given type and name.
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
std::string name() const
The instance name: the part after the '/'.
virtual bool push_back(const ServiceHandle< T > &myHandle)
void setParentName(std::string parent)
The name of the parent.
virtual ~ServiceHandleArray()
ServiceHandleArray(const std::vector< std::string > &myTypesAndNamesList, const std::string &myComponentType, const std::string &myParentName)
Generic constructor.
GAUDI_API ISvcLocator * svcLocator()
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
T * get() const
Allow non const access to the service, even from a const handle...
an helper to share the implementation of service() among the various kernel base classes
SmartIF< IMessageSvc > & messageSvc() const
StatusCode getService(std::string_view name, bool createIf, const InterfaceID &iid, void **ppSvc) const
ServiceHandle(const ServiceHandle< NCT > &other)
Copy constructor from a non const T to const T service handle.
StatusCode retrieve(T *&service) const override
Do the real retrieval of the Service.
ServiceHandle(OWNER *owner, std::string PropName, const std::string &svcName, std::string doc="")
Autodeclaring constructor with property name, service type/name and documentation.
T * operator->() const
Allow non const access to the service, even from a const handle...
ServiceHandle(const std::string &serviceName, const std::string &theParentName)
Create a handle ('smart pointer') to a service.
std::ostream & operator<<(std::ostream &os, const ServiceHandle< T > &handle)
constexpr static const auto SUCCESS
const std::string & typeAndName() const
The full type and name: "type/name".
constexpr static const auto FAILURE
SmartIF< ISvcLocator > m_pSvcLocator
T is the concrete handle type, e.g.
SmartIF< IMessageSvc > m_pMessageSvc
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.