1 #ifndef GAUDIKERNEL_TOOLHANDLE_H 2 #define GAUDIKERNEL_TOOLHANDLE_H 13 #include <type_traits> 52 return ( !parent ?
"ToolSvc" : ( pNamed ? pNamed->name() :
"" ) );
78 const IAlgTool*
get()
const {
return getAsIAlgTool(); }
85 virtual const IAlgTool* getAsIAlgTool()
const = 0;
87 virtual IAlgTool* getAsIAlgTool() = 0;
153 #if defined( TOOLHANDLE_DEPR_WARN ) 155 #pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" ) 169 template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>
::type>
175 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) {
179 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
180 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( name ), *
this,
std::move( doc ) );
181 p->template setOwnerType<OWNER>();
216 algTool = i_retrieve( iface ) ?
dynamic_cast<T*
>( iface ) :
nullptr;
221 StatusCode release( T* algTool )
const override {
return m_pToolSvc->releaseTool( this->nonConst( algTool ) ); }
230 #ifdef ALLOW_TOOLHANDLE_NONCONSTNESS 239 [[deprecated(
"FIXME!! should not call non-const method from a const ToolHandle" )]]
ToolHandle<T>& unConst()
const 299 template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>
::type>
306 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) {
310 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
311 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( name ), *
this,
std::move( doc ) );
312 p->template setOwnerType<OWNER>();
376 template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>
::type>
381 owner->addToolsArray( *
this );
382 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( name ), *
this,
std::move( doc ) );
383 p->template setOwnerType<OWNER>();
402 template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>
::type>
407 owner->addToolsArray( *
this );
408 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( name ), *
this,
std::move( doc ) );
409 p->template setOwnerType<OWNER>();
414 inline std::ostream& operator<<( std::ostream& os, const ToolHandle<T>& handle )
416 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
420 inline std::ostream& operator<<( std::ostream& os, const ToolHandleArray<T>& handle )
422 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
425 #endif // ! GAUDIKERNEL_TOOLHANDLE_H
Handle to be used in lieu of naked pointers to gaudis.
std::remove_const< CLASS >::type * nonConst(CLASS *p) const
Cast a pointer to a non const type.
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
void setComponentType(const std::string &componentType)
The component type.
const std::string & parentName() const
The name of the parent.
void setParentName(const std::string &parent)
The name of the parent.
StatusCode release() const
Release the component.
void push_back(Container &c, const Value &v, std::true_type)
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
T * get()
Return the wrapped pointer, not calling retrieve() if null.
StatusCode retrieve() const
Retrieve the component.
Base class from which all concrete algorithm classes should be derived.
IInterface compliant class extending IInterface with the name() method.
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
std::string typeAndName() const
The full type and name: "type/name".
Base class for all services.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
T is the concrete handle type, e.g.