| The Gaudi Framework v30r0 (c919700c)

- 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...
virtual bool | retrieved () const override
| 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 416 of file GaudiHandle.h.

## Member Typedef Documentation

template<class T>

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

Definition at line 428 of file GaudiHandle.h.

template<class T>

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

Definition at line 426 of file GaudiHandle.h.

template<class T>

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

Definition at line 430 of file GaudiHandle.h.

template<class T>

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

Definition at line 422 of file GaudiHandle.h.

template<class T>

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

Definition at line 427 of file GaudiHandle.h.

template<class T>

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

Definition at line 425 of file GaudiHandle.h.

template<class T>

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

Definition at line 429 of file GaudiHandle.h.

template<class T>

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

Definition at line 424 of file GaudiHandle.h.

template<class T>

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

Definition at line 423 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 440 of file GaudiHandle.h.

442 : GaudiHandleArrayBase( std::move( myComponentType ), std::move( myParentName ) )
443 {
444 setTypesAndNames( myTypesAndNamesList );
445 }
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:58
std::move
T move(T...args)
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:354
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 451 of file GaudiHandle.h.

452 : GaudiHandleArrayBase( myComponentType, myParentName )
453 {
454 }
GaudiHandleArrayBase::GaudiHandleArrayBase
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
Definition: GaudiHandle.h:354
template<class T>

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

## Member Function Documentation

template<class T>

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

Definition at line 485 of file GaudiHandle.h.

485 { return m_handleArray.begin(); }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
std::vector::begin
T begin(T...args)
template<class T>

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

Definition at line 489 of file GaudiHandle.h.

489 { return m_handleArray.begin(); }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
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 499 of file GaudiHandle.h.

499 { m_handleArray.clear(); }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
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 501 of file GaudiHandle.h.

501 { return m_handleArray.empty(); }
std::vector::empty
T empty(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
template<class T>

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

Definition at line 487 of file GaudiHandle.h.

487 { return m_handleArray.end(); }
std::vector::end
T end(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
template<class T>

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

Definition at line 491 of file GaudiHandle.h.

491 { return m_handleArray.end(); }
std::vector::end
T end(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
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 466 of file GaudiHandle.h.

467 {
468 GaudiHandleArrayBase::BaseHandleArray baseArray;
469 iterator it = begin(), itEnd = end();
470 for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
471 return baseArray;
472 }
GaudiHandleArray::iterator
HandleVector::iterator iterator
Definition: GaudiHandle.h:427
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:485
std::vector
STL class.
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:487
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 474 of file GaudiHandle.h.

475 {
476 GaudiHandleArrayBase::ConstBaseHandleArray baseArray;
477 const_iterator it = begin(), itEnd = end();
478 for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
479 return baseArray;
480 }
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:485
GaudiHandleArray::const_iterator
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:428
std::vector
STL class.
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:487
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 460 of file GaudiHandle.h.

461 {
462 setTypesAndNames( myTypesAndNamesList );
463 return *this;
464 }
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:58
template<class T>

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

Definition at line 503 of file GaudiHandle.h.

503 { return m_handleArray[index]; }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
template<class T>

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

Definition at line 505 of file GaudiHandle.h.

505 { return m_handleArray[index]; }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
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 508 of file GaudiHandle.h.

509 {
510 auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
511 return it != end() ? &*it : nullptr;
512 }
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:426
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:485
std::find_if
T find_if(T...args)
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:487
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 515 of file GaudiHandle.h.

516 {
517 auto it = std::find_if( begin(), end(), [&]( const_reference r ) { return r.name() == name; } );
518 return it != end() ? &*it : nullptr;
519 }
GaudiHandleArray::const_reference
HandleVector::const_reference const_reference
Definition: GaudiHandle.h:426
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
GaudiHandleArray::begin
iterator begin()
Definition: GaudiHandle.h:485
std::find_if
T find_if(T...args)
GaudiHandleArray::end
iterator end()
Definition: GaudiHandle.h:487
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 524 of file GaudiHandle.h.

525 {
526 m_handleArray.push_back( myHandle );
527 return true;
528 }
std::vector::push_back
T push_back(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
template<class T>

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

Definition at line 493 of file GaudiHandle.h.

493 { return m_handleArray.rbegin(); }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
std::vector::rbegin
T rbegin(T...args)
template<class T>

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

Release all tools.

Definition at line 548 of file GaudiHandle.h.

549 {
550 StatusCode sc = StatusCode::SUCCESS;
551 for ( auto& i : *this ) {
552 // continue trying to release other tools even if we fail...
553 if ( i.release().isFailure() ) sc = StatusCode::FAILURE;
554 }
555 return sc;
556 }
StatusCode::SUCCESS
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode::FAILURE
Definition: StatusCode.h:29
template<class T>

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

Definition at line 495 of file GaudiHandle.h.

495 { return m_handleArray.rend(); }
std::vector::rend
T rend(T...args)
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
template<class T>

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

Retrieve all tools.

Definition at line 531 of file GaudiHandle.h.

532 {
533 StatusCode sc = StatusCode::SUCCESS;
534 for ( auto& i : *this ) {
535 // stop at first failure
536 if ( i.retrieve().isFailure() ) {
537 sc = StatusCode::FAILURE;
538 break;
539 }
540 }
541 if ( sc ) {
542 m_retrieved = true;
543 }
544 return sc;
545 }
StatusCode::SUCCESS
Definition: StatusCode.h:29
GaudiHandleArray::m_retrieved
bool m_retrieved
Definition: GaudiHandle.h:566
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode::FAILURE
Definition: StatusCode.h:29
template<class T>

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

has Array been retreived?

Implements GaudiHandleArrayBase.

Definition at line 559 of file GaudiHandle.h.

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

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

Definition at line 497 of file GaudiHandle.h.

497 { return m_handleArray.size(); }
GaudiHandleArray::m_handleArray
HandleVector m_handleArray
Definition: GaudiHandle.h:565
std::vector::size
T size(T...args)

## Member Data Documentation

template<class T>

HandleVector GaudiHandleArray< T >::m_handleArray
| private

Definition at line 565 of file GaudiHandle.h.

template<class T>

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

Definition at line 566 of file GaudiHandle.h.

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

- GaudiKernel/GaudiKernel/GaudiHandle.h