1 #ifndef GAUDIKERNEL_TOOLHANDLE_H 2 #define GAUDIKERNEL_TOOLHANDLE_H 14 #include <type_traits> 27 using DisableTool = Gaudi::tagged_bool<class DisableTool_tag>;
28 using EnableTool = Gaudi::tagged_bool<class EnableTool_tag>;
53 auto* pNamed = (
parent ? dynamic_cast<const INamedInterface*>(
parent ) : nullptr );
54 return ( !
parent ?
"ToolSvc" : ( pNamed ? pNamed->name() :
"" ) );
141 template <
typename CT = T,
typename NCT = std::remove_const_t<T>,
142 typename = std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>>
172 #if defined( TOOLHANDLE_DEPR_WARN ) 174 # pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" ) 176 __attribute__( ( deprecated ) )
187 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
193 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
194 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
195 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
196 p->template setOwnerType<OWNER>();
248 algTool = dynamic_cast<T*>( iface );
249 if ( algTool ==
nullptr ) {
267 #ifdef ALLOW_TOOLHANDLE_NONCONSTNESS 276 [[deprecated(
"FIXME!! should not call non-const method from a const ToolHandle" )]]
ToolHandle<T>& unConst()
const {
317 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
319 std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* =
nullptr )
324 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
330 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
331 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
332 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
333 p->template setOwnerType<OWNER>();
391 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
395 owner->addToolsArray( *
this );
398 p->template setOwnerType<OWNER>();
414 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
418 owner->addToolsArray( *
this );
421 p->template setOwnerType<OWNER>();
427 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
432 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
435 #endif // ! GAUDIKERNEL_TOOLHANDLE_H
Handle to be used in lieu of naked pointers to gaudis.
StatusCode release() const
Release the component.
Define general base for Gaudi exception.
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
std::string typeAndName() const
The full type and name: "type/name".
const std::vector< std::string > typesAndNames() const
Return a vector with "type/name" strings of all handles in the array.
void setComponentType(const std::string &componentType)
The component type.
constexpr static const auto SUCCESS
StatusCode retrieve() const
Retrieve the component.
void setParentName(const std::string &parent)
The name of the parent.
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
This class is used for returning status codes from appropriate routines.
const std::string & parentName() const
The name of the parent.
Definition of the basic interface.
T * get()
Return the wrapped pointer, not calling retrieve() if null.
Alias for backward compatibility.
Base class from which all concrete algorithm classes should be derived.
constexpr static const auto FAILURE
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Base class for all services.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Header file for std:chrono::duration-based Counters.
T is the concrete handle type, e.g.