| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Types | Public Member Functions | Protected Member Functions | Private Attributes

# GaudiHandleArray< T > Class Template Reference

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

`#include <GaudiHandle.h>`

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

List of all members.

## 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 Member Functions
virtual | ~GaudiHandleArray ()
GaudiHandleArray & | operator= (const std::vector< std::string > &myTypesAndNamesList)
| Set the array of GaudiHandles from typeAndNames given in vector of strings.
virtual GaudiHandleArrayBase::BaseHandleArray | getBaseArray ()
| Get a read-write vector of GaudiHandleBase* pointing to the real handles.
virtual GaudiHandleArrayBase::ConstBaseHandleArray | getBaseArray () const
| Get a read-only vector of const GaudiHandleBase* pointing to the real handles.
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
const_iterator | rbegin () const
const_iterator | rend () const
size_type | size () const
virtual void | clear ()
| Clear the list of handles.
virtual bool | empty () const
| Return whether the list of tools is empty.
T & | operator[] (int index)
const T & | operator[] (int index) const
T * | operator[] (const std::string &name)
| Get pointer (!) to ToolHandle by instance name.
const T * | operator[] (const std::string &name) const
| Get const pointer (!) to ToolHandle by instance name.
virtual bool | push_back (const T &myHandle)
StatusCode | retrieve ()
| Retrieve all tools.
StatusCode | release ()
| Release all tools.
## Protected Member Functions
| GaudiHandleArray (const std::vector< std::string > &myTypesAndNamesList, const std::string &myComponentType, const std::string &myParentName)
| Generic constructor.
| GaudiHandleArray (const std::string &myComponentType, const std::string &myParentName)
| Constructor creating an empty array.
## Private Attributes
HandleVector | m_handleArray

## Detailed Description

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

T is the concrete handle type, e.g.

ToolHandle<IMyTool>

Definition at line 353 of file GaudiHandle.h.

## Member Typedef Documentation

template<class T>

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

Definition at line 364 of file GaudiHandle.h.

template<class T>

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

Definition at line 362 of file GaudiHandle.h.

template<class T>

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

Definition at line 366 of file GaudiHandle.h.

template<class T>

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

Definition at line 358 of file GaudiHandle.h.

template<class T>

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

Definition at line 363 of file GaudiHandle.h.

template<class T>

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

Definition at line 361 of file GaudiHandle.h.

template<class T>

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

Definition at line 365 of file GaudiHandle.h.

template<class T>

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

Definition at line 360 of file GaudiHandle.h.

template<class T>

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

Definition at line 359 of file GaudiHandle.h.

## Constructor & Destructor Documentation

template<class T>

GaudiHandleArray< T >::GaudiHandleArray | ( | const std::vector< std::string > & | myTypesAndNamesList,
|  | const std::string & | myComponentType,
|  | const 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 376 of file GaudiHandle.h.

        : GaudiHandleArrayBase(myComponentType,myParentName)
      {
        setTypesAndNames( myTypesAndNamesList );
      }

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 387 of file GaudiHandle.h.

        : GaudiHandleArrayBase(myComponentType,myParentName)
      {}

template<class T>

virtual GaudiHandleArray< T >::~GaudiHandleArray | ( | ) | `[inline, virtual]`

Definition at line 392 of file GaudiHandle.h.

    {};

## Member Function Documentation

template<class T>

iterator GaudiHandleArray< T >::begin | ( | void | ) | `[inline]`

Definition at line 417 of file GaudiHandle.h.

                       {
        return m_handleArray.begin();
      }

template<class T>

const_iterator GaudiHandleArray< T >::begin | ( | void | ) | const`[inline]`

Definition at line 425 of file GaudiHandle.h.

                                   {
        return m_handleArray.begin();
      }

template<class T>

virtual void GaudiHandleArray< T >::clear | ( | ) | `[inline, virtual]`

Clear the list of handles.

Implemented in GaudiHandleArray

Implements GaudiHandleArrayBase.

Definition at line 445 of file GaudiHandle.h.

                           {
        m_handleArray.clear();
      }

template<class T>

virtual bool GaudiHandleArray< T >::empty | ( | ) | const`[inline, virtual]`

Return whether the list of tools is empty.

Implements GaudiHandleArrayBase.

Definition at line 449 of file GaudiHandle.h.

                                 {
        return m_handleArray.empty();
      }

template<class T>

iterator GaudiHandleArray< T >::end | ( | void | ) | `[inline]`

Definition at line 421 of file GaudiHandle.h.

                     {
        return m_handleArray.end();
      }

template<class T>

const_iterator GaudiHandleArray< T >::end | ( | void | ) | const`[inline]`

Definition at line 429 of file GaudiHandle.h.

                                 {
        return m_handleArray.end();
      }

template<class T>

virtual GaudiHandleArrayBase::BaseHandleArray GaudiHandleArray< T >::getBaseArray | ( | ) | `[inline, virtual]`

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

Implemented in GaudiHandleArray.

Implements GaudiHandleArrayBase.

Definition at line 400 of file GaudiHandle.h.

                                                                 {
        GaudiHandleArrayBase::BaseHandleArray baseArray;
        iterator it = begin(), itEnd = end();
        for (  ; it != itEnd; ++it ) baseArray.push_back( &*it );
        return baseArray;
      }

template<class T>

virtual GaudiHandleArrayBase::ConstBaseHandleArray GaudiHandleArray< T >::getBaseArray | ( | ) | const`[inline, virtual]`

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

Implemented in GaudiHandleArray.

Implements GaudiHandleArrayBase.

Definition at line 407 of file GaudiHandle.h.

                                                                            {
        GaudiHandleArrayBase::ConstBaseHandleArray baseArray;
        const_iterator it = begin(), itEnd = end();
        for (  ; it != itEnd; ++it ) baseArray.push_back( &*it );
        return baseArray;
      }

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 395 of file GaudiHandle.h.

                                                                                       {
        setTypesAndNames( myTypesAndNamesList );
        return *this;
      }

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 472 of file GaudiHandle.h.

                                                         {
        const_iterator it = begin(), itEnd = end();
        for ( ; it != itEnd; ++it ) {
          if ( it->name() == name ) return &*it;
        }
        // not found
        return 0;
      }

template<class T>

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

Definition at line 453 of file GaudiHandle.h.

                                 {
        return m_handleArray[index];
      }

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 462 of file GaudiHandle.h.

                                             {
        iterator it = begin(), itEnd = end();
        for ( ; it != itEnd; ++it ) {
          if ( it->name() == name ) return &*it;
        }
        // not found
        return 0;
      }

template<class T>

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

Definition at line 457 of file GaudiHandle.h.

                                             {
        return m_handleArray[index];
      }

template<class T>

virtual bool GaudiHandleArray< T >::push_back | ( | const T & | myHandle ) | `[inline, virtual]`

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

Definition at line 484 of file GaudiHandle.h.

                                                  {
        m_handleArray.push_back( myHandle );
        return true;
      }

template<class T>

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

Definition at line 433 of file GaudiHandle.h.

                                    {
        return m_handleArray.rbegin();
      }

template<class T>

StatusCode GaudiHandleArray< T >::release | ( | ) | `[inline]`

Release all tools.

Definition at line 502 of file GaudiHandle.h.

                           {
        StatusCode sc = StatusCode::SUCCESS;
        iterator it = begin(), itEnd = end();
        for ( ; it != itEnd; ++it ) {
          if ( it->release().isFailure() ) {
            // continue trying to release other tools
            sc = StatusCode::FAILURE;
          }
        }
        return sc;
      }

template<class T>

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

Definition at line 437 of file GaudiHandle.h.

                                  {
        return m_handleArray.rend();
      }

template<class T>

StatusCode GaudiHandleArray< T >::retrieve | ( | ) | `[inline]`

Retrieve all tools.

Definition at line 490 of file GaudiHandle.h.

                            {
        iterator it = begin(), itEnd = end();
        for ( ; it != itEnd; ++it ) {
          if ( it->retrieve().isFailure() ) {
            // stop at first failure
            return StatusCode::FAILURE;
          }
        }
        return StatusCode::SUCCESS;
      }

template<class T>

size_type GaudiHandleArray< T >::size | ( | void | ) | const`[inline]`

Definition at line 441 of file GaudiHandle.h.

                             {
        return m_handleArray.size();
      }

## Member Data Documentation

template<class T>

HandleVector GaudiHandleArray< T >::m_handleArray`[private]`

Definition at line 518 of file GaudiHandle.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiKernel/GaudiKernel/GaudiHandle.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines