28class ServiceHandleProperty;
47 ServiceHandle(
const std::string& serviceName,
const std::string& theParentName )
48 :
GaudiHandle<T>( serviceName,
"Service", theParentName ) {}
51 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
52 requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
57 template <std::derived_from<IProperty> OWNER>
58 inline ServiceHandle( OWNER* owner, std::string PropName,
const std::string& svcName, std::string doc =
"" )
60 auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( PropName ), *
this, std::move( doc ) );
61 p->template setOwnerType<OWNER>();
135 ServiceHandleArray(
const std::vector<std::string>& myTypesAndNamesList,
const std::string& myComponentType,
136 const std::string& myParentName )
144 virtual bool push_back(
const std::string& serviceTypeAndName ) {
155 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
160 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
std::ostream & operator<<(std::ostream &os, const ServiceHandle< T > &handle)
Define general base for Gaudi exception.
GaudiHandleArray(const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
std::string name() const
The instance name: the part after the '/'.
std::string messageName() const
name used for printing messages
const std::string & typeAndName() const
The full type and name: "type/name".
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Handle to be used in lieu of naked pointers to gaudis.
T * get()
Return the wrapped pointer, not calling retrieve() if null.
StatusCode retrieve() const
Retrieve the component.
GaudiHandle(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
void setParentName(std::string parent)
The name of the parent.
const std::string & parentName() const
The name of the parent.
Array of Handles to be used in lieu of vector of naked pointers to tools.
virtual bool push_back(const std::string &serviceTypeAndName)
Add a handle with given type and name.
virtual ~ServiceHandleArray()
ServiceHandleArray(const std::string &myParentName)
virtual bool push_back(const ServiceHandle< T > &myHandle)
ServiceHandleArray(const std::vector< std::string > &myTypesAndNamesList, const std::string &myComponentType, const std::string &myParentName)
Generic constructor.
Handle to be used in lieu of naked pointers to services.
SmartIF< IMessageSvc > m_pMessageSvc
ServiceHandle(const ServiceHandle< NCT > &other)
Copy constructor from a non const T to const T service handle.
SmartIF< ISvcLocator > & serviceLocator() const
ServiceHandle(OWNER *owner, std::string PropName, const std::string &svcName, std::string doc="")
Autodeclaring constructor with property name, service type/name and documentation.
ServiceHandle(const std::string &serviceName, const std::string &theParentName)
Create a handle ('smart pointer') to a service.
SmartIF< IMessageSvc > & messageSvc() const
T * operator->() const
Allow non const access to the service, even from a const handle...
SmartIF< ISvcLocator > m_pSvcLocator
StatusCode retrieve(T *&service) const override
Do the real retrieval of the Service.
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
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< IService > service(std::string_view name, const bool quiet=false, const bool createIf=true) const
Small smart pointer class with automatic reference counting for IInterface.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
GAUDI_API ISvcLocator * svcLocator()
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.