The Gaudi Framework  master (37c0b60a)
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 <string>
23 #include <type_traits>
24 #include <vector>
25 
26 namespace details {
28  template <class T>
29  std::remove_const_t<T>* nonConst( T* p ) {
30  return const_cast<std::remove_const_t<T>*>( p );
31  }
32 } // namespace details
33 
35 protected:
44  GaudiHandleInfo( std::string myComponentType, std::string myParentName )
45  : m_componentType( std::move( myComponentType ) ), m_parentName( std::move( myParentName ) ) {}
46 
47 public:
49  // Don't use =default here. Otherwise, in c++20 mode, clang will
50  // instantiate the handle virtual functions early, breaking the case
51  // where handles are used with a forward-declared class.
52  virtual ~GaudiHandleInfo() {}
53  //
54  // Public member functions
55  //
56  const std::string& componentType() const { return m_componentType; }
57 
59  const std::string& propertyName() const { return m_propertyName; }
60 
62  void setPropertyName( std::string propName ) { m_propertyName = std::move( propName ); }
63 
65  const std::string& parentName() const { return m_parentName; }
66 
70  virtual std::string pythonPropertyClassName() const = 0;
71 
76  virtual std::string pythonRepr() const = 0;
77 
78  // Easy printing out of Handles and HandleArrays
79  // It prints <propertyName> = <HandleType>( <HandleType(s)AndName(s)> )
80  friend std::ostream& operator<<( std::ostream& os, const GaudiHandleInfo& handle );
81 
82 protected:
84  void setComponentType( std::string componentType ) { m_componentType = std::move( componentType ); }
85 
87  void setParentName( std::string parent ) { m_parentName = std::move( parent ); }
88 
89 private:
90  //
91  // Data members
92  //
93  std::string m_componentType; // e.g.: "PublicTool","PrivateTool","Service"
94  std::string m_propertyName; // name as used in declareProperty(name,gaudiHandle)
95  std::string m_parentName; // name of the parent having this handle as a member
96 };
97 
106  //
107  // Ctors etc
108  //
109 protected:
121  GaudiHandleBase( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
122  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {
123  setTypeAndName( std::move( myTypeAndName ) );
124  }
125 
126 public:
127  //
128  // Public member functions
129  //
131  const std::string& typeAndName() const { return m_typeAndName; }
132 
134  std::string type() const;
135 
137  std::string name() const;
138 
140  bool empty() const { return m_typeAndName.empty(); }
141 
143  void setTypeAndName( std::string myTypeAndName );
144 
146  void setName( std::string_view myName );
147 
151  std::string pythonPropertyClassName() const override;
152 
154  std::string messageName() const;
155 
159  std::string pythonRepr() const override;
160 
162 
163 private:
164  //
165  // Data member
166  //
167  std::string m_typeAndName; // the full type and name: "type/name"
168 };
169 
178 template <class T>
180  //
181  // Constructors etc.
182  //
183 protected:
184  GaudiHandle( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
185  : GaudiHandleBase( std::move( myTypeAndName ), std::move( myComponentType ), std::move( myParentName ) ) {}
186 
187 public:
189  template <typename CT = T, typename NCT = std::remove_const_t<T>>
191  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>>* = nullptr )
192  : GaudiHandleBase( other ) {
193  m_pObject = other.get();
194  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
195  }
196 
198  GaudiHandle( const GaudiHandle& other ) : GaudiHandleBase( other ) {
199  m_pObject = other.m_pObject.load();
200  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
201  }
202 
204  template <typename CT = T, typename NCT = std::remove_const_t<T>>
205  std::enable_if_t<std::is_const_v<CT> && !std::is_same_v<CT, NCT>, GaudiHandle&>
206  operator=( const GaudiHandle<NCT>& other ) {
207  GaudiHandleBase::operator=( other );
208  // release any current tool
209  release().ignore();
210  m_pObject = other.get();
211  // update ref-counting
212  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
213  return *this;
214  }
215 
217  GaudiHandle& operator=( const GaudiHandle& other ) {
218  GaudiHandleBase::operator=( other );
219  // release any current tool
220  release().ignore();
221  m_pObject = other.m_pObject.load();
222  // update ref-counting
223  if ( m_pObject ) ::details::nonConst( m_pObject.load() )->addRef();
224  return *this;
225  }
226 
229  // not really const, because it updates m_pObject
230  // Do the lookup into a temporary pointer.
231  T* p = nullptr;
232  if ( retrieve( p ).isFailure() ) { return StatusCode::FAILURE; }
233 
234  // If m_pObject is null, then copy p to m_pObject.
235  // Otherwise, release p.
236  T* old = nullptr;
237  if ( m_pObject.compare_exchange_strong( old, p ) ) { return StatusCode::SUCCESS; }
238  return release( p );
239  }
240 
242  StatusCode release() const {
243  // not really const, because it updates m_pObject
245  if ( m_pObject ) {
246  sc = release( m_pObject );
247  m_pObject = nullptr;
248  }
249  return sc;
250  }
251 
253  bool isValid() const {
254  // not really const, because it may update m_pObject
255  return m_pObject || retrieve().isSuccess();
256  }
257 
260  operator bool() const {
261  // not really const, because it may update m_pObject
262  return isValid();
263  }
264 
266  T* get() { return m_pObject; }
267 
269  std::add_const_t<T>* get() const { return m_pObject; }
270 
272  bool isSet() const { return get(); }
273 
274  T& operator*() {
275  assertObject();
276  return *m_pObject;
277  }
278 
279  T* operator->() {
280  assertObject();
281  return m_pObject;
282  }
283 
284  std::add_const_t<T>& operator*() const {
285  // not really const, because it may update m_pObject
286  assertObject();
287  return *m_pObject;
288  }
289 
290  std::add_const_t<T>* operator->() const {
291  // not really const, because it may update m_pObject
292  assertObject();
293  return m_pObject;
294  }
295 
297  std::string getDefaultType() { return System::typeinfoName( typeid( T ) ); }
298 
300  const auto defName = GaudiHandleBase::type();
301  return ( defName.empty() ? getDefaultType() : defName );
302  }
303 
304 protected:
306  virtual StatusCode retrieve( T*& ) const = 0; // not really const, because it updates m_pObject
307 
310  virtual StatusCode release( T* comp ) const { // not really const, because it updates m_pObject
311  // const cast to support T being a const type
312  ::details::nonConst( comp )->release();
313  return StatusCode::SUCCESS;
314  }
315 
316 private:
319  const std::string& myType = getDefaultType();
320  GaudiHandleBase::setTypeAndName( myType + '/' + myType );
321  }
322 
324  void setDefaultType() { GaudiHandleBase::setTypeAndName( getDefaultType() ); }
325 
328  void assertObject() const { // not really const, because it may update m_pObject
329  if ( !isValid() ) {
330  throw GaudiException( "Failed to retrieve " + componentType() + ": " + typeAndName(),
331  componentType() + " retrieve", StatusCode::FAILURE );
332  }
333  }
334 
335 private:
336  //
337  // Data members
338  //
339  mutable std::atomic<T*> m_pObject = nullptr;
340 };
341 
349 protected:
350  GaudiHandleArrayBase( std::string myComponentType, std::string myParentName )
351  : GaudiHandleInfo( std::move( myComponentType ), std::move( myParentName ) ) {}
352 
353 public:
357 
360  bool setTypesAndNames( const std::vector<std::string>& myTypesAndNamesList );
361 
364  const std::vector<std::string> typesAndNames() const;
365 
367  const std::vector<std::string> types() const;
368 
370  const std::vector<std::string> names() const;
371 
374  const std::vector<std::string> getBaseInfos( auto ( GaudiHandleBase::*pMemFunc )() const ) const;
375 
379  std::string pythonPropertyClassName() const override;
380 
384  std::string pythonRepr() const override;
385 
389  virtual bool push_back( const std::string& myHandleTypeAndName ) = 0;
390 
392  virtual void clear() = 0;
393 
395  virtual bool empty() const = 0;
396 
399  virtual ConstBaseHandleArray getBaseArray() const = 0;
400 
404 
406  virtual bool retrieved() const = 0;
407 };
408 
410 template <class T>
412 public:
413  //
414  // public nested types
415  //
417  typedef typename HandleVector::value_type value_type;
418  typedef typename HandleVector::size_type size_type;
420  typedef typename HandleVector::const_reference const_reference;
421  typedef typename HandleVector::iterator iterator;
422  typedef typename HandleVector::const_iterator const_iterator;
423  typedef typename HandleVector::reverse_iterator reverse_iterator;
424  typedef typename HandleVector::const_reverse_iterator const_reverse_iterator;
425 
426 protected:
427  //
428  // Constructors
429  //
434  GaudiHandleArray( const std::vector<std::string>& myTypesAndNamesList, std::string myComponentType,
435  std::string myParentName )
436  : GaudiHandleArrayBase( std::move( myComponentType ), std::move( myParentName ) ) {
437  setTypesAndNames( myTypesAndNamesList );
438  }
439 
444  GaudiHandleArray( const std::string& myComponentType, const std::string& myParentName )
445  : GaudiHandleArrayBase( myComponentType, myParentName ) {}
446 
447 public:
449  GaudiHandleArray& operator=( const std::vector<std::string>& myTypesAndNamesList ) {
450  setTypesAndNames( myTypesAndNamesList );
451  return *this;
452  }
453 
456  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
457  return baseArray;
458  }
459 
462  for ( auto& h : m_handleArray ) baseArray.push_back( &h );
463  return baseArray;
464  }
465 
466  //
467  // Simulate (part of) an std::vector
468  //
469  iterator begin() { return m_handleArray.begin(); }
470 
471  iterator end() { return m_handleArray.end(); }
472 
473  const_iterator begin() const { return m_handleArray.begin(); }
474 
475  const_iterator end() const { return m_handleArray.end(); }
476 
477  const_iterator rbegin() const { return m_handleArray.rbegin(); }
478 
479  const_iterator rend() const { return m_handleArray.rend(); }
480 
481  size_type size() const { return m_handleArray.size(); }
482 
483  void clear() override { m_handleArray.clear(); }
484 
485  bool empty() const override { return m_handleArray.empty(); }
486 
487  T& operator[]( int index ) { return m_handleArray[index]; }
488 
489  const T& operator[]( int index ) const { return m_handleArray[index]; }
490 
492  T* operator[]( std::string_view name ) {
493  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
494  return it != end() ? &*it : nullptr;
495  }
496 
498  const T* operator[]( std::string_view name ) const {
499  auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
500  return it != end() ? &*it : nullptr;
501  }
502 
505  using GaudiHandleArrayBase::push_back; // avoid compiler warning
506  virtual bool push_back( const T& myHandle ) {
507  m_handleArray.push_back( myHandle );
508  return true;
509  }
510 
514  for ( auto& i : *this ) {
515  // stop at first failure
516  if ( i.retrieve().isFailure() ) {
517  sc = StatusCode::FAILURE;
518  break;
519  }
520  }
521  if ( sc ) { m_retrieved = true; }
522  return sc;
523  }
524 
528  for ( auto& i : *this ) {
529  // continue trying to release other tools even if we fail...
530  if ( i.release().isFailure() ) sc = StatusCode::FAILURE;
531  }
532  return sc;
533  }
534 
536  virtual bool retrieved() const override { return m_retrieved; }
537 
538 private:
539  //
540  // Private data members
541  //
543  bool m_retrieved{ false };
544 };
545 
546 #endif // ! GAUDIKERNEL_GAUDIHANDLE_H
GaudiHandle::isSet
bool isSet() const
True if the wrapped pointer is not null.
Definition: GaudiHandle.h:272
GaudiHandleArray::operator[]
T * operator[](std::string_view name)
Get pointer (!) to ToolHandle by instance name.
Definition: GaudiHandle.h:492
GaudiHandleInfo::parentName
const std::string & parentName() const
The name of the parent.
Definition: GaudiHandle.h:65
std::string
STL class.
GaudiHandleArray::begin
const_iterator begin() const
Definition: GaudiHandle.h:473
GaudiHandleArray::size
size_type size() const
Definition: GaudiHandle.h:481
GaudiHandleArray::operator[]
const T & operator[](int index) const
Definition: GaudiHandle.h:489
GaudiHandle::operator->
T * operator->()
Definition: GaudiHandle.h:279
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:318
System.h
GaudiHandleArray::retrieve
StatusCode retrieve()
Retrieve all tools.
Definition: GaudiHandle.h:512
GaudiException.h
GaudiHandleArray::push_back
virtual bool push_back(const T &myHandle)
Definition: GaudiHandle.h:506
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:297
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:284
GaudiHandleArray::empty
bool empty() const override
Return whether the list of tools is empty.
Definition: GaudiHandle.h:485
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:140
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:56
GaudiHandleArrayBase::ConstBaseHandleArray
std::vector< const GaudiHandleBase * > ConstBaseHandleArray
Definition: GaudiHandle.h:356
GaudiHandle::operator=
GaudiHandle & operator=(const GaudiHandle &other)
Assignment operator for correct ref-counting.
Definition: GaudiHandle.h:217
GaudiHandle::GaudiHandle
GaudiHandle(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:184
GaudiHandleInfo::setParentName
void setParentName(std::string parent)
The name of the parent.
Definition: GaudiHandle.h:87
GaudiHandleArray::operator[]
T & operator[](int index)
Definition: GaudiHandle.h:487
GaudiHandleArray::release
StatusCode release()
Release all tools.
Definition: GaudiHandle.h:526
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:471
GaudiHandleBase
Definition: GaudiHandle.h:105
GaudiHandle
Definition: GaudiHandle.h:179
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
Generic constructor.
Definition: GaudiHandle.h:434
GaudiHandleInfo::m_parentName
std::string m_parentName
Definition: GaudiHandle.h:95
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:454
GaudiHandleArray::reference
HandleVector::reference reference
Definition: GaudiHandle.h:419
GaudiHandleArray::rend
const_iterator rend() const
Definition: GaudiHandle.h:479
GaudiHandleArray::end
const_iterator end() const
Definition: GaudiHandle.h:475
GaudiHandle::get
T * get()
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:266
GaudiHandleArray::HandleVector
std::vector< T > HandleVector
Definition: GaudiHandle.h:416
GaudiHandle::release
virtual StatusCode release(T *comp) const
Release the component.
Definition: GaudiHandle.h:310
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
GaudiHandleArray::const_iterator
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:422
details::nonConst
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.
Definition: GaudiHandle.h:29
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:198
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:167
GaudiHandleInfo::propertyName
const std::string & propertyName() const
name as used in declareProperty(name,gaudiHandle)
Definition: GaudiHandle.h:59
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:94
GaudiHandleArray::size_type
HandleVector::size_type size_type
Definition: GaudiHandle.h:418
GaudiHandleArray::GaudiHandleArray
GaudiHandleArray(const std::string &myComponentType, const std::string &myParentName)
Constructor creating an empty array.
Definition: GaudiHandle.h:444
GaudiHandle::m_pObject
std::atomic< T * > m_pObject
Definition: GaudiHandle.h:339
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:449
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:483
GaudiHandleArray::retrieved
virtual bool retrieved() const override
has Array been retreived?
Definition: GaudiHandle.h:536
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:206
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:348
GaudiHandleProperty
Definition: Property.h:578
GaudiHandleInfo::GaudiHandleInfo
GaudiHandleInfo(std::string myComponentType, std::string myParentName)
Some basic information and helper functions shared between various handles/arrays.
Definition: GaudiHandle.h:44
GaudiHandle::isValid
bool isValid() const
Check if the handle is valid (try to retrive the object is not done yet).
Definition: GaudiHandle.h:253
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:52
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:420
GaudiHandle::operator->
std::add_const_t< T > * operator->() const
Definition: GaudiHandle.h:290
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:542
GaudiHandle::operator*
T & operator*()
Definition: GaudiHandle.h:274
GaudiHandleArrayBase::BaseHandleArray
std::vector< GaudiHandleBase * > BaseHandleArray
Definition: GaudiHandle.h:355
std
STL namespace.
GaudiHandle::getDefaultName
std::string getDefaultName()
Definition: GaudiHandle.h:299
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:324
GaudiHandleArray::reverse_iterator
HandleVector::reverse_iterator reverse_iterator
Definition: GaudiHandle.h:423
GaudiHandleInfo::setComponentType
void setComponentType(std::string componentType)
The component type.
Definition: GaudiHandle.h:84
fixtures.reference
Generator[dict, None, None] reference(request, Optional[Path] reference_path)
Definition: fixtures.py:211
GaudiHandleInfo
Definition: GaudiHandle.h:34
GaudiHandleBase::typeAndName
const std::string & typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:131
GaudiHandleBase::GaudiHandleBase
GaudiHandleBase(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Create a handle ('smart pointer') to a gaudi component.
Definition: GaudiHandle.h:121
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:190
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:350
GaudiHandleArray::iterator
HandleVector::iterator iterator
Definition: GaudiHandle.h:421
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:469
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:498
GaudiHandleArray::const_reverse_iterator
HandleVector::const_reverse_iterator const_reverse_iterator
Definition: GaudiHandle.h:424
GaudiHandleArray::rbegin
const_iterator rbegin() const
Definition: GaudiHandle.h:477
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:62
GaudiHandleInfo::m_componentType
std::string m_componentType
Definition: GaudiHandle.h:93
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:460
GaudiHandleArray
T is the concrete handle type, e.g.
Definition: GaudiHandle.h:411
GaudiHandleArrayProperty
Definition: Property.h:615
GaudiHandle::assertObject
void assertObject() const
Load the pointer to the component.
Definition: GaudiHandle.h:328
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
GaudiHandle::retrieve
StatusCode retrieve() const
Retrieve the component.
Definition: GaudiHandle.h:228
GaudiHandle::get
std::add_const_t< T > * get() const
Return the wrapped pointer, not calling retrieve() if null.
Definition: GaudiHandle.h:269
GaudiHandleArray::value_type
HandleVector::value_type value_type
Definition: GaudiHandle.h:417
GaudiHandle::release
StatusCode release() const
Release the component.
Definition: GaudiHandle.h:242
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.