Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
11 #ifndef GAUDIKERNEL_TOOLHANDLE_H
12 #define GAUDIKERNEL_TOOLHANDLE_H
28 #include <type_traits>
69 return ( !
parent ?
"ToolSvc" : ( pNamed ? pNamed->name() :
"" ) );
156 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
157 requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
187 #if defined( TOOLHANDLE_DEPR_WARN )
189 # pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" )
191 __attribute__( ( deprecated ) )
202 template <std::derived_from<IProperty> OWNER>
207 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
208 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
209 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
210 p->template setOwnerType<OWNER>();
213 template <
typename... Args>
265 algTool =
dynamic_cast<T*
>( iface );
284 return os << static_cast<const GaudiHandleInfo&>( handle );
311 template <
typename IFace>
314 void* m_ptr =
nullptr;
326 assert(
tool !=
nullptr );
328 ->queryInterface( IFace::interfaceID(), &(
self->m_ptr ) )
331 self->m_bind = [](
const void* ptr,
const EventContext& ) {
349 if ( !m_bind || !m_ptr ) {
350 throw GaudiException{
"request bind on toolhandle which was not (successfully) 'retrieved'", __PRETTY_FUNCTION__,
353 return ( *m_bind )( m_ptr,
ctx );
370 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
371 requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
377 template <std::derived_from<IProperty> OWNER>
383 if ( !toolType.
empty() and toolType.
find(
'/' ) == std::string::npos ) { toolType +=
'/' + toolType; }
384 owner->declareTool( *
this,
std::move( toolType ) ).ignore();
385 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move( propName ), *
this,
std::move( doc ) );
386 p->template setOwnerType<OWNER>();
444 template <std::derived_from<IProperty> OWNER>
448 owner->addToolsArray( *
this );
451 p->template setOwnerType<OWNER>();
455 return os << static_cast<const GaudiHandleInfo&>( handle );
471 template <std::derived_from<IProperty> OWNER>
475 owner->addToolsArray( *
this );
478 p->template setOwnerType<OWNER>();
482 #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.