1 #ifndef GAUDIKERNEL_SERVICEHANDLE_H 2 #define GAUDIKERNEL_SERVICEHANDLE_H 16 #include <type_traits> 21 class ServiceHandleProperty;
44 :
GaudiHandle<T>( serviceName,
"Service", theParentName ) {}
47 template <
typename CT = T,
typename NCT = std::remove_const_t<T>,
48 typename = std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>>
53 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
56 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( PropName ), *
this,
std::move( doc ) );
57 p->template setOwnerType<OWNER>();
167 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
172 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
175 #endif // ! GAUDIKERNEL_SERVICEHANDLE_H Handle to be used in lieu of naked pointers to services.
SmartIF< ISvcLocator > m_pSvcLocator
ServiceHandle(OWNER *owner, std::string PropName, std::string svcName, std::string doc="")
Autodeclaring constructor with property name, service type/name and documentation.
an helper to share the implementation of service() among the various kernel base classes
Handle to be used in lieu of naked pointers to gaudis.
Define general base for Gaudi exception.
virtual ~ServiceHandleArray()
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
std::string typeAndName() const
The full type and name: "type/name".
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
SmartIF< IMessageSvc > m_pMessageSvc
constexpr static const auto SUCCESS
StatusCode retrieve() const
Retrieve the component.
void setParentName(const std::string &parent)
The name of the parent.
T * operator->() const
Allow non const access to the service, even from a const handle...
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
std::string name() const
The instance name: the part after the '/'.
GAUDI_API ISvcLocator * svcLocator()
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
This class is used for returning status codes from appropriate routines.
const std::string & parentName() const
The name of the parent.
StatusCode retrieve() const
Retrieve the Service.
Array of Handles to be used in lieu of vector of naked pointers to tools.
virtual bool push_back(const ServiceHandle< T > &myHandle)
T * get() const
Release the Service.
std::string messageName() const
name used for printing messages
std::ostream & operator<<(std::ostream &os, const ServiceHandle< T > &handle)
constexpr static const auto FAILURE
StatusCode retrieve(T *&service) const override
Do the real retrieval of the Service.
virtual bool push_back(const std::string &serviceTypeAndName)
Add a handle to the array with "type/name" given in <myHandleTypeAndName>.
ServiceHandle(const ServiceHandle< NCT > &other)
Copy constructor from a non const T to const T service handle.
ServiceHandle(const std::string &serviceName, const std::string &theParentName)
Create a handle ('smart pointer') to a service.
ServiceHandleArray(const std::vector< std::string > &myTypesAndNamesList, const std::string &myComponentType, const std::string &myParentName)
Generic constructor.
ServiceHandleArray(const std::string &myParentName)
SmartIF< IMessageSvc > & messageSvc() const
SmartIF< ISvcLocator > & serviceLocator() const
Do the real release of the Service.
T is the concrete handle type, e.g.