All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiHandleArray< T > Class Template Reference

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

#include <GaudiKernel/GaudiHandle.h>

Inheritance diagram for GaudiHandleArray< T >:
Collaboration diagram for GaudiHandleArray< T >:

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 ()
 
GaudiHandleArrayoperator= (const std::vector< std::string > &myTypesAndNamesList)
 Set the array of GaudiHandles from typeAndNames given in vector of strings. More...
 
virtual
GaudiHandleArrayBase::BaseHandleArray 
getBaseArray ()
 Get a read-write vector of GaudiHandleBase* pointing to the real handles. More...
 
virtual
GaudiHandleArrayBase::ConstBaseHandleArray 
getBaseArray () const
 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
 
virtual void clear ()
 Clear the list of handles. More...
 
virtual bool empty () const
 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...
 
- 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...
 
virtual const std::string pythonPropertyClassName () const
 Name of the componentType with "HandleArray" appended. More...
 
virtual const std::string pythonRepr () const
 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 ()
 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 (const 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, const std::string &myComponentType, const 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 (const std::string &myComponentType, const std::string &myParentName)
 
- Protected Member Functions inherited from GaudiHandleInfo
 GaudiHandleInfo (const std::string &myComponentType, const std::string &myParentName)
 Some basic information and helper functions shared between various handles/arrays. More...
 

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 
)
inlineprotected

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.

378  : GaudiHandleArrayBase(myComponentType,myParentName)
379  {
380  setTypesAndNames( myTypesAndNamesList );
381  }
GaudiHandleArrayBase(const std::string &myComponentType, const std::string &myParentName)
Definition: GaudiHandle.h:295
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>
GaudiHandleArray< T >::GaudiHandleArray ( const std::string &  myComponentType,
const std::string &  myParentName 
)
inlineprotected

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.

388  : GaudiHandleArrayBase(myComponentType,myParentName)
389  {}
GaudiHandleArrayBase(const std::string &myComponentType, const std::string &myParentName)
Definition: GaudiHandle.h:295
template<class T>
virtual GaudiHandleArray< T >::~GaudiHandleArray ( )
inlinevirtual

Definition at line 392 of file GaudiHandle.h.

392 {};

Member Function Documentation

template<class T>
iterator GaudiHandleArray< T >::begin ( )
inline

Definition at line 417 of file GaudiHandle.h.

417  {
418  return m_handleArray.begin();
419  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
const_iterator GaudiHandleArray< T >::begin ( ) const
inline

Definition at line 425 of file GaudiHandle.h.

425  {
426  return m_handleArray.begin();
427  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
virtual void GaudiHandleArray< T >::clear ( )
inlinevirtual

Clear the list of handles.

Implemented in GaudiHandleArray

Implements GaudiHandleArrayBase.

Definition at line 445 of file GaudiHandle.h.

445  {
446  m_handleArray.clear();
447  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
virtual bool GaudiHandleArray< T >::empty ( ) const
inlinevirtual

Return whether the list of tools is empty.

Implements GaudiHandleArrayBase.

Definition at line 449 of file GaudiHandle.h.

449  {
450  return m_handleArray.empty();
451  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
iterator GaudiHandleArray< T >::end ( )
inline

Definition at line 421 of file GaudiHandle.h.

421  {
422  return m_handleArray.end();
423  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
const_iterator GaudiHandleArray< T >::end ( ) const
inline

Definition at line 429 of file GaudiHandle.h.

429  {
430  return m_handleArray.end();
431  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
virtual GaudiHandleArrayBase::BaseHandleArray GaudiHandleArray< T >::getBaseArray ( )
inlinevirtual

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.

400  {
402  iterator it = begin(), itEnd = end();
403  for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
404  return baseArray;
405  }
HandleVector::iterator iterator
Definition: GaudiHandle.h:363
std::vector< GaudiHandleBase * > BaseHandleArray
Definition: GaudiHandle.h:299
iterator begin()
Definition: GaudiHandle.h:417
iterator end()
Definition: GaudiHandle.h:421
template<class T>
virtual GaudiHandleArrayBase::ConstBaseHandleArray GaudiHandleArray< T >::getBaseArray ( ) const
inlinevirtual

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.

407  {
409  const_iterator it = begin(), itEnd = end();
410  for ( ; it != itEnd; ++it ) baseArray.push_back( &*it );
411  return baseArray;
412  }
std::vector< const GaudiHandleBase * > ConstBaseHandleArray
Definition: GaudiHandle.h:300
iterator begin()
Definition: GaudiHandle.h:417
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:364
iterator end()
Definition: GaudiHandle.h:421
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.

395  {
396  setTypesAndNames( myTypesAndNamesList );
397  return *this;
398  }
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 453 of file GaudiHandle.h.

453  {
454  return m_handleArray[index];
455  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
const T& GaudiHandleArray< T >::operator[] ( int  index) const
inline

Definition at line 457 of file GaudiHandle.h.

457  {
458  return m_handleArray[index];
459  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
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.

462  {
463  iterator it = begin(), itEnd = end();
464  for ( ; it != itEnd; ++it ) {
465  if ( it->name() == name ) return &*it;
466  }
467  // not found
468  return 0;
469  }
HandleVector::iterator iterator
Definition: GaudiHandle.h:363
iterator begin()
Definition: GaudiHandle.h:417
iterator end()
Definition: GaudiHandle.h:421
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.

472  {
473  const_iterator it = begin(), itEnd = end();
474  for ( ; it != itEnd; ++it ) {
475  if ( it->name() == name ) return &*it;
476  }
477  // not found
478  return 0;
479  }
iterator begin()
Definition: GaudiHandle.h:417
HandleVector::const_iterator const_iterator
Definition: GaudiHandle.h:364
iterator end()
Definition: GaudiHandle.h:421
template<class T>
virtual bool GaudiHandleArray< T >::push_back ( const T &  myHandle)
inlinevirtual

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

Definition at line 484 of file GaudiHandle.h.

484  {
485  m_handleArray.push_back( myHandle );
486  return true;
487  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
const_iterator GaudiHandleArray< T >::rbegin ( ) const
inline

Definition at line 433 of file GaudiHandle.h.

433  {
434  return m_handleArray.rbegin();
435  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
StatusCode GaudiHandleArray< T >::release ( )
inline

Release all tools.

Definition at line 502 of file GaudiHandle.h.

502  {
504  iterator it = begin(), itEnd = end();
505  for ( ; it != itEnd; ++it ) {
506  if ( it->release().isFailure() ) {
507  // continue trying to release other tools
508  sc = StatusCode::FAILURE;
509  }
510  }
511  return sc;
512  }
HandleVector::iterator iterator
Definition: GaudiHandle.h:363
iterator begin()
Definition: GaudiHandle.h:417
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator end()
Definition: GaudiHandle.h:421
template<class T>
const_iterator GaudiHandleArray< T >::rend ( ) const
inline

Definition at line 437 of file GaudiHandle.h.

437  {
438  return m_handleArray.rend();
439  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518
template<class T>
StatusCode GaudiHandleArray< T >::retrieve ( )
inline

Retrieve all tools.

Definition at line 490 of file GaudiHandle.h.

490  {
491  iterator it = begin(), itEnd = end();
492  for ( ; it != itEnd; ++it ) {
493  if ( it->retrieve().isFailure() ) {
494  // stop at first failure
495  return StatusCode::FAILURE;
496  }
497  }
498  return StatusCode::SUCCESS;
499  }
HandleVector::iterator iterator
Definition: GaudiHandle.h:363
iterator begin()
Definition: GaudiHandle.h:417
iterator end()
Definition: GaudiHandle.h:421
template<class T>
size_type GaudiHandleArray< T >::size ( ) const
inline

Definition at line 441 of file GaudiHandle.h.

441  {
442  return m_handleArray.size();
443  }
HandleVector m_handleArray
Definition: GaudiHandle.h:518

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: