| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
GaudiHandleArray< T > Class Template Reference

T is the concrete handle type, e.g. More...

`#include <GaudiKernel/GaudiHandle.h>`

Inheritance diagram for GaudiHandleArray< T >:
[legend]
Collaboration diagram for GaudiHandleArray< T >:
[legend]

## Public Types
typedef std::vector< T > | HandleVector
typedef HandleVector::value_type | value_type
typedef HandleVector::size_type | size_type
typedef HandleVector::reference | reference
typedef HandleVector::const_reference | const_reference
typedef HandleVector::iterator | iterator
typedef HandleVector::const_iterator | const_iterator
typedef HandleVector::reverse_iterator | reverse_iterator
typedef HandleVector::const_reverse_iterator | const_reverse_iterator
Public Types inherited from GaudiHandleArrayBase
typedef std::vector< GaudiHandleBase * > | BaseHandleArray
typedef std::vector< const GaudiHandleBase * > | ConstBaseHandleArray

## Public Member Functions
virtual | ~GaudiHandleArray ()=default
GaudiHandleArray & | operator= (const std::vector< std::string > &myTypesAndNamesList)
| Set the array of GaudiHandles from typeAndNames given in vector of strings. More...
GaudiHandleArrayBase::BaseHandleArray | getBaseArray () override
| Get a read-write vector of GaudiHandleBase* pointing to the real handles. More...
GaudiHandleArrayBase::ConstBaseHandleArray | getBaseArray () const override
| Get a read-only vector of const GaudiHandleBase* pointing to the real handles. More...
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
const_iterator | rbegin () const
const_iterator | rend () const
size_type | size () const
void | clear () override
| Clear the list of handles. More...
bool | empty () const override
| Return whether the list of tools is empty. More...
T & | operator[] (int index)
const T & | operator[] (int index) const
T * | operator[] (const std::string &name)
| Get pointer (!) to ToolHandle by instance name. More...
const T * | operator[] (const std::string &name) const
| Get const pointer (!) to ToolHandle by instance name. More...
virtual bool | push_back (const T &myHandle)
StatusCode | retrieve ()
| Retrieve all tools. More...
StatusCode | release ()
| Release all tools. More...
bool | retrieved () const
| has Array been retreived? More...
Public Member Functions inherited from GaudiHandleArrayBase
bool | setTypesAndNames (const std::vector< std::string > &myTypesAndNamesList)
| Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>. More...
const std::vector< std::string > | typesAndNames () const
| Return a vector with "type/name" strings of all handles in the array. More...
const std::vector< std::string > | types () const
| Return a vector with "type" strings of all handles in the array. More...
const std::vector< std::string > | names () const
| Return a vector with "type/name" strings of all handles in the array. More...
const std::vector< std::string > | getBaseInfos (std::string(GaudiHandleBase::*pMemFunc)() const ) const
| Helper function to get a vector of strings filled with the return value of each tool of a member function if GaudiHandleBase. More...
std::string | pythonPropertyClassName () const override
| Name of the componentType with "HandleArray" appended. More...
std::string | pythonRepr () const override
| Python representation of array of handles, i.e. More...
virtual bool | push_back (const std::string &myHandleTypeAndName)=0
| Add a handle to the array with "type/name" given in <myHandleTypeAndName>. More...
Public Member Functions inherited from GaudiHandleInfo
virtual | ~GaudiHandleInfo ()=default
| virtual destructor so that derived class destructor is called. More...
const std::string & | componentType () const
const std::string & | propertyName () const
| name as used in declareProperty(name,gaudiHandle) More...
void | setPropertyName (std::string propName)
| set name as used in declareProperty(name,gaudiHandle). More...
const std::string & | parentName () const
| The name of the parent. More...

## Protected Member Functions
| GaudiHandleArray (const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
| Generic constructor. More...
| GaudiHandleArray (const std::string &myComponentType, const std::string &myParentName)
| Constructor creating an empty array. More...
Protected Member Functions inherited from GaudiHandleArrayBase
| GaudiHandleArrayBase (std::string myComponentType, std::string myParentName)
Protected Member Functions inherited from GaudiHandleInfo
| GaudiHandleInfo (std::string myComponentType, std::string myParentName)
| Some basic information and helper functions shared between various handles/arrays. More...
void | setComponentType (const std::string &componentType)
| The component type. More...
void | setParentName (const std::string &parent)
| The name of the parent. More...

## Private Attributes
HandleVector | m_handleArray
bool | m_retrieved { false }

## Detailed Description

### template<class T>
class GaudiHandleArray< T >

T is the concrete handle type, e.g.

ToolHandle<IMyTool>

Definition at line 384 of file GaudiHandle.h.

## Member Typedef Documentation

template<class T>

typedef HandleVector::const_iterator GaudiHandleArray< T >::const_iterator

Definition at line 395 of file GaudiHandle.h.

template<class T>

typedef HandleVector::const_reference GaudiHandleArray< T >::const_reference

Definition at line 393 of file GaudiHandle.h.

template<class T>

typedef HandleVector::const_reverse_iterator GaudiHandleArray< T >::const_reverse_iterator

Definition at line 397 of file GaudiHandle.h.

template<class T>

typedef std::vector< T > GaudiHandleArray< T >::HandleVector

Definition at line 389 of file GaudiHandle.h.

template<class T>

typedef HandleVector::iterator GaudiHandleArray< T >::iterator

Definition at line 394 of file GaudiHandle.h.

template<class T>

typedef HandleVector::reference GaudiHandleArray< T >::reference

Definition at line 392 of file GaudiHandle.h.

template<class T>

typedef HandleVector::reverse_iterator GaudiHandleArray< T >::reverse_iterator

Definition at line 396 of file GaudiHandle.h.

template<class T>

typedef HandleVector::size_type GaudiHandleArray< T >::size_type

Definition at line 391 of file GaudiHandle.h.

template<class T>

typedef HandleVector::value_type GaudiHandleArray< T >::value_type

Definition at line 390 of file GaudiHandle.h.

## Constructor & Destructor Documentation

template<class T>

GaudiHandleArray< T >::GaudiHandleArray | ( | const std::vector< std::string > & | myTypesAndNamesList,
|  | std::string | myComponentType,
|  | std::string | myParentName
| ) |  |
| inline protected

Generic constructor.

Probably not very useful...

Parameters

  typesAndNamesList | : a vector of strings with the concrete "type/name" strings for the list of tools

Definition at line 407 of file GaudiHandle.h.

409 : GaudiHandleArrayBase(std::move(myComponentType),std::move(myParentName))
410 {
411 setTypesAndNames( myTypesAndNamesList );
412 }
GaudiHandleArrayBase::setTypesAndNames
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in .
Definition: GaudiHandle.cpp:63
std::move
T move(T...args)
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:322
template<class T>

GaudiHandleArray< T >::GaudiHandleArray | ( | const std::string & | myComponentType,
|  | const std::string & | myParentName
| ) |  |
| inline protected

Constructor creating an empty array.

Parameters

  typesAndNamesList | : a vector of strings with the concrete "type/name" strings for the list of tools

Definition at line 418 of file GaudiHandle.h.

419 : GaudiHandleArrayBase(myComponentType,myParentName)
420 {}
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:322
template<class T>

virtual GaudiHandleArray< T >::~GaudiHandleArray | ( |  | ) |
| virtual default

## Member Function Documentation

template<class T>

iterator GaudiHandleArray< T >::begin | ( |  | ) |
| inline

Definition at line 448 of file GaudiHandle.h.

448 {
449 return m_handleArray.begin();
450 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
std::vector::begin
T begin(T...args)
template<class T>

const_iterator GaudiHandleArray< T >::begin | ( |  | ) | const
| inline

Definition at line 456 of file GaudiHandle.h.

456 {
457 return m_handleArray.begin();
458 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
std::vector::begin
T begin(T...args)
template<class T>

void GaudiHandleArray< T >::clear | ( |  | ) |
| inline override virtual

Clear the list of handles.

Implemented in GaudiHandleArray

Implements GaudiHandleArrayBase.

Definition at line 476 of file GaudiHandle.h.

476 {
477 m_handleArray.clear();
478 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
std::vector::clear
T clear(T...args)
template<class T>

bool GaudiHandleArray< T >::empty | ( |  | ) | const
| inline override virtual

Return whether the list of tools is empty.

Implements GaudiHandleArrayBase.

Definition at line 480 of file GaudiHandle.h.

480 {
481 return m_handleArray.empty();
482 }
std::vector::empty
T empty(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

iterator GaudiHandleArray< T >::end | ( |  | ) |
| inline

Definition at line 452 of file GaudiHandle.h.

452 {
453 return m_handleArray.end();
454 }
std::vector::end
T end(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

const_iterator GaudiHandleArray< T >::end | ( |  | ) | const
| inline

Definition at line 460 of file GaudiHandle.h.

460 {
461 return m_handleArray.end();
462 }
std::vector::end
T end(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

GaudiHandleArrayBase::BaseHandleArray GaudiHandleArray< T >::getBaseArray | ( |  | ) |
| inline override virtual

Get a read-write vector of GaudiHandleBase* pointing to the real handles.

Implemented in GaudiHandleArray.

Implements GaudiHandleArrayBase.

Definition at line 431 of file GaudiHandle.h.

431 {
432 GaudiHandleArrayBase::BaseHandleArray baseArray;
433 iterator it = begin(), itEnd = end();
434 for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
435 return baseArray;
436 }
GaudiHandleArray::iterator
HandleVector::iterator iterator
Definition: GaudiHandle.h:394
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:448
std::vector
STL class.
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:452
template<class T>

GaudiHandleArrayBase::ConstBaseHandleArray GaudiHandleArray< T >::getBaseArray | ( |  | ) | const
| inline override virtual

Get a read-only vector of const GaudiHandleBase* pointing to the real handles.

Implemented in GaudiHandleArray.

Implements GaudiHandleArrayBase.

Definition at line 438 of file GaudiHandle.h.

438 {
439 GaudiHandleArrayBase::ConstBaseHandleArray baseArray;
440 const_iterator it = begin(), itEnd = end();
441 for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
442 return baseArray;
443 }
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:448
GaudiHandleArray::const_iterator
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:395
std::vector
STL class.
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:452
template<class T>

GaudiHandleArray& GaudiHandleArray< T >::operator= | ( | const std::vector< std::string > & | myTypesAndNamesList | ) |
| inline

Set the array of GaudiHandles from typeAndNames given in vector of strings.

Definition at line 426 of file GaudiHandle.h.

426 {
427 setTypesAndNames( myTypesAndNamesList );
428 return *this;
429 }
GaudiHandleArrayBase::setTypesAndNames
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in .
Definition: GaudiHandle.cpp:63
template<class T>

T& GaudiHandleArray< T >::operator[] | ( | int | index | ) |
| inline

Definition at line 484 of file GaudiHandle.h.

484 {
485 return m_handleArray[index];
486 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

const T& GaudiHandleArray< T >::operator[] | ( | int | index | ) | const
| inline

Definition at line 488 of file GaudiHandle.h.

488 {
489 return m_handleArray[index];
490 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

T* GaudiHandleArray< T >::operator[] | ( | const std::string & | name | ) |
| inline

Get pointer (!) to ToolHandle by instance name.

Returns zero pointer if not found

Definition at line 493 of file GaudiHandle.h.

493 {
494 auto it = std::find_if(begin(),end(),[&](const_reference r) {
495 return r.name() == name;
496 } );
497 return it != end() ? &*it : nullptr;
498 }
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:393
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:448
std::find_if
T find_if(T...args)
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:452
template<class T>

const T* GaudiHandleArray< T >::operator[] | ( | const std::string & | name | ) | const
| inline

Get const pointer (!) to ToolHandle by instance name.

Returns zero pointer if not found

Definition at line 501 of file GaudiHandle.h.

501 {
502 auto it = std::find_if(begin(),end(),[&](const_reference r) {
503 return r.name() == name;
504 } );
505 return it != end() ? &*it : nullptr;
506 }
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:393
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:448
std::find_if
T find_if(T...args)
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:452
template<class T>

virtual bool GaudiHandleArray< T >::push_back | ( | const T & | myHandle | ) |
| inline virtual

Reimplemented in ToolHandleArray< T >, ToolHandleArray< IThreadInitTool >, and ServiceHandleArray< T >.

Definition at line 511 of file GaudiHandle.h.

511 {
512 m_handleArray.push_back( myHandle );
513 return true;
514 }
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

const_iterator GaudiHandleArray< T >::rbegin | ( |  | ) | const
| inline

Definition at line 464 of file GaudiHandle.h.

464 {
465 return m_handleArray.rbegin();
466 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
std::vector::rbegin
T rbegin(T...args)
template<class T>

StatusCode GaudiHandleArray< T >::release | ( |  | ) |
| inline

Release all tools.

Definition at line 527 of file GaudiHandle.h.

527 {
528 StatusCode sc = StatusCode::SUCCESS;
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 }
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ana.i
list i
Definition: ana.py:128
template<class T>

const_iterator GaudiHandleArray< T >::rend | ( |  | ) | const
| inline

Definition at line 468 of file GaudiHandle.h.

468 {
469 return m_handleArray.rend();
470 }
std::vector::rend
T rend(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
template<class T>

StatusCode GaudiHandleArray< T >::retrieve | ( |  | ) |
| inline

Retrieve all tools.

Definition at line 517 of file GaudiHandle.h.

517 {
518 for (auto& i : *this) {
519 // stop at first failure
520 if ( i.retrieve().isFailure() ) return StatusCode::FAILURE;
521 }
522 m_retrieved = true;
523 return StatusCode::SUCCESS;
524 }
GaudiHandleArray::m_retrieved
bool m_retrieved
Definition: GaudiHandle.h:544
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
ana.i
list i
Definition: ana.py:128
template<class T>

bool GaudiHandleArray< T >::retrieved | ( |  | ) | const
| inline virtual

has Array been retreived?

Implements GaudiHandleArrayBase.

Definition at line 537 of file GaudiHandle.h.

537 { return m_retrieved; }
GaudiHandleArray::m_retrieved
bool m_retrieved
Definition: GaudiHandle.h:544
template<class T>

size_type GaudiHandleArray< T >::size | ( |  | ) | const
| inline

Definition at line 472 of file GaudiHandle.h.

472 {
473 return m_handleArray.size();
474 }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:543
std::vector::size
T size(T...args)

## Member Data Documentation

template<class T>

HandleVector GaudiHandleArray< T >::m_handleArray
| private

Definition at line 543 of file GaudiHandle.h.

template<class T>

bool GaudiHandleArray< T >::m_retrieved { false }
| private

Definition at line 544 of file GaudiHandle.h.

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/GaudiHandle.h