Go to the documentation of this file.
11 #ifndef GAUDIKERNEL_TOOLHANDLE_H
12 #define GAUDIKERNEL_TOOLHANDLE_H
25 #include <type_traits>
65 return ( !
parent ?
"ToolSvc" : ( pNamed ? pNamed->name() :
"" ) );
152 template <
typename CT = T,
typename NCT = std::remove_const_t<T>,
153 typename = std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>>
183 #if defined( TOOLHANDLE_DEPR_WARN )
185 # pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" )
187 __attribute__( ( deprecated ) )
198 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
203 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
204 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
205 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
206 p->template setOwnerType<OWNER>();
209 template <
typename... Args>
261 algTool =
dynamic_cast<T*
>( iface );
280 return os << static_cast<const GaudiHandleInfo&>( handle );
307 template <
typename IFace>
310 void* m_ptr =
nullptr;
322 assert(
tool !=
nullptr );
324 ->queryInterface( IFace::interfaceID(), &(
self->m_ptr ) )
327 self->m_bind = [](
const void* ptr,
const EventContext& ) {
345 if ( !m_bind || !m_ptr ) {
346 throw GaudiException{
"request bind on toolhandle which was not (successfully) 'retrieved'", __PRETTY_FUNCTION__,
349 return ( *m_bind )( m_ptr,
ctx );
366 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
368 std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* =
nullptr )
373 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
379 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
380 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
381 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
382 p->template setOwnerType<OWNER>();
440 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
444 owner->addToolsArray( *
this );
447 p->template setOwnerType<OWNER>();
451 return os << static_cast<const GaudiHandleInfo&>( handle );
467 template <
class OWNER,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
471 owner->addToolsArray( *
this );
474 p->template setOwnerType<OWNER>();
478 #endif // ! GAUDIKERNEL_TOOLHANDLE_H
const std::string & parentName() const
The name of the parent.
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
virtual bool push_back(const std::string &myHandleTypeAndName)=0
Add a handle with given type and name.
Alias for backward compatibility.
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
void setParentName(std::string parent)
The name of the parent.
T * get()
Return the wrapped pointer, not calling retrieve() if null.
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Base class from which all concrete algorithm classes should be derived.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
constexpr static const auto SUCCESS
void setComponentType(std::string componentType)
The component type.
const 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.
constexpr static const auto FAILURE
T is the concrete handle type, e.g.
StatusCode retrieve() const
Retrieve the component.
StatusCode release() const
Release the component.
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.