| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

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
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.
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.
bool setTypesAndNames (const std::vector< std::string > &myTypesAndNamesList)
 Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
const std::vector< std::string > typesAndNames () const
 Return a vector with "type/name" strings of all handles in the array.
const std::vector< std::string > types () const
 Return a vector with "type" strings of all handles in the array.
const std::vector< std::string > names () const
 Return a vector with "type/name" strings of all handles in the array.
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.
virtual const std::string pythonPropertyClassName () const
 Name of the componentType with "HandleArray" appended.
virtual const std::string pythonRepr () const
 Python representation of array of handles, i.e.
virtual bool push_back (const std::string &myHandleTypeAndName)=0
 Add a handle to the array with "type/name" given in <myHandleTypeAndName>.
const std::string & componentType () const
const std::string & propertyName () const
 name as used in declareProperty(name,gaudiHandle)
void setPropertyName (const std::string &propName)
 set name as used in declareProperty(name,gaudiHandle).
const std::string & parentName () const
 The name of the parent.

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 std::vector< T > GaudiHandleArray< T >::HandleVector

Definition at line 358 of file GaudiHandle.h.

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

Definition at line 359 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::reference GaudiHandleArray< T >::reference

Definition at line 361 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::iterator GaudiHandleArray< T >::iterator

Definition at line 363 of file GaudiHandle.h.

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

Definition at line 364 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::const_reverse_iterator GaudiHandleArray< T >::const_reverse_iterator

Definition at line 366 of file GaudiHandle.h.

typedef std::vector< GaudiHandleBase* > GaudiHandleArrayBase::BaseHandleArray [inherited]

Definition at line 299 of file GaudiHandle.h.

typedef std::vector< const GaudiHandleBase* > GaudiHandleArrayBase::ConstBaseHandleArray [inherited]

Definition at line 300 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.

00378     : GaudiHandleArrayBase(myComponentType,myParentName)
00379   {
00380     GaudiHandleArray::setTypesAndNames( myTypesAndNamesList );
00381   }

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.

00388     : GaudiHandleArrayBase(myComponentType,myParentName)
00389   {}

template<class T>
virtual GaudiHandleArray< T >::~GaudiHandleArray (  )  [inline, virtual]

Definition at line 392 of file GaudiHandle.h.

00392 {};


Member Function Documentation

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.

00395                                                                                    {
00396     setTypesAndNames( myTypesAndNamesList );
00397     return *this;
00398   }

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.

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

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.

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

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

Definition at line 417 of file GaudiHandle.h.

00417                    { 
00418     return m_handleArray.begin(); 
00419   }

template<class T>
iterator GaudiHandleArray< T >::end (  )  [inline]

Definition at line 421 of file GaudiHandle.h.

00421                  { 
00422     return m_handleArray.end(); 
00423   }

template<class T>
const_iterator GaudiHandleArray< T >::begin (  )  const [inline]

Definition at line 425 of file GaudiHandle.h.

00425                                { 
00426     return m_handleArray.begin(); 
00427   }

template<class T>
const_iterator GaudiHandleArray< T >::end (  )  const [inline]

Definition at line 429 of file GaudiHandle.h.

00429                              {
00430     return m_handleArray.end(); 
00431   }

template<class T>
const_iterator GaudiHandleArray< T >::rbegin (  )  const [inline]

Definition at line 433 of file GaudiHandle.h.

00433                                 { 
00434     return m_handleArray.rbegin(); 
00435   }

template<class T>
const_iterator GaudiHandleArray< T >::rend (  )  const [inline]

Definition at line 437 of file GaudiHandle.h.

00437                               {
00438     return m_handleArray.rend(); 
00439   }

template<class T>
size_type GaudiHandleArray< T >::size (  )  const [inline]

Definition at line 441 of file GaudiHandle.h.

00441                          { 
00442     return m_handleArray.size(); 
00443   }

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.

00445                        {
00446     m_handleArray.clear(); 
00447   }

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.

00449                              {
00450     return m_handleArray.empty();
00451   }

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

Definition at line 453 of file GaudiHandle.h.

00453                              { 
00454     return m_handleArray[index];
00455   }

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

Definition at line 457 of file GaudiHandle.h.

00457                                          {
00458     return m_handleArray[index]; 
00459   }

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.

00462                                          {
00463     iterator it = begin(), itEnd = end();
00464     for ( ; it != itEnd; ++it ) {
00465       if ( it->name() == name ) return &*it;
00466     }
00467     // not found
00468     return 0;
00469   }

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.

00472                                                      {
00473     const_iterator it = begin(), itEnd = end();
00474     for ( ; it != itEnd; ++it ) {
00475       if ( it->name() == name ) return &*it;
00476     }
00477     // not found
00478     return 0;
00479   }

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

Reimplemented in ToolHandleArray< T >.

Definition at line 484 of file GaudiHandle.h.

00484                                               {
00485     m_handleArray.push_back( myHandle );
00486     return true;
00487   }

template<class T>
StatusCode GaudiHandleArray< T >::retrieve (  )  [inline]

Retrieve all tools.

Definition at line 490 of file GaudiHandle.h.

00490                         {
00491     iterator it = begin(), itEnd = end();
00492     for ( ; it != itEnd; ++it ) {
00493       if ( it->retrieve().isFailure() ) {
00494         // stop at first failure
00495         return StatusCode::FAILURE;
00496       }
00497     }
00498     return StatusCode::SUCCESS;
00499   }

template<class T>
StatusCode GaudiHandleArray< T >::release (  )  [inline]

Release all tools.

Definition at line 502 of file GaudiHandle.h.

00502                        {
00503     StatusCode sc = StatusCode::SUCCESS;
00504     iterator it = begin(), itEnd = end();
00505     for ( ; it != itEnd; ++it ) {
00506       if ( it->release().isFailure() ) {
00507         // continue trying to release other tools
00508         sc = StatusCode::FAILURE;
00509       }
00510     }
00511     return sc;
00512   }

bool GaudiHandleArrayBase::setTypesAndNames ( const std::vector< std::string > &  myTypesAndNamesList  )  [inherited]

Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.

Return whether set was successful or not

const std::vector< std::string > GaudiHandleArrayBase::typesAndNames (  )  const [inherited]

Return a vector with "type/name" strings of all handles in the array.

Inverse of setTypesAndNames()

const std::vector< std::string > GaudiHandleArrayBase::types (  )  const [inherited]

Return a vector with "type" strings of all handles in the array.

const std::vector< std::string > GaudiHandleArrayBase::names (  )  const [inherited]

Return a vector with "type/name" strings of all handles in the array.

const std::vector< std::string > GaudiHandleArrayBase::getBaseInfos ( std::string(GaudiHandleBase::*)() const   pMemFunc  )  const [inherited]

Helper function to get a vector of strings filled with the return value of each tool of a member function if GaudiHandleBase.

virtual const std::string GaudiHandleArrayBase::pythonPropertyClassName (  )  const [virtual, inherited]

Name of the componentType with "HandleArray" appended.

Used as the python class name for the property in the genconf-generated configurables. The python class is defined in GaudiPython/python/GaudiHandles.py.

Implements GaudiHandleInfo.

virtual const std::string GaudiHandleArrayBase::pythonRepr (  )  const [virtual, inherited]

Python representation of array of handles, i.e.

list of python handles. Can be used in the genconf-generated configurables. The corresponding python classes are defined in GaudiPython/GaudiHandles.py

Implements GaudiHandleInfo.

virtual bool GaudiHandleArrayBase::push_back ( const std::string &  myHandleTypeAndName  )  [pure virtual, inherited]

Add a handle to the array with "type/name" given in <myHandleTypeAndName>.

Return whether addition was successful or not. Must be implemented by derived class with concrete handle category.

Implemented in ToolHandleArray< T >.

const std::string& GaudiHandleInfo::componentType (  )  const [inline, inherited]

Definition at line 33 of file GaudiHandle.h.

00033                                          {
00034      return m_componentType;
00035   }

const std::string& GaudiHandleInfo::propertyName (  )  const [inline, inherited]

name as used in declareProperty(name,gaudiHandle)

Definition at line 38 of file GaudiHandle.h.

00038                                         {
00039      return m_propertyName;
00040   }

void GaudiHandleInfo::setPropertyName ( const std::string &  propName  )  [inline, inherited]

set name as used in declareProperty(name,gaudiHandle).

Used in printout.

Definition at line 43 of file GaudiHandle.h.

00043                                                     {
00044     m_propertyName = propName;
00045   }

const std::string& GaudiHandleInfo::parentName (  )  const [inline, inherited]

The name of the parent.

Definition at line 48 of file GaudiHandle.h.

00048                                       {
00049     return m_parentName;
00050   }


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:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:07 2011 for GaudiKernel by doxygen 1.4.7