Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ToolHandle.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
14 #include <GaudiKernel/IAlgTool.h>
15 #include <GaudiKernel/IBinder.h>
17 #include <GaudiKernel/IToolSvc.h>
19 #include <GaudiKernel/TaggedBool.h>
20 #include <cassert>
21 #include <concepts>
22 #include <ostream>
23 #include <string>
24 #include <tuple>
25 #include <type_traits>
26 #include <utility>
27 #include <vector>
28 
29 class IInterface;
30 class IToolSvc;
31 namespace Gaudi {
32  class Algorithm;
33 }
34 class AlgTool;
35 class Service;
38 
41 
42 protected:
43  ToolHandleInfo( const IInterface* parent = nullptr, bool createIf = true )
45 
46 public:
47  virtual ~ToolHandleInfo() = default;
48 
49  bool isPublic() const noexcept { return !m_parent; }
50 
51  bool createIf() const noexcept { return m_createIf; }
52 
53  const IInterface* parent() const noexcept { return m_parent; }
54 
55  //
56  // Some helper functions
57  //
58 
59  static std::string toolComponentType( const IInterface* parent ) { return parent ? "PrivateTool" : "PublicTool"; }
60 
61  static std::string toolParentName( const IInterface* parent ) {
62  auto* pNamed = ( parent ? dynamic_cast<const INamedInterface*>( parent ) : nullptr );
63  return ( !parent ? "ToolSvc" : ( pNamed ? pNamed->name() : "" ) );
64  }
65 
66 protected:
67  const IInterface* m_parent = nullptr;
68  bool m_createIf{ true };
69 };
70 
79 
80 protected:
81  BaseToolHandle( const IInterface* parent = nullptr, bool createIf = true ) : ToolHandleInfo( parent, createIf ) {}
82 
83  virtual StatusCode i_retrieve( IAlgTool*& ) const = 0;
84 
85 public:
86  StatusCode retrieve( IAlgTool*& tool ) const { return i_retrieve( tool ); }
87 
88  virtual StatusCode retrieve() const = 0;
89  virtual StatusCode retrieve( DisableTool sd ) = 0;
90  virtual StatusCode retrieve( EnableTool sd ) = 0;
91 
92  const IAlgTool* get() const { return getAsIAlgTool(); }
93 
94  IAlgTool* get() { return getAsIAlgTool(); }
95 
96  virtual std::string typeAndName() const = 0;
97 
99  bool isEnabled() const {
100  // the handle is considered enabled if the type/name is valid and the
101  // enabled flag was set to true, or it was already retrieved
102  return ( m_enabled && !typeAndName().empty() ) || get();
103  }
104 
105  void enable() { m_enabled = true; }
106 
107  void disable() { m_enabled = false; }
108 
109  bool setEnabled( bool flag ) { return std::exchange( m_enabled, flag ); }
110 
111 protected:
112  virtual const IAlgTool* getAsIAlgTool() const = 0;
113 
114  virtual IAlgTool* getAsIAlgTool() = 0;
115 
116  bool m_enabled = true;
117 };
118 
129 template <class T>
130 class ToolHandle : public BaseToolHandle, public GaudiHandle<T> {
131 
132  friend class Gaudi::Algorithm;
133  friend class AlgTool;
134  friend class Service;
135 
136  template <typename... Args, std::size_t... Is>
137  ToolHandle( std::tuple<Args...>&& args, std::index_sequence<Is...> )
138  : ToolHandle( std::get<Is>( std::move( args ) )... ) {}
139 
140 public:
144  ToolHandle( const IInterface* parent = nullptr, bool createIf = true )
147  , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
148 
150  template <typename CT = T, typename NCT = std::remove_const_t<T>>
151  requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
152  ToolHandle( const ToolHandle<NCT>& other )
153  : BaseToolHandle( other.parent(), other.createIf() )
154  , GaudiHandle<CT>( other )
155  , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
156 
157 public:
158  //
159  // Constructors etc.
160  //
161 
181 #if defined( TOOLHANDLE_DEPR_WARN )
182 // warn about using deprecated explicit ToolHandle construction
183 # pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" )
184 
185  __attribute__( ( deprecated ) )
186 
187 #endif
188  ToolHandle( const std::string& toolTypeAndName, const IInterface* parent = nullptr, bool createIf = true )
190  , GaudiHandle<T>( toolTypeAndName, toolComponentType( parent ), toolParentName( parent ) )
191  , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {
192  }
193 
196  template <std::derived_from<IProperty> OWNER>
197  ToolHandle( OWNER* owner, std::string propName, std::string toolType, std::string doc = "" ) : ToolHandle( owner ) {
198  // convert name and type to a valid type/name string
199  // - if type does not contain '/' use type/type
200  // - otherwise type is already a type/name string
201  if ( !toolType.empty() and toolType.find( '/' ) == std::string::npos ) { toolType += '/' + toolType; }
202  owner->declareTool( *this, std::move( toolType ) ).ignore();
203  auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( propName ), *this, std::move( doc ) );
204  p->template setOwnerType<OWNER>();
205  }
206 
207  template <typename... Args>
208  ToolHandle( std::tuple<Args...>&& args ) : ToolHandle( std::move( args ), std::index_sequence_for<Args...>{} ) {}
209 
210 public:
211  StatusCode initialize( const std::string& toolTypeAndName, const IInterface* parent = nullptr,
212  bool createIf = true ) {
213 
214  GaudiHandleBase::setTypeAndName( toolTypeAndName );
217 
218  m_parent = parent;
220 
221  return m_pToolSvc.initialize( "ToolSvc", GaudiHandleBase::parentName() );
222  }
223 
226  StatusCode retrieve() const override { // not really const, because it updates m_pObject
227  return GaudiHandle<T>::retrieve();
228  }
229 
230  StatusCode retrieve( DisableTool sd ) override {
231  if ( isEnabled() && sd == DisableTool{ false } ) {
232  return GaudiHandle<T>::retrieve();
233  } else {
234  disable();
235  return StatusCode::SUCCESS;
236  }
237  }
238 
239  StatusCode retrieve( EnableTool sd ) override {
240  if ( isEnabled() && sd == EnableTool{ true } ) {
241  return GaudiHandle<T>::retrieve();
242  } else {
243  disable();
244  return StatusCode::SUCCESS;
245  }
246  }
247 
250  StatusCode release() const { // not really const, because it updates m_pObject
251  return GaudiHandle<T>::release();
252  }
253 
255  StatusCode retrieve( T*& algTool ) const override {
256  IAlgTool* iface = nullptr;
257  if ( i_retrieve( iface ).isFailure() ) { return StatusCode::FAILURE; }
258 
259  algTool = dynamic_cast<T*>( iface );
260  if ( !algTool ) {
261  throw GaudiException( "unable to dcast AlgTool " + typeAndName() + " to interface " +
262  System::typeinfoName( typeid( T ) ),
263  typeAndName() + " retrieve", StatusCode::FAILURE );
264  }
265  return StatusCode::SUCCESS;
266  }
267 
269  StatusCode release( T* algTool ) const override { return m_pToolSvc->releaseTool( ::details::nonConst( algTool ) ); }
270 
271  std::string typeAndName() const override { return GaudiHandleBase::typeAndName(); }
272 
273  std::add_const_t<T>* get() const { return GaudiHandle<T>::get(); }
274 
275  T* get() { return GaudiHandle<T>::get(); }
276 
277  friend std::ostream& operator<<( std::ostream& os, const ToolHandle<T>& handle ) {
278  return os << static_cast<const GaudiHandleInfo&>( handle );
279  }
280 
281 protected:
282  const IAlgTool* getAsIAlgTool() const override {
283  // const cast to support T being const
284  return GaudiHandle<T>::get();
285  }
286 
287  IAlgTool* getAsIAlgTool() override {
288  // const cast to support T being const
290  }
291 
292  StatusCode i_retrieve( IAlgTool*& algTool ) const override {
295  }
296 
297 private:
298  //
299  // Private data members
300  //
302 };
303 
304 // explicit specialization for IBinder<IFace>
305 template <typename IFace>
306 class ToolHandle<Gaudi::Interface::Bind::IBinder<IFace>> : public ToolHandle<IAlgTool> {
307 
308  void* m_ptr = nullptr;
309  Gaudi::Interface::Bind::Box<IFace> ( *m_bind )( void const*, const EventContext& ) = nullptr;
310 
311 public:
314  StatusCode retrieve() const override {
315  // FIXME: why is `retrieve` const????
316  auto self = const_cast<ToolHandle<Gaudi::Interface::Bind::IBinder<IFace>>*>( this );
317 
319  const IAlgTool* tool = get();
320  assert( tool != nullptr ); // retrieve was succesfull, so get() better return something valid!
321  return const_cast<IAlgTool*>( tool )
322  ->queryInterface( IFace::interfaceID(), &( self->m_ptr ) )
323  .andThen( [&] {
324  // TODO: what happens to the refCount?
325  self->m_bind = []( const void* ptr, const EventContext& ) {
326  return Gaudi::Interface::Bind::Box<IFace>( static_cast<IFace const*>( ptr ) );
327  };
328  } )
329  .orElse( [&]() {
330  return const_cast<IAlgTool*>( tool )
331  ->queryInterface( Gaudi::Interface::Bind::IBinder<IFace>::interfaceID(), &( self->m_ptr ) )
332  .andThen( [&] {
333  // TODO: what happens to the refCount?
334  self->m_bind = []( const void* ptr, const EventContext& ctx ) {
335  return static_cast<Gaudi::Interface::Bind::IBinder<IFace> const*>( ptr )->bind( ctx );
336  };
337  } );
338  } );
339  } );
340  }
341 
342  auto bind( const EventContext& ctx ) const {
343  if ( !m_bind || !m_ptr ) {
344  throw GaudiException{ "request bind on toolhandle which was not (successfully) 'retrieved'", __PRETTY_FUNCTION__,
346  }
347  return ( *m_bind )( m_ptr, ctx );
348  }
349 };
350 
354 template <class T>
355 class PublicToolHandle : public ToolHandle<T> {
356 public:
358  PublicToolHandle( const char* toolTypeAndName, bool createIf = true )
359  : PublicToolHandle{ std::string{ toolTypeAndName }, createIf } {}
360  PublicToolHandle( const std::string& toolTypeAndName, bool createIf = true )
361  : ToolHandle<T>( toolTypeAndName, nullptr, createIf ) {}
362 
364  template <typename CT = T, typename NCT = std::remove_const_t<T>>
365  requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
367  : ToolHandle<T>( static_cast<const ToolHandle<NCT>&>( other ) ) {}
368 
371  template <std::derived_from<IProperty> OWNER>
372  inline PublicToolHandle( OWNER* owner, std::string propName, std::string toolType, std::string doc = "" )
373  : PublicToolHandle() {
374  // convert name and type to a valid type/name string
375  // - if type does not contain '/' use type/type
376  // - otherwise type is already a type/name string
377  if ( !toolType.empty() and toolType.find( '/' ) == std::string::npos ) { toolType += '/' + toolType; }
378  owner->declareTool( *this, std::move( toolType ) ).ignore();
379  auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( propName ), *this, std::move( doc ) );
380  p->template setOwnerType<OWNER>();
381  }
382 };
383 
384 //-------------------------------------------------------------------------//
385 
396 template <class T>
397 class ToolHandleArray : public ToolHandleInfo, public GaudiHandleArray<ToolHandle<T>> {
398 public:
399  //
400  // Constructors
401  //
408  ToolHandleArray( const std::vector<std::string>& myTypesAndNames, const IInterface* parent = nullptr,
409  bool createIf = true )
413 
418  ToolHandleArray( const IInterface* parent = nullptr, bool createIf = true )
422 
427  bool push_back( const std::string& toolTypeAndName ) override {
428  ToolHandle<T> handle( toolTypeAndName, ToolHandleInfo::parent(), ToolHandleInfo::createIf() );
430  return true;
431  }
432 
434  bool push_back( const ToolHandle<T>& myHandle ) override { return push_back( myHandle.typeAndName() ); }
435 
438  template <std::derived_from<IProperty> OWNER>
439  inline ToolHandleArray( OWNER* owner, std::string name, const std::vector<std::string>& typesAndNames = {},
440  std::string doc = "" )
441  : ToolHandleArray( owner ) {
442  owner->addToolsArray( *this );
444  auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( name ), *this, std::move( doc ) );
445  p->template setOwnerType<OWNER>();
446  }
447 
448  friend std::ostream& operator<<( std::ostream& os, const ToolHandleArray<T>& handle ) {
449  return os << static_cast<const GaudiHandleInfo&>( handle );
450  }
451 };
452 
456 template <class T>
458 public:
460  PublicToolHandleArray( const std::vector<std::string>& typesAndNames, bool createIf = true )
462 
465  template <std::derived_from<IProperty> OWNER>
466  PublicToolHandleArray( OWNER* owner, std::string name, const std::vector<std::string>& typesAndNames = {},
467  std::string doc = "" )
469  owner->addToolsArray( *this );
471  auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( name ), *this, std::move( doc ) );
472  p->template setOwnerType<OWNER>();
473  }
474 };
ToolHandle::retrieve
StatusCode retrieve() const override
Retrieve the AlgTool.
Definition: ToolHandle.h:226
GaudiHandleInfo::parentName
const std::string & parentName() const
The name of the parent.
Definition: GaudiHandle.h:62
PublicToolHandle::PublicToolHandle
PublicToolHandle(const std::string &toolTypeAndName, bool createIf=true)
Definition: ToolHandle.h:360
GaudiHandle.h
IAlgTool
Definition: IAlgTool.h:29
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition: StatusCode.h:163
BaseToolHandle::disable
void disable()
Definition: ToolHandle.h:107
GaudiPartProp.decorators.std
std
Definition: decorators.py:32
BaseToolHandle::BaseToolHandle
BaseToolHandle(const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:81
GaudiHandleArray< ToolHandle< T > >::push_back
virtual bool push_back(const std::string &myHandleTypeAndName)=0
Add a handle with given type and name.
ServiceHandle< IToolSvc >
BaseToolHandle::typeAndName
virtual std::string typeAndName() const =0
GaudiException
Definition: GaudiException.h:29
Algorithm
Alias for backward compatibility.
Definition: Algorithm.h:58
ServiceHandle::initialize
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
Definition: ServiceHandle.h:64
GaudiPartProp.decorators.get
get
decorate the vector of properties
Definition: decorators.py:283
Gaudi::Interface::Bind::Box
Definition: IBinder.h:22
ToolHandleArray::push_back
bool push_back(const ToolHandle< T > &myHandle) override
Ensure that for added handles the parent and creatIf are taken from this array.
Definition: ToolHandle.h:434
ToolHandleInfo::toolComponentType
static std::string toolComponentType(const IInterface *parent)
Definition: ToolHandle.h:59
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:260
ServiceHandle.h
PublicToolHandle::requires
requires(std::is_const_v< CT > &&!std::is_same_v< CT, NCT >) PublicToolHandle(const PublicToolHandle< NCT > &other)
Copy constructor from a non const T to const T tool handle.
Definition: ToolHandle.h:365
BaseToolHandle::i_retrieve
virtual StatusCode i_retrieve(IAlgTool *&) const =0
PublicToolHandleArray::PublicToolHandleArray
PublicToolHandleArray(OWNER *owner, std::string name, const std::vector< std::string > &typesAndNames={}, std::string doc="")
Autodeclaring constructor with property name, tool type/name and documentation.
Definition: ToolHandle.h:466
BaseToolHandle::isEnabled
bool isEnabled() const
Helper to check if the ToolHandle should be retrieved.
Definition: ToolHandle.h:99
GaudiHandleInfo::setParentName
void setParentName(std::string parent)
The name of the parent.
Definition: GaudiHandle.h:84
ToolHandle::ToolHandle
ToolHandle(std::tuple< Args... > &&args)
Definition: ToolHandle.h:208
Service
Definition: Service.h:39
GaudiHandleBase
Definition: GaudiHandle.h:102
PublicToolHandle::PublicToolHandle
PublicToolHandle(bool createIf=true)
Definition: ToolHandle.h:357
GaudiHandle
Definition: GaudiHandle.h:176
ToolHandleInfo::toolParentName
static std::string toolParentName(const IInterface *parent)
Definition: ToolHandle.h:61
ToolHandleArray::ToolHandleArray
ToolHandleArray(const IInterface *parent=nullptr, bool createIf=true)
Constructor which creates and empty list.
Definition: ToolHandle.h:418
ToolHandle::requires
requires(std::is_const_v< CT > &&!std::is_same_v< CT, NCT >) ToolHandle(const ToolHandle< NCT > &other)
Copy constructor from a non const T to const T tool handle.
Definition: ToolHandle.h:151
PublicToolHandleArray::PublicToolHandleArray
PublicToolHandleArray(const std::vector< std::string > &typesAndNames, bool createIf=true)
Definition: ToolHandle.h:460
ToolHandle::retrieve
StatusCode retrieve(T *&algTool) const override
Do the real retrieval of the AlgTool.
Definition: ToolHandle.h:255
IToolSvc.h
ToolHandle
Definition: ToolHandle.h:130
INamedInterface.h
bug_34121.tool
tool
Definition: bug_34121.py:18
BaseToolHandle::retrieve
virtual StatusCode retrieve(DisableTool sd)=0
GaudiHandle::release
virtual StatusCode release(T *comp) const
Release the component.
Definition: GaudiHandle.h:305
details::nonConst
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
Definition: GaudiHandle.h:26
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:64
Gaudi::tagged_bool_ns::tagged_bool
Definition: TaggedBool.h:15
ToolHandle::ToolHandle
ToolHandle(const IInterface *parent=nullptr, bool createIf=true)
Constructor for a tool with default tool type and name.
Definition: ToolHandle.h:144
TaggedBool.h
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:234
PublicToolHandle::PublicToolHandle
PublicToolHandle(const char *toolTypeAndName, bool createIf=true)
Definition: ToolHandle.h:358
ToolHandleInfo
General info and helper functions for toolhandles and arrays.
Definition: ToolHandle.h:40
ToolHandle::get
T * get()
Definition: ToolHandle.h:275
IAlgTool.h
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:87
ToolHandle::ToolHandle
ToolHandle(std::tuple< Args... > &&args, std::index_sequence< Is... >)
Definition: ToolHandle.h:137
ToolHandleArray
Definition: ToolHandle.h:397
ToolHandle::ToolHandle
ToolHandle(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Create a handle ('smart pointer') to a tool.
Definition: ToolHandle.h:188
PublicToolHandleArray
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition: ToolHandle.h:457
BaseToolHandle::retrieve
StatusCode retrieve(IAlgTool *&tool) const
Definition: ToolHandle.h:86
ToolHandle::i_retrieve
StatusCode i_retrieve(IAlgTool *&algTool) const override
Definition: ToolHandle.h:292
PublicToolHandle
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition: ToolHandle.h:355
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
IToolSvc::retrieve
virtual StatusCode retrieve(std::string_view type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent=0, bool createIf=true)=0
Retrieve tool with tool dependent part of the name automatically assigned.
ToolHandle::release
StatusCode release() const
Release the AlgTool.
Definition: ToolHandle.h:250
BaseToolHandle::retrieve
virtual StatusCode retrieve(EnableTool sd)=0
ToolHandle::operator<<
friend std::ostream & operator<<(std::ostream &os, const ToolHandle< T > &handle)
Definition: ToolHandle.h:277
ToolHandle::getAsIAlgTool
const IAlgTool * getAsIAlgTool() const override
Definition: ToolHandle.h:282
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
ToolHandle::m_pToolSvc
ServiceHandle< IToolSvc > m_pToolSvc
Definition: ToolHandle.h:301
IBinder.h
ToolHandleArray::ToolHandleArray
ToolHandleArray(const std::vector< std::string > &myTypesAndNames, const IInterface *parent=nullptr, bool createIf=true)
Generic constructor.
Definition: ToolHandle.h:408
BaseToolHandle::enable
void enable()
Definition: ToolHandle.h:105
ToolHandleArray::ToolHandleArray
ToolHandleArray(OWNER *owner, std::string name, const std::vector< std::string > &typesAndNames={}, std::string doc="")
Autodeclaring constructor with property name, tool type/name and documentation.
Definition: ToolHandle.h:439
ToolHandleInfo::isPublic
bool isPublic() const noexcept
Definition: ToolHandle.h:49
GaudiHandleArrayBase::setTypesAndNames
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
Definition: GaudiHandle.cpp:63
BaseToolHandle::get
IAlgTool * get()
Definition: ToolHandle.h:94
INamedInterface
Definition: INamedInterface.h:23
BaseToolHandle::retrieve
virtual StatusCode retrieve() const =0
PublicToolHandle::PublicToolHandle
PublicToolHandle(OWNER *owner, std::string propName, std::string toolType, std::string doc="")
Autodeclaring constructor with property propName, tool type/name and documentation.
Definition: ToolHandle.h:372
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
ToolHandle::ToolHandle
ToolHandle(OWNER *owner, std::string propName, std::string toolType, std::string doc="")
Autodeclaring constructor with property propName, tool type/name and documentation.
Definition: ToolHandle.h:197
ToolHandle::retrieve
StatusCode retrieve(DisableTool sd) override
Definition: ToolHandle.h:230
AlgTool
Definition: AlgTool.h:55
BaseToolHandle
Definition: ToolHandle.h:78
gaudirun.args
args
Definition: gaudirun.py:336
ToolHandleInfo::m_parent
const IInterface * m_parent
Definition: ToolHandle.h:67
ToolHandleInfo::~ToolHandleInfo
virtual ~ToolHandleInfo()=default
IInterface
Definition: IInterface.h:225
BaseToolHandle::get
const IAlgTool * get() const
Definition: ToolHandle.h:92
EventContext
Definition: EventContext.h:34
IToolSvc::releaseTool
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
ToolHandleInfo::m_createIf
bool m_createIf
Definition: ToolHandle.h:68
ToolHandle::retrieve
StatusCode retrieve(EnableTool sd) override
Definition: ToolHandle.h:239
GaudiHandleInfo::setComponentType
void setComponentType(std::string componentType)
The component type.
Definition: GaudiHandle.h:81
ToolHandle::getAsIAlgTool
IAlgTool * getAsIAlgTool() override
Definition: ToolHandle.h:287
PublicToolHandleArray::PublicToolHandleArray
PublicToolHandleArray(bool createIf=true)
Definition: ToolHandle.h:459
GaudiHandleBase::typeAndName
const std::string & typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:128
ToolHandle::initialize
StatusCode initialize(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:211
ToolHandleInfo::ToolHandleInfo
ToolHandleInfo(const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:43
GaudiHandleArrayBase::typesAndNames
const std::vector< std::string > typesAndNames() const
Return a vector with "type/name" strings of all handles in the array.
Definition: GaudiHandle.cpp:77
ToolHandle::typeAndName
std::string typeAndName() const override
Definition: ToolHandle.h:271
ToolHandle< Gaudi::Interface::Bind::IBinder< IFace > >::bind
auto bind(const EventContext &ctx) const
Definition: ToolHandle.h:342
BaseToolHandle::setEnabled
bool setEnabled(bool flag)
Definition: ToolHandle.h:109
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
ToolHandle< Gaudi::Interface::Bind::IBinder< IFace > >::retrieve
StatusCode retrieve() const override
Definition: ToolHandle.h:314
BaseToolHandle::m_enabled
bool m_enabled
Definition: ToolHandle.h:116
IToolSvc
Definition: IToolSvc.h:28
ToolHandleArray::operator<<
friend std::ostream & operator<<(std::ostream &os, const ToolHandleArray< T > &handle)
Definition: ToolHandle.h:448
GaudiHandleArray
T is the concrete handle type, e.g.
Definition: GaudiHandle.h:397
Gaudi::Interface::Bind::IBinder
Definition: IBinder.h:47
BaseToolHandle::getAsIAlgTool
virtual IAlgTool * getAsIAlgTool()=0
BaseToolHandle::getAsIAlgTool
virtual const IAlgTool * getAsIAlgTool() const =0
ToolHandleInfo::parent
const IInterface * parent() const noexcept
Definition: ToolHandle.h:53
ToolHandleInfo::createIf
bool createIf() const noexcept
Definition: ToolHandle.h:51
ToolHandleArray::push_back
bool push_back(const std::string &toolTypeAndName) override
Add a handle to the array with given tool type and name.
Definition: ToolHandle.h:427
ToolHandle::release
StatusCode release(T *algTool) const override
Do the real release of the AlgTool.
Definition: ToolHandle.h:269
ToolHandle::get
std::add_const_t< T > * get() const
Definition: ToolHandle.h:273
GaudiHandleBase::setTypeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Definition: GaudiHandle.cpp:19