| The Gaudi Framework v32r1 (f65d50dc)

ToolHandle.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_TOOLHANDLE_H
2 #define GAUDIKERNEL_TOOLHANDLE_H
3
4 // Includes
5 #include "GaudiKernel/GaudiHandle.h"
6 #include "GaudiKernel/IAlgTool.h"
7 #include "GaudiKernel/INamedInterface.h"
8 #include "GaudiKernel/IToolSvc.h"
9 #include "GaudiKernel/ServiceHandle.h"
10 #include "GaudiKernel/TaggedBool.h"
11
12 #include <stdexcept>
13 #include <string>
14 #include <type_traits>
15 #include <vector>
16
17 // forward declarations
18 class IInterface;
19 class IToolSvc;
20
21 namespace Gaudi {
22 class Algorithm;
23 }
24 class AlgTool;
25 class Service;
26
27 using DisableTool = Gaudi::tagged_bool<class DisableTool_tag>;
28 using EnableTool = Gaudi::tagged_bool<class EnableTool_tag>;
29
31 class ToolHandleInfo {
32
33 protected:
34 ToolHandleInfo( const IInterface* parent = nullptr, bool createIf = true )
35 : m_parent( parent ), m_createIf( createIf ) {}
36
37 public:
38 virtual ~ToolHandleInfo() = default;
39
40 bool isPublic() const noexcept { return !m_parent; }
41
42 bool createIf() const noexcept { return m_createIf; }
43
44 const IInterface* parent() const noexcept { return m_parent; }
45
46 //
47 // Some helper functions
48 //
49
50 static std::string toolComponentType( const IInterface* parent ) { return parent ? "PrivateTool" : "PublicTool"; }
51
52 static std::string toolParentName( const IInterface* parent ) {
53 auto* pNamed = ( parent ? dynamic_cast<const INamedInterface*>( parent ) : nullptr );
54 return ( !parent ? "ToolSvc" : ( pNamed ? pNamed->name() : "" ) );
55 }
56
57 protected:
58 const IInterface* m_parent = nullptr;
59 bool m_createIf{true};
60 };
61
69 class BaseToolHandle : public ToolHandleInfo {
70
71 protected:
72 BaseToolHandle( const IInterface* parent = nullptr, bool createIf = true ) : ToolHandleInfo( parent, createIf ) {}
73
74 virtual StatusCode i_retrieve( IAlgTool*& ) const = 0;
75
76 public:
77 StatusCode retrieve( IAlgTool*& tool ) const { return i_retrieve( tool ); }
78
79 virtual StatusCode retrieve() const = 0;
80 virtual StatusCode retrieve( DisableTool sd ) = 0;
81 virtual StatusCode retrieve( EnableTool sd ) = 0;
82
83 const IAlgTool* get() const { return getAsIAlgTool(); }
84
85 IAlgTool* get() { return getAsIAlgTool(); }
86
87 virtual std::string typeAndName() const = 0;
88
90 inline bool isEnabled() const {
91 // the handle is considered enabled if the type/name is valid and the
92 // enabled flag was set to true, or it was already retrieved
93 return ( m_enabled && !typeAndName().empty() ) || get();
94 }
95
96 inline void enable() { m_enabled = true; }
97
98 inline void disable() { m_enabled = false; }
99
100 inline bool setEnabled( const bool flag ) {
101 auto old = m_enabled;
102 m_enabled = flag;
103 return old;
104 }
105
106 protected:
107 virtual const IAlgTool* getAsIAlgTool() const = 0;
108
109 virtual IAlgTool* getAsIAlgTool() = 0;
110
111 bool m_enabled = true;
112 };
113
124 template <class T>
125 class ToolHandle : public BaseToolHandle, public GaudiHandle<T> {
126
127 friend class Gaudi::Algorithm;
128 friend class AlgTool;
129 friend class Service;
130
131 public:
135 ToolHandle( const IInterface* parent = nullptr, bool createIf = true )
136 : BaseToolHandle( parent, createIf )
137 , GaudiHandle<T>( "", toolComponentType( parent ), toolParentName( parent ) )
138 , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
139
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>>>
143 ToolHandle( const ToolHandle<NCT>& other )
144 : BaseToolHandle( other.parent(), other.createIf() )
145 , GaudiHandle<CT>( other )
146 , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
147
148 public:
149 //
150 // Constructors etc.
151 //
152
172 #if defined( TOOLHANDLE_DEPR_WARN )
173 // warn about using deprecated explicit ToolHandle construction
174 # pragma message( "Untracked ToolHandle: Migrate explicit DataHandle constructor to declareTool Algorithm Property" )
175
176 __attribute__( ( deprecated ) )
177
178 #endif
179 ToolHandle( const std::string& toolTypeAndName, const IInterface* parent = nullptr, bool createIf = true )
180 : BaseToolHandle( parent, createIf )
181 , GaudiHandle<T>( toolTypeAndName, toolComponentType( parent ), toolParentName( parent ) )
182 , m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {
183 }
184
187 template <class OWNER, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
188 inline ToolHandle( OWNER* owner, std::string propName, std::string toolType, std::string doc = "" )
189 : ToolHandle( owner ) {
190 // convert name and type to a valid type/name string
191 // - if type does not contain '/' use type/type
192 // - otherwise type is already a type/name string
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>();
197 }
198
199 public:
200 StatusCode initialize( const std::string& toolTypeAndName, const IInterface* parent = nullptr,
201 bool createIf = true ) {
202
203 GaudiHandleBase::setTypeAndName( toolTypeAndName );
204 GaudiHandleBase::setComponentType( toolComponentType( parent ) );
205 GaudiHandleBase::setParentName( toolParentName( parent ) );
206
207 m_parent = parent;
208 m_createIf = createIf;
209
210 return m_pToolSvc.initialize( "ToolSvc", GaudiHandleBase::parentName() );
211 }
212
215 StatusCode retrieve() const override { // not really const, because it updates m_pObject
216 return GaudiHandle<T>::retrieve();
217 }
218
219 StatusCode retrieve( DisableTool sd ) override {
220 if ( isEnabled() && sd == DisableTool{false} ) {
221 return GaudiHandle<T>::retrieve();
222 } else {
223 disable();
224 return StatusCode::SUCCESS;
225 }
226 }
227
228 StatusCode retrieve( EnableTool sd ) override {
229 if ( isEnabled() && sd == EnableTool{true} ) {
230 return GaudiHandle<T>::retrieve();
231 } else {
232 disable();
233 return StatusCode::SUCCESS;
234 }
235 }
236
239 StatusCode release() const { // not really const, because it updates m_pObject
240 return GaudiHandle<T>::release();
241 }
242
244 StatusCode retrieve( T*& algTool ) const override {
245 IAlgTool* iface = nullptr;
246 if ( i_retrieve( iface ).isFailure() ) { return StatusCode::FAILURE; }
247
248 algTool = dynamic_cast<T*>( iface );
249 if ( algTool == nullptr ) {
250 throw GaudiException( "unable to dcast AlgTool " + typeAndName() + " to interface " +
251 System::typeinfoName( typeid( T ) ),
252 typeAndName() + " retrieve", StatusCode::FAILURE );
253 }
254 return StatusCode::SUCCESS;
255 }
256
258 StatusCode release( T* algTool ) const override { return m_pToolSvc->releaseTool( ::details::nonConst( algTool ) ); }
259
260 std::string typeAndName() const override { return GaudiHandleBase::typeAndName(); }
261
262 std::add_const_t<T>* get() const { return GaudiHandle<T>::get(); }
263
264 T* get() { return GaudiHandle<T>::get(); }
265
266 // Allow access to non-const Tool methods of const ToolHandle
267 #ifdef ALLOW_TOOLHANDLE_NONCONSTNESS
268 T* operator->() { return GaudiHandle<T>::operator->(); }
269 T& operator*() { return *( GaudiHandle<T>::operator->() ); }
270
271 T* operator->() const { return ::details::nonConst( GaudiHandle<T>::operator->() ); }
272 T& operator*() const { return *( ::details::nonConst( GaudiHandle<T>::operator->() ) ); }
273 #endif
274
275 #ifdef ATLAS
276 [[deprecated( "FIXME!! should not call non-const method from a const ToolHandle" )]] ToolHandle<T>& unConst() const {
277 return const_cast<ToolHandle<T>&>( *this );
278 }
279 #endif
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
289 return ::details::nonConst( GaudiHandle<T>::get() );
290 }
291
292 StatusCode i_retrieve( IAlgTool*& algTool ) const override {
293 return m_pToolSvc->retrieve( typeAndName(), IAlgTool::interfaceID(), algTool, ToolHandleInfo::parent(),
294 ToolHandleInfo::createIf() );
295 }
296
297 private:
298 //
299 // Private data members
300 //
301 mutable ServiceHandle<IToolSvc> m_pToolSvc;
302 };
303
307 template <class T>
308 class PublicToolHandle : public ToolHandle<T> {
309 public:
310 PublicToolHandle( bool createIf = true ) : ToolHandle<T>( nullptr, createIf ) {}
311 PublicToolHandle( const char* toolTypeAndName, bool createIf = true )
312 : PublicToolHandle{std::string{toolTypeAndName}, createIf} {}
313 PublicToolHandle( const std::string& toolTypeAndName, bool createIf = true )
314 : ToolHandle<T>( toolTypeAndName, nullptr, createIf ) {}
315
317 template <typename CT = T, typename NCT = std::remove_const_t<T>>
318 PublicToolHandle( const PublicToolHandle<NCT>& other,
319 std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* = nullptr )
320 : ToolHandle<T>( static_cast<const ToolHandle<NCT>&>( other ) ) {}
321
324 template <class OWNER, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
325 inline PublicToolHandle( OWNER* owner, std::string propName, std::string toolType, std::string doc = "" )
326 : PublicToolHandle() {
327 // convert name and type to a valid type/name string
328 // - if type does not contain '/' use type/type
329 // - otherwise type is already a type/name string
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>();
334 }
335 };
336
337 //-------------------------------------------------------------------------//
338
349 template <class T>
350 class ToolHandleArray : public ToolHandleInfo, public GaudiHandleArray<ToolHandle<T>> {
351 public:
352 //
353 // Constructors
354 //
361 ToolHandleArray( const std::vector<std::string>& myTypesAndNames, const IInterface* parent = nullptr,
362 bool createIf = true )
363 : ToolHandleInfo( parent, createIf )
364 , GaudiHandleArray<ToolHandle<T>>( myTypesAndNames, ToolHandleInfo::toolComponentType( parent ),
365 ToolHandleInfo::toolParentName( parent ) ) {}
366
371 ToolHandleArray( const IInterface* parent = nullptr, bool createIf = true )
372 : ToolHandleInfo( parent, createIf )
373 , GaudiHandleArray<ToolHandle<T>>( ToolHandleInfo::toolComponentType( parent ),
374 ToolHandleInfo::toolParentName( parent ) ) {}
375
380 bool push_back( const std::string& toolTypeAndName ) override {
381 ToolHandle<T> handle( toolTypeAndName, ToolHandleInfo::parent(), ToolHandleInfo::createIf() );
382 GaudiHandleArray<ToolHandle<T>>::push_back( handle );
383 return true;
384 }
385
387 bool push_back( const ToolHandle<T>& myHandle ) override { return push_back( myHandle.typeAndName() ); }
388
391 template <class OWNER, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
392 inline ToolHandleArray( OWNER* owner, std::string name, const std::vector<std::string>& typesAndNames = {},
393 std::string doc = "" )
394 : ToolHandleArray( typesAndNames, owner ) {
395 owner->addToolsArray( *this );
396 auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( name ), *this, std::move( doc ) );
397 p->template setOwnerType<OWNER>();
398 }
399 };
400
404 template <class T>
405 class PublicToolHandleArray : public ToolHandleArray<T> {
406 public:
407 PublicToolHandleArray( bool createIf = true ) : ToolHandleArray<T>( nullptr, createIf ) {}
408 PublicToolHandleArray( const std::vector<std::string>& typesAndNames, bool createIf = true )
409 : ToolHandleArray<T>( typesAndNames, nullptr, createIf ) {}
410
413 template <class OWNER, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
414 inline PublicToolHandleArray( OWNER* owner, std::string name, const std::vector<std::string>& typesAndNames = {},
415 std::string doc = "" )
416 : PublicToolHandleArray( typesAndNames ) {
417 owner->addToolsArray( *this );
418 auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( name ), *this, std::move( doc ) );
419 p->template setOwnerType<OWNER>();
420 }
421 };
422
423 template <class T>
424 inline std::ostream& operator<<( std::ostream& os, const ToolHandle<T>& handle ) {
425 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
426 }
427
428 template <class T>
429 inline std::ostream& operator<<( std::ostream& os, const ToolHandleArray<T>& handle ) {
430 return operator<<( os, static_cast<const GaudiHandleInfo&>( handle ) );
431 }
432
433 #endif // ! GAUDIKERNEL_TOOLHANDLE_H
ToolHandleInfo::createIf
bool createIf() const noexcept
Definition: ToolHandle.h:42
ToolHandle::typeAndName
std::string typeAndName() const override
Definition: ToolHandle.h:260
ServiceHandle< IToolSvc >
ToolHandle::ToolHandle
ToolHandle(const IInterface *parent=nullptr, bool createIf=true)
Constructor for a tool with default tool type and name.
Definition: ToolHandle.h:135
PublicToolHandleArray
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition: ToolHandle.h:405
IToolSvc
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:19
ToolHandle::getAsIAlgTool
const IAlgTool * getAsIAlgTool() const override
Definition: ToolHandle.h:282
GaudiHandle
Handle to be used in lieu of naked pointers to gaudis.
Definition: GaudiHandle.h:163
IToolSvc::retrieve
virtual StatusCode retrieve(const std::string &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.
GaudiHandle::release
StatusCode release() const
Release the component.
Definition: GaudiHandle.h:224
std::string::empty
T empty(T... args)
operator<<
std::ostream & operator<<(std::ostream &os, const ToolHandle< T > &handle)
Definition: ToolHandle.h:424
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
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:392
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
ToolHandle::m_pToolSvc
ServiceHandle< IToolSvc > m_pToolSvc
Definition: ToolHandle.h:301
PublicToolHandle::PublicToolHandle
PublicToolHandle(const PublicToolHandle< NCT > &other, std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >> *=nullptr)
Copy constructor from a non const T to const T tool handle.
Definition: ToolHandle.h:318
GaudiHandleBase::setTypeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Definition: GaudiHandle.cpp:9
GaudiHandle::operator *
T & operator *()
Definition: GaudiHandle.h:256
BaseToolHandle::i_retrieve
virtual StatusCode i_retrieve(IAlgTool *&) const =0
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
BaseToolHandle::setEnabled
bool setEnabled(const bool flag)
Definition: ToolHandle.h:100
GaudiHandleBase::typeAndName
std::string typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:115
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:68
ToolHandle::retrieve
StatusCode retrieve(T *&algTool) const override
Do the real retrieval of the AlgTool.
Definition: ToolHandle.h:244
BaseToolHandle::disable
void disable()
Definition: ToolHandle.h:98
GaudiHandleInfo::setComponentType
void setComponentType(const std::string &componentType)
The component type.
Definition: GaudiHandle.h:68
ToolHandleInfo::toolParentName
static std::string toolParentName(const IInterface *parent)
Definition: ToolHandle.h:52
BaseToolHandle::typeAndName
virtual std::string typeAndName() const =0
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
BaseToolHandle
Non-templated base class for actual ToolHandle<T>.
Definition: ToolHandle.h:69
GaudiHandle::retrieve
StatusCode retrieve() const
Retrieve the component.
Definition: GaudiHandle.h:212
ToolHandleArray
Array of Handles to be used in lieu of vector of naked pointers to tools.
Definition: ToolHandle.h:350
PublicToolHandleArray::PublicToolHandleArray
PublicToolHandleArray(const std::vector< std::string > &typesAndNames, bool createIf=true)
Definition: ToolHandle.h:408
ToolHandle::get
T * get()
Definition: ToolHandle.h:264
BaseToolHandle::BaseToolHandle
BaseToolHandle(const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:72
GaudiHandleInfo::setParentName
void setParentName(const std::string &parent)
The name of the parent.
Definition: GaudiHandle.h:71
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:380
ToolHandleInfo::toolComponentType
static std::string toolComponentType(const IInterface *parent)
Definition: ToolHandle.h:50
ToolHandle::i_retrieve
StatusCode i_retrieve(IAlgTool *&algTool) const override
Definition: ToolHandle.h:292
PublicToolHandle::PublicToolHandle
PublicToolHandle(const std::string &toolTypeAndName, bool createIf=true)
Definition: ToolHandle.h:313
IToolSvc.h
ServiceHandle::initialize
StatusCode initialize(const std::string &serviceName, const std::string &theParentName)
Definition: ServiceHandle.h:60
PublicToolHandle::PublicToolHandle
PublicToolHandle(const char *toolTypeAndName, bool createIf=true)
Definition: ToolHandle.h:311
std::string
STL class.
INamedInterface.h
ToolHandleArray::ToolHandleArray
ToolHandleArray(const IInterface *parent=nullptr, bool createIf=true)
Constructor which creates and empty list.
Definition: ToolHandle.h:371
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:325
ToolHandle::release
StatusCode release(T *algTool) const override
Do the real release of the AlgTool.
Definition: ToolHandle.h:258
ToolHandle::get
std::add_const_t< T > * get() const
Definition: ToolHandle.h:262
ToolHandle::ToolHandle
ToolHandle(const ToolHandle< NCT > &other)
Copy constructor from a non const T to const T tool handle.
Definition: ToolHandle.h:143
BaseToolHandle::retrieve
StatusCode retrieve(IAlgTool *&tool) const
Definition: ToolHandle.h:77
BaseToolHandle::isEnabled
bool isEnabled() const
Helper to check if the ToolHandle should be retrieved.
Definition: ToolHandle.h:90
details::nonConst
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
Definition: GaudiHandle.h:20
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
ToolHandleInfo::isPublic
bool isPublic() const noexcept
Definition: ToolHandle.h:40
GaudiHandleInfo::parentName
const std::string & parentName() const
The name of the parent.
Definition: GaudiHandle.h:53
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
ToolHandle::retrieve
StatusCode retrieve(DisableTool sd) override
Definition: ToolHandle.h:219
GaudiHandle::get
T * get()
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:248
EnableTool
Gaudi::tagged_bool< class EnableTool_tag > EnableTool
Definition: ToolHandle.h:28
BaseToolHandle::retrieve
virtual StatusCode retrieve() const =0
IAlgTool.h
TaggedBool.h
BaseToolHandle::enable
void enable()
Definition: ToolHandle.h:96
ServiceHandle.h
std::move
T move(T... args)
DisableTool
Gaudi::tagged_bool< class DisableTool_tag > DisableTool
Definition: ToolHandle.h:27
PublicToolHandle::PublicToolHandle
PublicToolHandle(bool createIf=true)
Definition: ToolHandle.h:310
ToolHandle::getAsIAlgTool
IAlgTool * getAsIAlgTool() override
Definition: ToolHandle.h:287
GaudiHandle::operator->
T * operator->()
Definition: GaudiHandle.h:261
ToolHandle
Handle to be used in lieu of naked pointers to tools.
Definition: ToolHandle.h:125
ToolHandle::initialize
StatusCode initialize(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:200
Algorithm
Alias for backward compatibility.
Definition: Algorithm.h:56
std::string::find
T find(T... args)
ToolHandleInfo::m_parent
const IInterface * m_parent
Definition: ToolHandle.h:58
std::vector< std::string >
ToolHandle::release
StatusCode release() const
Release the AlgTool.
Definition: ToolHandle.h:239
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:47
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
PublicToolHandle
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition: ToolHandle.h:308
ToolHandleInfo::~ToolHandleInfo
virtual ~ToolHandleInfo()=default
IToolSvc::releaseTool
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
ToolHandleArray::ToolHandleArray
ToolHandleArray(const std::vector< std::string > &myTypesAndNames, const IInterface *parent=nullptr, bool createIf=true)
Generic constructor.
Definition: ToolHandle.h:361
BaseToolHandle::get
IAlgTool * get()
Definition: ToolHandle.h:85
ToolHandleInfo::m_createIf
bool m_createIf
Definition: ToolHandle.h:59
GaudiHandleBase
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:89
ToolHandle::retrieve
StatusCode retrieve() const override
Retrieve the AlgTool.
Definition: ToolHandle.h:215
BaseToolHandle::getAsIAlgTool
virtual const IAlgTool * getAsIAlgTool() const =0
Service
Base class for all services.
Definition: Service.h:36
ToolHandleInfo::parent
const IInterface * parent() const noexcept
Definition: ToolHandle.h:44
PublicToolHandleArray::PublicToolHandleArray
PublicToolHandleArray(bool createIf=true)
Definition: ToolHandle.h:407
std::ostream
STL class.
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:253
GaudiHandle.h
BaseToolHandle::get
const IAlgTool * get() const
Definition: ToolHandle.h:83
BaseToolHandle::m_enabled
bool m_enabled
Definition: ToolHandle.h:111
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
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:179
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:414
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:188
ToolHandleInfo
General info and helper functions for toolhandles and arrays.
Definition: ToolHandle.h:31
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:387
ToolHandleInfo::ToolHandleInfo
ToolHandleInfo(const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:34
GaudiHandleArray
T is the concrete handle type, e.g.
Definition: GaudiHandle.h:393
ToolHandle::retrieve
StatusCode retrieve(EnableTool sd) override
Definition: ToolHandle.h:228