The Gaudi Framework  v39r1 (adb068b2)
GaudiHandle.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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
15 #include <Gaudi/Property.h>
17 #include <GaudiKernel/IInterface.h>
18 #include <GaudiKernel/System.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  // Easy printing out of Handles and HandleArrays
80  // It prints <propertyName> = <HandleType>( <HandleType(s)AndName(s)> )
81  friend std::ostream& operator<<( std::ostream& os, const GaudiHandleInfo& handle );
82 
83 protected:
85  void setComponentType( std::string componentType ) { m_componentType = std::move( componentType ); }
86 
88  void setParentName( std::string parent ) { m_parentName = std::move( parent ); }
89 
90 private:
91  //
92  // Data members
93  //
94  std::string m_componentType; // e.g.: "PublicTool","PrivateTool","Service"
95  std::string m_propertyName; // name as used in declareProperty(name,gaudiHandle)
96  std::string m_parentName; // name of the parent having this handle as a member
97 };
98 
107  //
108  // Ctors etc
109  //
110 protected:
122  GaudiHandleBase( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
123  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {
124  setTypeAndName( std::move( myTypeAndName ) );
125  }
126 
127 public:
128  //
129  // Public member functions
130  //
132  std::string typeAndName() const { return m_typeAndName; }
133 
135  std::string type() const;
136 
138  std::string name() const;
139 
141  bool empty() const { return m_typeAndName.empty(); }
142 
144  void setTypeAndName( std::string myTypeAndName );
145 
147  void setName( std::string_view myName );
148 
152  std::string pythonPropertyClassName() const override;
153 
155  std::string messageName() const;
156 
160  std::string pythonRepr() const override;
161 
163 
164 private:
165  //
166  // Data member
167  //
168  std::string m_typeAndName; // the full type and name: "type/name"
169 };
170 
179 template <class T>
181  //
182  // Constructors etc.
183  //
184 protected:
185  GaudiHandle( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
186  : GaudiHandleBase( std::move( myTypeAndName ), std::move( myComponentType ), std::move( myParentName ) ) {}
187 
188 public:
190  template <typename CT = T, typename NCT = std::remove_const_t<T>>
192  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* = nullptr )
193  : GaudiHandleBase( other ) {
194  m_pObject = other.get();
195  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
196  }
197 
199  GaudiHandle( const GaudiHandle& other ) : GaudiHandleBase( other ) {
200  m_pObject = other.m_pObject.load();
201  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
202  }
203 
205  template <typename CT = T, typename NCT = std::remove_const_t<T>>
206  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>, GaudiHandle&>
207  operator=( const GaudiHandle<NCT>& other ) {
208  GaudiHandleBase::operator=( other );
209  // release any current tool
210  release().ignore();
211  m_pObject = other.get();
212  // update ref-counting
213  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
214  return *this;
215  }
216 
218  GaudiHandle& operator=( const GaudiHandle& other ) {
219  GaudiHandleBase::operator=( other );
220  // release any current tool
221  release().ignore();
222  m_pObject = other.m_pObject.load();
223  // update ref-counting
224  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
225  return *this;
226  }
227 
230  // not really const, because it updates m_pObject
231  // Do the lookup into a temporary pointer.
232  T* p = nullptr;
233  if ( retrieve( p ).isFailure() ) { return StatusCode::FAILURE; }
234 
235  // If m_pObject is null, then copy p to m_pObject.
236  // Otherwise, release p.
237  T* old = nullptr;
238  if ( m_pObject.compare_exchange_strong( old, p ) ) { return StatusCode::SUCCESS; }
239  return release( p );
240  }
241 
243  StatusCode release() const {
244  // not really const, because it updates m_pObject
246  if ( m_pObject ) {
247  sc = release( m_pObject );
248  m_pObject = nullptr;
249  }
250  return sc;
251  }
252 
254  bool isValid() const {
255  // not really const, because it may update m_pObject
256  return m_pObject || retrieve().isSuccess();
257  }
258 
261  operator bool() const {
262  // not really const, because it may update m_pObject
263  return isValid();
264  }
265 
267  T* get() { return m_pObject; }
268 
270  std::add_const_t<T>* get() const { return m_pObject; }
271 
273  bool isSet() const { return get(); }
274 
275  T& operator*() {
276  assertObject();
277  return *m_pObject;
278  }
279 
280  T* operator->() {
281  assertObject();
282  return m_pObject;
283  }
284 
285  std::add_const_t<T>& operator*() const {
286  // not really const, because it may update m_pObject
287  assertObject();
288  return *m_pObject;
289  }
290 
291  std::add_const_t<T>* operator->() const {
292  // not really const, because it may update m_pObject
293  assertObject();
294  return m_pObject;
295  }
296 
298  std::string getDefaultType() { return System::typeinfoName( typeid( T ) ); }
299 
301  const auto defName = GaudiHandleBase::type();
302  return ( defName.empty() ? getDefaultType() : defName );
303  }
304 
305 protected:
307  virtual StatusCode retrieve( T*& ) const = 0; // not really const, because it updates m_pObject
308 
311  virtual StatusCode release( T* comp ) const { // not really const, because it updates m_pObject
312  // const cast to support T being a const type
313  ::details::nonConst( comp )->release();
314  return StatusCode::SUCCESS;
315  }
316 
317 private:
320  const std::string& myType = getDefaultType();
321  GaudiHandleBase::setTypeAndName( myType + '/' + myType );
322  }
323 
325  void setDefaultType() { GaudiHandleBase::setTypeAndName( getDefaultType() ); }
326 
329  void assertObject() const { // not really const, because it may update m_pObject
330  if ( !isValid() ) {
331  throw GaudiException( "Failed to retrieve " + componentType() + ": " + typeAndName(),
332  componentType() + " retrieve", StatusCode::FAILURE );
333  }
334  }
335 
336 private:
337  //
338  // Data members
339  //
340  mutable std::atomic<T*> m_pObject = nullptr;
341 };
342 
350 protected:
351  GaudiHandleArrayBase( std::string myComponentType, std::string myParentName )
352  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {}
353 
354 public:
358 
361  bool setTypesAndNames( const std::vector<std::string>& myTypesAndNamesList );
362 
365  const std::vector<std::string> typesAndNames() const;
366 
368  const std::vector<std::string> types() const;
369 
371  const std::vector<std::string> names() const;
372 
375  const std::vector<std::string> getBaseInfos( std::string ( GaudiHandleBase::*pMemFunc )() const ) const;
376 
380  std::string pythonPropertyClassName() const override;
381 
385  std::string pythonRepr() const override;
386 
390  virtual bool push_back( const std::string& myHandleTypeAndName ) = 0;
391 
393  virtual void clear() = 0;
394 
396  virtual bool empty() const = 0;
397 
400  virtual ConstBaseHandleArray getBaseArray() const = 0;
401 
405 
407  virtual bool retrieved() const = 0;
408 };
409 
411 template <class T>
413 public:
414  //
415  // public nested types
416  //
418  typedef typename HandleVector::value_type value_type;
419  typedef typename HandleVector::size_type size_type;
421  typedef typename HandleVector::const_reference const_reference;
422  typedef typename HandleVector::iterator iterator;
423  typedef typename HandleVector::const_iterator const_iterator;
424  typedef typename HandleVector::reverse_iterator reverse_iterator;
425  typedef typename HandleVector::const_reverse_iterator const_reverse_iterator;
426 
427 protected:
428  //
429  // Constructors
430  //
435  GaudiHandleArray( const std::vector<std::string>& myTypesAndNamesList, std::string myComponentType,
436  std::string myParentName )
437  : GaudiHandleArrayBase( std::move( myComponentType ), std::move( myParentName ) ) {
438  setTypesAndNames( myTypesAndNamesList );
439  }
440 
445  GaudiHandleArray( const std::string& myComponentType, const std::string& myParentName )
446  : GaudiHandleArrayBase( myComponentType, myParentName ) {}
447 
448 public:
450  GaudiHandleArray& operator=( const std::vector<std::string>& myTypesAndNamesList ) {
451  setTypesAndNames( myTypesAndNamesList );
452  return *this;
453  }
454 
457  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
458  return baseArray;
459  }
460 
463  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
464  return baseArray;
465  }
466 
467  //
468  // Simulate (part of) an std::vector
469  //
470  iterator begin() { return m_handleArray.begin(); }
471 
472  iterator end() { return m_handleArray.end(); }
473 
474  const_iterator begin() const { return m_handleArray.begin(); }
475 
476  const_iterator end() const { return m_handleArray.end(); }
477 
478  const_iterator rbegin() const { return m_handleArray.rbegin(); }
479 
480  const_iterator rend() const { return m_handleArray.rend(); }
481 
482  size_type size() const { return m_handleArray.size(); }
483 
484  void clear() override { m_handleArray.clear(); }
485 
486  bool empty() const override { return m_handleArray.empty(); }
487 
488  T& operator[]( int index ) { return m_handleArray[index]; }
489 
490  const T& operator[]( int index ) const { return m_handleArray[index]; }
491 
493  T* operator[]( std::string_view name ) {
494  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
495  return it != end() ? &*it : nullptr;
496  }
497 
499  const T* operator[]( std::string_view name ) const {
500  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
501  return it != end() ? &*it : nullptr;
502  }
503 
506  using GaudiHandleArrayBase::push_back; // avoid compiler warning
507  virtual bool push_back( const T& myHandle ) {
508  m_handleArray.push_back( myHandle );
509  return true;
510  }
511 
515  for ( auto& i : *this ) {
516  // stop at first failure
517  if ( i.retrieve().isFailure() ) {
518  sc = StatusCode::FAILURE;
519  break;
520  }
521  }
522  if ( sc ) { m_retrieved = true; }
523  return sc;
524  }
525 
529  for ( auto& i : *this ) {
530  // continue trying to release other tools even if we fail...
531  if ( i.release().isFailure() ) sc = StatusCode::FAILURE;
532  }
533  return sc;
534  }
535 
537  virtual bool retrieved() const override { return m_retrieved; }
538 
539 private:
540  //
541  // Private data members
542  //
544  bool m_retrieved{ false };
545 };
546 
547 #endif // ! GAUDIKERNEL_GAUDIHANDLE_H
GaudiHandle::isSet
bool isSet() const
True if the wrapped pointer is not null.
Definition: GaudiHandle.h:273
GaudiHandleArray::operator[]
T * operator[](std::string_view name)
Get pointer (!) to ToolHandle by instance name.
Definition: GaudiHandle.h:493
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:474
GaudiHandleArray::size
size_type size() const
Definition: GaudiHandle.h:482
GaudiHandleArray::operator[]
const T & operator[](int index) const
Definition: GaudiHandle.h:490
GaudiHandle::operator->
T * operator->()
Definition: GaudiHandle.h:280
std::move
T move(T... args)
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:81
GaudiHandle::setDefaultTypeAndName
void setDefaultTypeAndName()
Helper function to set default name and type.
Definition: GaudiHandle.h:319
System.h
GaudiHandleArray::retrieve
StatusCode retrieve()
Retrieve all tools.
Definition: GaudiHandle.h:513
GaudiException.h
GaudiHandleArray::push_back
virtual bool push_back(const T &myHandle)
Definition: GaudiHandle.h:507
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:80
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:298
GaudiException
Definition: GaudiException.h:31
GaudiPartProp.decorators.get
get
decorate the vector of properties
Definition: decorators.py:283
GaudiHandle::operator*
std::add_const_t< T > & operator*() const
Definition: GaudiHandle.h:285
GaudiHandleArray::empty
bool empty() const override
Return whether the list of tools is empty.
Definition: GaudiHandle.h:486
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:141
ProduceConsume.types
types
Definition: ProduceConsume.py:59
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
GaudiHandleInfo::componentType
const std::string & componentType() const
Definition: GaudiHandle.h:57
GaudiHandleArrayBase::ConstBaseHandleArray
std::vector< const GaudiHandleBase * > ConstBaseHandleArray
Definition: GaudiHandle.h:357
GaudiHandle::operator=
GaudiHandle & operator=(const GaudiHandle &other)
Assignment operator for correct ref-counting.
Definition: GaudiHandle.h:218
GaudiHandle::GaudiHandle
GaudiHandle(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:185
GaudiHandleInfo::setParentName
void setParentName(std::string parent)
The name of the parent.
Definition: GaudiHandle.h:88
GaudiHandleArray::operator[]
T & operator[](int index)
Definition: GaudiHandle.h:488
GaudiHandleArray::release
StatusCode release()
Release all tools.
Definition: GaudiHandle.h:527
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:472
GaudiHandleBase
Definition: GaudiHandle.h:106
GaudiHandle
Definition: GaudiHandle.h:180
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
Generic constructor.
Definition: GaudiHandle.h:435
GaudiHandleInfo::m_parentName
std::string m_parentName
Definition: GaudiHandle.h:96
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:455
GaudiHandleArray::reference
HandleVector::reference reference
Definition: GaudiHandle.h:420
GaudiHandleArray::rend
const_iterator rend() const
Definition: GaudiHandle.h:480
GaudiHandleArray::end
const_iterator end() const
Definition: GaudiHandle.h:476
GaudiHandle::get
T * get()
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:267
GaudiHandleArray::HandleVector
std::vector< T > HandleVector
Definition: GaudiHandle.h:417
GaudiHandle::release
virtual StatusCode release(T *comp) const
Release the component.
Definition: GaudiHandle.h:311
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
GaudiHandleArray::const_iterator
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:423
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:19
std::atomic::load
T load(T... args)
GaudiHandle::GaudiHandle
GaudiHandle(const GaudiHandle &other)
Copy constructor needed for correct ref-counting.
Definition: GaudiHandle.h:199
Gaudi::Parsers::operator<<
std::ostream & operator<<(std::ostream &o, const Catalog &c)
printout operator
Definition: Catalog.h:68
std::ostream
STL class.
GaudiHandleBase::m_typeAndName
std::string m_typeAndName
Definition: GaudiHandle.h:168
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:31
GaudiHandleInfo::m_propertyName
std::string m_propertyName
Definition: GaudiHandle.h:95
GaudiHandleArray::size_type
HandleVector::size_type size_type
Definition: GaudiHandle.h:419
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::string &myComponentType, const std::string &myParentName)
Constructor creating an empty array.
Definition: GaudiHandle.h:445
GaudiHandleBase::typeAndName
std::string typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:132
GaudiHandle::m_pObject
std::atomic< T * > m_pObject
Definition: GaudiHandle.h:340
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:450
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:484
GaudiHandleArray::retrieved
virtual bool retrieved() const override
has Array been retreived?
Definition: GaudiHandle.h:537
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:207
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:349
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:254
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:421
GaudiHandle::operator->
std::add_const_t< T > * operator->() const
Definition: GaudiHandle.h:291
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:160
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
GaudiHandle::operator*
T & operator*()
Definition: GaudiHandle.h:275
GaudiHandleArrayBase::BaseHandleArray
std::vector< GaudiHandleBase * > BaseHandleArray
Definition: GaudiHandle.h:356
std
STL namespace.
GaudiHandle::getDefaultName
std::string getDefaultName()
Definition: GaudiHandle.h:300
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:325
GaudiHandleArray::reverse_iterator
HandleVector::reverse_iterator reverse_iterator
Definition: GaudiHandle.h:424
GaudiHandleInfo::setComponentType
void setComponentType(std::string componentType)
The component type.
Definition: GaudiHandle.h:85
fixtures.reference
Generator[dict, None, None] reference(request, Optional[Path] reference_path)
Definition: fixtures.py:211
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:122
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:191
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:351
GaudiHandleArray::iterator
HandleVector::iterator iterator
Definition: GaudiHandle.h:422
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:470
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:499
GaudiHandleArray::const_reverse_iterator
HandleVector::const_reverse_iterator const_reverse_iterator
Definition: GaudiHandle.h:425
GaudiHandleArray::rbegin
const_iterator rbegin() const
Definition: GaudiHandle.h:478
IOTest.end
end
Definition: IOTest.py:125
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:94
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:461
GaudiHandleArray
T is the concrete handle type, e.g.
Definition: GaudiHandle.h:412
GaudiHandleArrayProperty
Definition: Property.h:617
GaudiHandle::assertObject
void assertObject() const
Load the pointer to the component.
Definition: GaudiHandle.h:329
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
GaudiHandle::retrieve
StatusCode retrieve() const
Retrieve the component.
Definition: GaudiHandle.h:229
GaudiHandle::get
std::add_const_t< T > * get() const
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:270
GaudiHandleArray::value_type
HandleVector::value_type value_type
Definition: GaudiHandle.h:418
GaudiHandle::release
StatusCode release() const
Release the component.
Definition: GaudiHandle.h:243
Property.h
Gaudi::ParticleProperties::index
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Definition: IParticlePropertySvc.cpp:39
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.