1 #ifndef GAUDIKERNEL_TOOLHANDLE_H 2 #define GAUDIKERNEL_TOOLHANDLE_H 14 #include <type_traits> 50 return parent ?
"PrivateTool" :
"PublicTool";
56 return ( !parent ?
"ToolSvc" : ( pNamed ? pNamed->name() :
"" ) );
87 return i_retrieve(tool);
90 const IAlgTool *
get()
const {
return getAsIAlgTool(); }
98 virtual const IAlgTool * getAsIAlgTool()
const = 0;
100 virtual IAlgTool * getAsIAlgTool() = 0;
136 template<
typename CT = T,
170 #if defined(TOOLHANDLE_DEPR_WARN) 172 #pragma message("Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property") 188 template <
class OWNER,
197 if ( toolType.empty() ) {
199 }
else if ( toolType.find(
'/' ) == std::string::npos ) {
203 owner->declareTool( *
this,
std::move(toolType) ).ignore();
204 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move(name), *
this,
std::move(doc) );
205 p->template setOwnerType<OWNER>();
239 algTool = i_retrieve(iface) ?
dynamic_cast<T*
>(iface) :
nullptr;
246 return m_pToolSvc->releaseTool( this->nonConst(algTool) );
258 #ifdef ALLOW_TOOLHANDLE_NONCONSTNESS 266 T * operator->()
const {
269 T & operator*()
const {
275 [[
deprecated(
"FIXME!! should not call non-const method from a const ToolHandle")]]
322 template<
typename CT = T,
331 template <
class OWNER,
340 if ( toolType.empty() ) {
342 }
else if ( toolType.find(
'/' ) == std::string::npos ) {
346 owner->declareTool( *
this,
std::move(toolType) ).ignore();
347 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move(name), *
this,
std::move(doc) );
348 p->template setOwnerType<OWNER>();
415 template <
class OWNER,
420 owner->addToolsArray( *
this );
421 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move(name), *
this,
std::move(doc) );
422 p->template setOwnerType<OWNER>();
439 template <
class OWNER,
444 owner->addToolsArray( *
this );
445 auto p = owner->OWNER::PropertyHolderImpl::declareProperty(
std::move(name), *
this,
std::move(doc) );
446 p->template setOwnerType<OWNER>();
452 inline std::ostream& operator<<( std::ostream& os, const ToolHandle<T>& handle ) {
453 return operator<<(os, static_cast<const GaudiHandleInfo&>(handle) );
458 inline std::ostream& operator<<( std::ostream& os, const ToolHandleArray<T>& handle ) {
459 return operator<<(os, static_cast<const GaudiHandleInfo&>(handle) );
462 #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.
struct deprecated("use MergingTransformer instead")]] ListTransformer
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.