The Gaudi Framework  v37r1 (a7f61348)
GaudiHandle.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 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 #ifndef GAUDIKERNEL_GAUDIHANDLE_H
12 #define GAUDIKERNEL_GAUDIHANDLE_H
13 
14 // Includes
16 #include "GaudiKernel/IInterface.h"
17 #include "GaudiKernel/System.h"
18 #include <Gaudi/Property.h>
19 
20 #include <algorithm>
21 #include <iostream>
22 #include <stdexcept>
23 #include <string>
24 #include <type_traits>
25 #include <vector>
26 
27 namespace details {
29  template <class T>
30  std::remove_const_t<T>* nonConst( T* p ) {
31  return const_cast<std::remove_const_t<T>*>( p );
32  }
33 } // namespace details
34 
36 protected:
45  GaudiHandleInfo( std::string myComponentType, std::string myParentName )
46  : m_componentType( std::move( myComponentType ) ), m_parentName( std::move( myParentName ) ) {}
47 
48 public:
50  // Don't use =default here. Otherwise, in c++20 mode, clang will
51  // instantiate the handle virtual functions early, breaking the case
52  // where handles are used with a forward-declared class.
53  virtual ~GaudiHandleInfo() {}
54  //
55  // Public member functions
56  //
57  const std::string& componentType() const { return m_componentType; }
58 
60  const std::string& propertyName() const { return m_propertyName; }
61 
63  void setPropertyName( std::string propName ) { m_propertyName = std::move( propName ); }
64 
66  const std::string& parentName() const { return m_parentName; }
67 
71  virtual std::string pythonPropertyClassName() const = 0;
72 
77  virtual std::string pythonRepr() const = 0;
78 
79 protected:
81  void setComponentType( std::string componentType ) { m_componentType = std::move( componentType ); }
82 
84  void setParentName( std::string parent ) { m_parentName = std::move( parent ); }
85 
86 private:
87  //
88  // Data members
89  //
90  std::string m_componentType; // e.g.: "PublicTool","PrivateTool","Service"
91  std::string m_propertyName; // name as used in declareProperty(name,gaudiHandle)
92  std::string m_parentName; // name of the parent having this handle as a member
93 };
94 
103  //
104  // Ctors etc
105  //
106 protected:
118  GaudiHandleBase( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
119  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {
120  setTypeAndName( std::move( myTypeAndName ) );
121  }
122 
123 public:
124  //
125  // Public member functions
126  //
128  std::string typeAndName() const { return m_typeAndName; }
129 
131  std::string type() const;
132 
134  std::string name() const;
135 
137  bool empty() const { return m_typeAndName.empty(); }
138 
140  void setTypeAndName( std::string myTypeAndName );
141 
143  void setName( std::string_view myName );
144 
148  std::string pythonPropertyClassName() const override;
149 
151  std::string messageName() const;
152 
156  std::string pythonRepr() const override;
157 
159 
160 private:
161  //
162  // Data member
163  //
164  std::string m_typeAndName; // the full type and name: "type/name"
165 };
166 
175 template <class T>
177  //
178  // Constructors etc.
179  //
180 protected:
181  GaudiHandle( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
182  : GaudiHandleBase( std::move( myTypeAndName ), std::move( myComponentType ), std::move( myParentName ) ) {}
183 
184 public:
186  template <typename CT = T, typename NCT = std::remove_const_t<T>>
188  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* = nullptr )
189  : GaudiHandleBase( other ) {
190  m_pObject = other.get();
191  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
192  }
193 
195  GaudiHandle( const GaudiHandle& other ) : GaudiHandleBase( other ) {
196  m_pObject = other.m_pObject.load();
197  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
198  }
199 
201  template <typename CT = T, typename NCT = std::remove_const_t<T>>
202  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>, GaudiHandle&>
203  operator=( const GaudiHandle<NCT>& other ) {
204  GaudiHandleBase::operator=( other );
205  // release any current tool
206  release().ignore();
207  m_pObject = other.get();
208  // update ref-counting
209  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
210  return *this;
211  }
212 
214  GaudiHandle& operator=( const GaudiHandle& other ) {
215  GaudiHandleBase::operator=( other );
216  // release any current tool
217  release().ignore();
218  m_pObject = other.m_pObject.load();
219  // update ref-counting
220  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
221  return *this;
222  }
223 
226  // not really const, because it updates m_pObject
227  // Do the lookup into a temporary pointer.
228  T* p = nullptr;
229  if ( retrieve( p ).isFailure() ) { return StatusCode::FAILURE; }
230 
231  // If m_pObject is null, then copy p to m_pObject.
232  // Otherwise, release p.
233  T* old = nullptr;
234  if ( m_pObject.compare_exchange_strong( old, p ) ) { return StatusCode::SUCCESS; }
235  return release( p );
236  }
237 
239  StatusCode release() const {
240  // not really const, because it updates m_pObject
242  if ( m_pObject ) {
243  sc = release( m_pObject );
244  m_pObject = nullptr;
245  }
246  return sc;
247  }
248 
250  bool isValid() const {
251  // not really const, because it may update m_pObject
252  return m_pObject || retrieve().isSuccess();
253  }
254 
257  operator bool() const {
258  // not really const, because it may update m_pObject
259  return isValid();
260  }
261 
263  T* get() { return m_pObject; }
264 
266  std::add_const_t<T>* get() const { return m_pObject; }
267 
269  bool isSet() const { return get(); }
270 
271  T& operator*() {
272  assertObject();
273  return *m_pObject;
274  }
275 
276  T* operator->() {
277  assertObject();
278  return m_pObject;
279  }
280 
281  std::add_const_t<T>& operator*() const {
282  // not really const, because it may update m_pObject
283  assertObject();
284  return *m_pObject;
285  }
286 
287  std::add_const_t<T>* operator->() const {
288  // not really const, because it may update m_pObject
289  assertObject();
290  return m_pObject;
291  }
292 
294  std::string getDefaultType() { return System::typeinfoName( typeid( T ) ); }
295 
297  const auto defName = GaudiHandleBase::type();
298  return ( defName.empty() ? getDefaultType() : defName );
299  }
300 
301 protected:
303  virtual StatusCode retrieve( T*& ) const = 0; // not really const, because it updates m_pObject
304 
307  virtual StatusCode release( T* comp ) const { // not really const, because it updates m_pObject
308  // const cast to support T being a const type
309  ::details::nonConst( comp )->release();
310  return StatusCode::SUCCESS;
311  }
312 
313 private:
316  const std::string& myType = getDefaultType();
317  GaudiHandleBase::setTypeAndName( myType + '/' + myType );
318  }
319 
321  void setDefaultType() { GaudiHandleBase::setTypeAndName( getDefaultType() ); }
322 
325  void assertObject() const { // not really const, because it may update m_pObject
326  if ( !isValid() ) {
327  throw GaudiException( "Failed to retrieve " + componentType() + ": " + typeAndName(),
328  componentType() + " retrieve", StatusCode::FAILURE );
329  }
330  }
331 
332 private:
333  //
334  // Data members
335  //
336  mutable std::atomic<T*> m_pObject = nullptr;
337 };
338 
346 protected:
347  GaudiHandleArrayBase( std::string myComponentType, std::string myParentName )
348  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {}
349 
350 public:
354 
357  bool setTypesAndNames( const std::vector<std::string>& myTypesAndNamesList );
358 
361  const std::vector<std::string> typesAndNames() const;
362 
364  const std::vector<std::string> types() const;
365 
367  const std::vector<std::string> names() const;
368 
371  const std::vector<std::string> getBaseInfos( std::string ( GaudiHandleBase::*pMemFunc )() const ) const;
372 
376  std::string pythonPropertyClassName() const override;
377 
381  std::string pythonRepr() const override;
382 
386  virtual bool push_back( const std::string& myHandleTypeAndName ) = 0;
387 
389  virtual void clear() = 0;
390 
392  virtual bool empty() const = 0;
393 
396  virtual ConstBaseHandleArray getBaseArray() const = 0;
397 
401 
403  virtual bool retrieved() const = 0;
404 };
405 
407 template <class T>
409 public:
410  //
411  // public nested types
412  //
414  typedef typename HandleVector::value_type value_type;
415  typedef typename HandleVector::size_type size_type;
416  typedef typename HandleVector::reference reference;
417  typedef typename HandleVector::const_reference const_reference;
418  typedef typename HandleVector::iterator iterator;
419  typedef typename HandleVector::const_iterator const_iterator;
420  typedef typename HandleVector::reverse_iterator reverse_iterator;
421  typedef typename HandleVector::const_reverse_iterator const_reverse_iterator;
422 
423 protected:
424  //
425  // Constructors
426  //
431  GaudiHandleArray( const std::vector<std::string>& myTypesAndNamesList, std::string myComponentType,
432  std::string myParentName )
433  : GaudiHandleArrayBase( std::move( myComponentType ), std::move( myParentName ) ) {
434  setTypesAndNames( myTypesAndNamesList );
435  }
436 
441  GaudiHandleArray( const std::string& myComponentType, const std::string& myParentName )
442  : GaudiHandleArrayBase( myComponentType, myParentName ) {}
443 
444 public:
446  GaudiHandleArray& operator=( const std::vector<std::string>& myTypesAndNamesList ) {
447  setTypesAndNames( myTypesAndNamesList );
448  return *this;
449  }
450 
453  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
454  return baseArray;
455  }
456 
459  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
460  return baseArray;
461  }
462 
463  //
464  // Simulate (part of) an std::vector
465  //
466  iterator begin() { return m_handleArray.begin(); }
467 
468  iterator end() { return m_handleArray.end(); }
469 
470  const_iterator begin() const { return m_handleArray.begin(); }
471 
472  const_iterator end() const { return m_handleArray.end(); }
473 
474  const_iterator rbegin() const { return m_handleArray.rbegin(); }
475 
476  const_iterator rend() const { return m_handleArray.rend(); }
477 
478  size_type size() const { return m_handleArray.size(); }
479 
480  void clear() override { m_handleArray.clear(); }
481 
482  bool empty() const override { return m_handleArray.empty(); }
483 
484  T& operator[]( int index ) { return m_handleArray[index]; }
485 
486  const T& operator[]( int index ) const { return m_handleArray[index]; }
487 
489  T* operator[]( std::string_view name ) {
490  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
491  return it != end() ? &*it : nullptr;
492  }
493 
495  const T* operator[]( std::string_view name ) const {
496  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
497  return it != end() ? &*it : nullptr;
498  }
499 
502  using GaudiHandleArrayBase::push_back; // avoid compiler warning
503  virtual bool push_back( const T& myHandle ) {
504  m_handleArray.push_back( myHandle );
505  return true;
506  }
507 
511  for ( auto& i : *this ) {
512  // stop at first failure
513  if ( i.retrieve().isFailure() ) {
514  sc = StatusCode::FAILURE;
515  break;
516  }
517  }
518  if ( sc ) { m_retrieved = true; }
519  return sc;
520  }
521 
525  for ( auto& i : *this ) {
526  // continue trying to release other tools even if we fail...
527  if ( i.release().isFailure() ) sc = StatusCode::FAILURE;
528  }
529  return sc;
530  }
531 
533  virtual bool retrieved() const override { return m_retrieved; }
534 
535 private:
536  //
537  // Private data members
538  //
540  bool m_retrieved{ false };
541 };
542 
543 // Easy printing out of Handles and HandleArrays
544 // It prints <propertyName> = <HandleType>( <HandleType(s)AndName(s)> )
545 std::ostream& operator<<( std::ostream& os, const GaudiHandleInfo& handle );
546 
547 #endif // ! GAUDIKERNEL_GAUDIHANDLE_H
GaudiHandle::isSet
bool isSet() const
True if the wrapped pointer is not null.
Definition: GaudiHandle.h:269
GaudiHandleArray::operator[]
T * operator[](std::string_view name)
Get pointer (!) to ToolHandle by instance name.
Definition: GaudiHandle.h:489
GaudiHandleInfo::parentName
const std::string & parentName() const
The name of the parent.
Definition: GaudiHandle.h:66
std::string
STL class.
GaudiHandleArray::begin
const_iterator begin() const
Definition: GaudiHandle.h:470
GaudiHandleArray::size
size_type size() const
Definition: GaudiHandle.h:478
GaudiHandleArray::operator[]
const T & operator[](int index) const
Definition: GaudiHandle.h:486
GaudiHandle::operator->
T * operator->()
Definition: GaudiHandle.h:276
std::move
T move(T... args)
bug_34121.name
name
Definition: bug_34121.py:20
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:82
GaudiHandle::setDefaultTypeAndName
void setDefaultTypeAndName()
Helper function to set default name and type.
Definition: GaudiHandle.h:315
System.h
GaudiHandleArray::retrieve
StatusCode retrieve()
Retrieve all tools.
Definition: GaudiHandle.h:509
GaudiException.h
GaudiHandleArray::push_back
virtual bool push_back(const T &myHandle)
Definition: GaudiHandle.h:503
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:81
std::vector
STL class.
std::find_if
T find_if(T... args)
GaudiHandle::getDefaultType
std::string getDefaultType()
Helper function to get default type string from the class type.
Definition: GaudiHandle.h:294
GaudiException
Definition: GaudiException.h:31
GaudiHandle::operator*
std::add_const_t< T > & operator*() const
Definition: GaudiHandle.h:281
GaudiHandleArray::empty
bool empty() const override
Return whether the list of tools is empty.
Definition: GaudiHandle.h:482
conf.release
string release
Definition: conf.py:27
GaudiHandleBase::empty
bool empty() const
Check if the handle has been set to empty string (i.e.
Definition: GaudiHandle.h:137
ProduceConsume.types
types
Definition: ProduceConsume.py:56
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:313
GaudiHandleInfo::componentType
const std::string & componentType() const
Definition: GaudiHandle.h:57
GaudiHandleArrayBase::ConstBaseHandleArray
std::vector< const GaudiHandleBase * > ConstBaseHandleArray
Definition: GaudiHandle.h:353
GaudiHandle::operator=
GaudiHandle & operator=(const GaudiHandle &other)
Assignment operator for correct ref-counting.
Definition: GaudiHandle.h:214
GaudiHandle::GaudiHandle
GaudiHandle(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:181
GaudiHandleInfo::setParentName
void setParentName(std::string parent)
The name of the parent.
Definition: GaudiHandle.h:84
GaudiHandleArray::operator[]
T & operator[](int index)
Definition: GaudiHandle.h:484
GaudiHandleArray::release
StatusCode release()
Release all tools.
Definition: GaudiHandle.h:523
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:468
GaudiHandleBase
Definition: GaudiHandle.h:102
GaudiHandle
Definition: GaudiHandle.h:176
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
Generic constructor.
Definition: GaudiHandle.h:431
GaudiHandleInfo::m_parentName
std::string m_parentName
Definition: GaudiHandle.h:92
std::vector::push_back
T push_back(T... args)
GaudiHandleArray::getBaseArray
GaudiHandleArrayBase::BaseHandleArray getBaseArray() override
Get a read-write vector of GaudiHandleBase* pointing to the real handles.
Definition: GaudiHandle.h:451
GaudiHandleArray::reference
HandleVector::reference reference
Definition: GaudiHandle.h:416
GaudiHandleArray::rend
const_iterator rend() const
Definition: GaudiHandle.h:476
GaudiHandleArray::end
const_iterator end() const
Definition: GaudiHandle.h:472
GaudiHandle::get
T * get()
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:263
GaudiHandleArray::HandleVector
std::vector< T > HandleVector
Definition: GaudiHandle.h:413
GaudiHandle::release
virtual StatusCode release(T *comp) const
Release the component.
Definition: GaudiHandle.h:307
Gaudi::Functional::details::get
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition: details.h:440
GaudiHandleArray::const_iterator
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:419
details::nonConst
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
Definition: GaudiHandle.h:30
StatusCode
Definition: StatusCode.h:65
IInterface.h
details
Definition: AnyDataWrapper.h:18
std::atomic::load
T load(T... args)
GaudiHandle::GaudiHandle
GaudiHandle(const GaudiHandle &other)
Copy constructor needed for correct ref-counting.
Definition: GaudiHandle.h:195
std::ostream
STL class.
CLHEP::begin
double * begin(CLHEP::HepVector &v)
Definition: TupleAlg.cpp:45
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:164
GaudiHandleInfo::propertyName
const std::string & propertyName() const
name as used in declareProperty(name,gaudiHandle)
Definition: GaudiHandle.h:60
GaudiHandle::retrieve
virtual StatusCode retrieve(T *&) const =0
Retrieve the component.
AlgSequencer.h
h
Definition: AlgSequencer.py:32
GaudiHandleInfo::m_propertyName
std::string m_propertyName
Definition: GaudiHandle.h:91
GaudiHandleArray::size_type
HandleVector::size_type size_type
Definition: GaudiHandle.h:415
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::string &myComponentType, const std::string &myParentName)
Constructor creating an empty array.
Definition: GaudiHandle.h:441
GaudiHandleBase::typeAndName
std::string typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:128
GaudiHandle::m_pObject
std::atomic< T * > m_pObject
Definition: GaudiHandle.h:336
GaudiHandleArrayBase::clear
virtual void clear()=0
Clear the list of handles.
GaudiHandleArray::operator=
GaudiHandleArray & operator=(const std::vector< std::string > &myTypesAndNamesList)
Set the array of GaudiHandles from typeAndNames given in vector of strings.
Definition: GaudiHandle.h:446
GaudiHandleArrayBase::retrieved
virtual bool retrieved() const =0
To be able to tell if Array was ever retreived.
GaudiHandleArrayBase::getBaseArray
virtual ConstBaseHandleArray getBaseArray() const =0
Get a read-only vector of const GaudiHandleBase* pointing to the real handles.
std::atomic< T * >
GaudiHandleArray::clear
void clear() override
Clear the list of handles.
Definition: GaudiHandle.h:480
GaudiHandleArray::retrieved
virtual bool retrieved() const override
has Array been retreived?
Definition: GaudiHandle.h:533
GaudiHandle::operator=
std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >, GaudiHandle & > operator=(const GaudiHandle< NCT > &other)
Assignment operator for correct ref-counting.
Definition: GaudiHandle.h:203
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:345
GaudiHandleProperty
Definition: Property.h:580
GaudiHandleInfo::GaudiHandleInfo
GaudiHandleInfo(std::string myComponentType, std::string myParentName)
Some basic information and helper functions shared between various handles/arrays.
Definition: GaudiHandle.h:45
GaudiHandle::isValid
bool isValid() const
Check if the handle is valid (try to retrive the object is not done yet).
Definition: GaudiHandle.h:250
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
GaudiHandleInfo::~GaudiHandleInfo
virtual ~GaudiHandleInfo()
virtual destructor so that derived class destructor is called.
Definition: GaudiHandle.h:53
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:417
GaudiHandle::operator->
std::add_const_t< T > * operator->() const
Definition: GaudiHandle.h:287
GaudiHandleBase::type
std::string type() const
The concrete component class name: the part before the '/'.
Definition: GaudiHandle.cpp:21
gaudirun.type
type
Definition: gaudirun.py:162
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:539
GaudiHandle::operator*
T & operator*()
Definition: GaudiHandle.h:271
GaudiHandleArrayBase::BaseHandleArray
std::vector< GaudiHandleBase * > BaseHandleArray
Definition: GaudiHandle.h:352
std
STL namespace.
GaudiHandle::getDefaultName
std::string getDefaultName()
Definition: GaudiHandle.h:296
GaudiHandleArrayBase::push_back
virtual bool push_back(const std::string &myHandleTypeAndName)=0
Add a handle to the array with "type/name" given in <myHandleTypeAndName>.
GaudiHandleInfo::pythonPropertyClassName
virtual std::string pythonPropertyClassName() const =0
The python class name for the property in the genconf-generated configurables.
GaudiHandle::setDefaultType
void setDefaultType()
Helper function to set default type from the class type T.
Definition: GaudiHandle.h:321
GaudiHandleArray::reverse_iterator
HandleVector::reverse_iterator reverse_iterator
Definition: GaudiHandle.h:420
GaudiHandleInfo::setComponentType
void setComponentType(std::string componentType)
The component type.
Definition: GaudiHandle.h:81
GaudiHandleInfo
Definition: GaudiHandle.h:35
GaudiHandleBase::GaudiHandleBase
GaudiHandleBase(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Create a handle ('smart pointer') to a gaudi component.
Definition: GaudiHandle.h:118
GaudiHandle::GaudiHandle
GaudiHandle(const GaudiHandle< NCT > &other, std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >> *=nullptr)
Copy constructor needed for correct ref-counting.
Definition: GaudiHandle.h:187
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:347
GaudiHandleArray::iterator
HandleVector::iterator iterator
Definition: GaudiHandle.h:418
operator<<
std::ostream & operator<<(std::ostream &os, const GaudiHandleInfo &handle)
Definition: GaudiHandle.cpp:105
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:466
GaudiHandleArrayBase::getBaseArray
virtual BaseHandleArray getBaseArray()=0
Get a read-write vector of GaudiHandleBase* pointing to the real handles.
GaudiHandleArray::operator[]
const T * operator[](std::string_view name) const
Get const pointer (!) to ToolHandle by instance name.
Definition: GaudiHandle.h:495
GaudiHandleArray::const_reverse_iterator
HandleVector::const_reverse_iterator const_reverse_iterator
Definition: GaudiHandle.h:421
GaudiHandleArray::rbegin
const_iterator rbegin() const
Definition: GaudiHandle.h:474
IOTest.end
end
Definition: IOTest.py:123
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
GaudiHandleInfo::setPropertyName
void setPropertyName(std::string propName)
set name as used in declareProperty(name,gaudiHandle).
Definition: GaudiHandle.h:63
GaudiHandleInfo::m_componentType
std::string m_componentType
Definition: GaudiHandle.h:90
GaudiHandleInfo::pythonRepr
virtual std::string pythonRepr() const =0
Python representation of handle, i.e.
GaudiHandleArray::getBaseArray
GaudiHandleArrayBase::ConstBaseHandleArray getBaseArray() const override
Get a read-only vector of const GaudiHandleBase* pointing to the real handles.
Definition: GaudiHandle.h:457
GaudiHandleArray
T is the concrete handle type, e.g.
Definition: GaudiHandle.h:408
GaudiHandleArrayProperty
Definition: Property.h:617
GaudiHandle::assertObject
void assertObject() const
Load the pointer to the component.
Definition: GaudiHandle.h:325
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
GaudiHandle::retrieve
StatusCode retrieve() const
Retrieve the component.
Definition: GaudiHandle.h:225
GaudiHandle::get
std::add_const_t< T > * get() const
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:266
GaudiHandleArray::value_type
HandleVector::value_type value_type
Definition: GaudiHandle.h:414
GaudiHandle::release
StatusCode release() const
Release the component.
Definition: GaudiHandle.h:239
Property.h
GaudiHandleBase::setTypeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Definition: GaudiHandle.cpp:19
GaudiHandleArrayBase::empty
virtual bool empty() const =0
Return whether the list of tools is empty.