#include <GaudiKernel/ToolHandle.h>
Inheritance diagram for ToolHandleArray< T >:
Public Types | |
typedef std::vector< ToolHandle< 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 | |
ToolHandleArray (const std::vector< std::string > &myTypesAndNames, const IInterface *parent=0, bool createIf=true) | |
Generic constructor. | |
ToolHandleArray (const IInterface *parent=0, bool createIf=true) | |
Constructor which creates and empty list. | |
virtual bool | push_back (const std::string &toolTypeAndName) |
Add a handle to the array with given tool type and name. | |
virtual bool | push_back (const ToolHandle< T > &myHandle) |
Ensure that for added handles the parent and creatIf are taken from this array. | |
bool | isPublic () const |
bool | createIf () const |
const IInterface * | parent () const |
const std::string | toolComponentType (const IInterface *parent) const |
const std::string | toolParentName (const IInterface *parent) const |
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 () |
const_iterator | begin () const |
iterator | end () |
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. | |
ToolHandle< T > & | operator[] (int index) |
const ToolHandle< T > & | operator[] (int index) const |
ToolHandle< T > * | operator[] (const std::string &name) |
Get pointer (!) to ToolHandle by instance name. | |
const ToolHandle< T > * | operator[] (const std::string &name) const |
Get const pointer (!) to ToolHandle by instance name. | |
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. | |
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. |
This allows better control through the framework of tool loading and usage. T is the AlgTool interface class (or concrete class) of the tool to use, and must derive from IAlgTool.
Definition at line 160 of file ToolHandle.h.
typedef std::vector< ToolHandle< T > > GaudiHandleArray< ToolHandle< T > >::HandleVector [inherited] |
Definition at line 358 of file GaudiHandle.h.
typedef HandleVector::value_type GaudiHandleArray< ToolHandle< T > >::value_type [inherited] |
Definition at line 359 of file GaudiHandle.h.
typedef HandleVector::size_type GaudiHandleArray< ToolHandle< T > >::size_type [inherited] |
Definition at line 360 of file GaudiHandle.h.
typedef HandleVector::reference GaudiHandleArray< ToolHandle< T > >::reference [inherited] |
Definition at line 361 of file GaudiHandle.h.
typedef HandleVector::const_reference GaudiHandleArray< ToolHandle< T > >::const_reference [inherited] |
Definition at line 362 of file GaudiHandle.h.
typedef HandleVector::iterator GaudiHandleArray< ToolHandle< T > >::iterator [inherited] |
Definition at line 363 of file GaudiHandle.h.
typedef HandleVector::const_iterator GaudiHandleArray< ToolHandle< T > >::const_iterator [inherited] |
Definition at line 364 of file GaudiHandle.h.
typedef HandleVector::reverse_iterator GaudiHandleArray< ToolHandle< T > >::reverse_iterator [inherited] |
Definition at line 365 of file GaudiHandle.h.
typedef HandleVector::const_reverse_iterator GaudiHandleArray< ToolHandle< T > >::const_reverse_iterator [inherited] |
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.
ToolHandleArray< T >::ToolHandleArray | ( | const std::vector< std::string > & | myTypesAndNames, | |
const IInterface * | parent = 0 , |
|||
bool | createIf = true | |||
) | [inline] |
Generic constructor.
Probably not very useful...
typesAndNamesList | : a vector of strings with the concrete "type/name" strings for the list of tools | |
parent | : passed on to ToolHandle, so has the same meaning as for ToolHandle | |
createIf | : passed on to ToolHandle, so has the same meaning as for ToolHandle |
Definition at line 171 of file ToolHandle.h.
00173 : ToolHandleInfo( parent, createIf ), 00174 GaudiHandleArray< ToolHandle<T> >( myTypesAndNames, 00175 ToolHandleInfo::toolComponentType(parent), 00176 ToolHandleInfo::toolParentName(parent) ) 00177 {}
ToolHandleArray< T >::ToolHandleArray | ( | const IInterface * | parent = 0 , |
|
bool | createIf = true | |||
) | [inline] |
Constructor which creates and empty list.
parent | : passed on to ToolHandle, so has the same meaning as for ToolHandle | |
createIf | : passed on to ToolHandle, so has the same meaning as for ToolHandle |
Definition at line 183 of file ToolHandle.h.
00184 : ToolHandleInfo( parent, createIf ), 00185 GaudiHandleArray< ToolHandle<T> >( ToolHandleInfo::toolComponentType(parent), 00186 ToolHandleInfo::toolParentName(parent) ) 00187 { }
virtual bool ToolHandleArray< T >::push_back | ( | const std::string & | toolTypeAndName | ) | [inline, virtual] |
Add a handle to the array with given tool type and name.
This function overrides the one in GaudiHandleArray<T>, as this is a special case. The private/public choice and createIf is determined by what was given in the constructor of the ToolHandleArray.
Implements GaudiHandleArrayBase.
Definition at line 193 of file ToolHandle.h.
00193 { 00194 ToolHandle<T> handle( toolTypeAndName, 00195 ToolHandleInfo::parent(), 00196 ToolHandleInfo::createIf() ); 00197 GaudiHandleArray< ToolHandle<T> >::push_back( handle ); 00198 return true; 00199 }
virtual bool ToolHandleArray< T >::push_back | ( | const ToolHandle< T > & | myHandle | ) | [inline, virtual] |
Ensure that for added handles the parent and creatIf are taken from this array.
Reimplemented from GaudiHandleArray< ToolHandle< T > >.
Definition at line 202 of file ToolHandle.h.
00202 { 00203 return push_back( myHandle.typeAndName() ); 00204 }
bool ToolHandleInfo::isPublic | ( | ) | const [inline, inherited] |
bool ToolHandleInfo::createIf | ( | ) | const [inline, inherited] |
const IInterface* ToolHandleInfo::parent | ( | ) | const [inline, inherited] |
const std::string ToolHandleInfo::toolComponentType | ( | const IInterface * | parent | ) | const [inline, inherited] |
Definition at line 44 of file ToolHandle.h.
00044 { 00045 return parent ? "PrivateTool" : "PublicTool"; 00046 }
const std::string ToolHandleInfo::toolParentName | ( | const IInterface * | parent | ) | const [inline, inherited] |
Definition at line 48 of file ToolHandle.h.
00048 { 00049 if (parent) { 00050 const INamedInterface* pNamed = dynamic_cast<const INamedInterface*>(parent); 00051 if (pNamed) { 00052 return pNamed->name(); 00053 } else { 00054 return ""; 00055 } 00056 } else { 00057 return "ToolSvc"; 00058 } 00059 }
virtual GaudiHandleArrayBase::BaseHandleArray GaudiHandleArray< ToolHandle< T > >::getBaseArray | ( | ) | [inline, virtual, inherited] |
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 }
virtual GaudiHandleArrayBase::ConstBaseHandleArray GaudiHandleArray< ToolHandle< T > >::getBaseArray | ( | ) | const [inline, virtual, inherited] |
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 }
iterator GaudiHandleArray< ToolHandle< T > >::begin | ( | ) | [inline, inherited] |
const_iterator GaudiHandleArray< ToolHandle< T > >::begin | ( | ) | const [inline, inherited] |
iterator GaudiHandleArray< ToolHandle< T > >::end | ( | ) | [inline, inherited] |
const_iterator GaudiHandleArray< ToolHandle< T > >::end | ( | ) | const [inline, inherited] |
const_iterator GaudiHandleArray< ToolHandle< T > >::rbegin | ( | ) | const [inline, inherited] |
const_iterator GaudiHandleArray< ToolHandle< T > >::rend | ( | ) | const [inline, inherited] |
size_type GaudiHandleArray< ToolHandle< T > >::size | ( | ) | const [inline, inherited] |
virtual void GaudiHandleArray< ToolHandle< T > >::clear | ( | ) | [inline, virtual, inherited] |
Clear the list of handles.
Implemented in GaudiHandleArray
Implements GaudiHandleArrayBase.
Definition at line 445 of file GaudiHandle.h.
00445 { 00446 m_handleArray.clear(); 00447 }
virtual bool GaudiHandleArray< ToolHandle< T > >::empty | ( | ) | const [inline, virtual, inherited] |
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 }
ToolHandle< T > & GaudiHandleArray< ToolHandle< T > >::operator[] | ( | int | index | ) | [inline, inherited] |
const ToolHandle< T > & GaudiHandleArray< ToolHandle< T > >::operator[] | ( | int | index | ) | const [inline, inherited] |
ToolHandle< T > * GaudiHandleArray< ToolHandle< T > >::operator[] | ( | const std::string & | name | ) | [inline, inherited] |
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 }
const ToolHandle< T > * GaudiHandleArray< ToolHandle< T > >::operator[] | ( | const std::string & | name | ) | const [inline, inherited] |
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 }
StatusCode GaudiHandleArray< ToolHandle< T > >::retrieve | ( | ) | [inline, inherited] |
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 }
StatusCode GaudiHandleArray< ToolHandle< T > >::release | ( | ) | [inline, inherited] |
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.
const std::string& GaudiHandleInfo::componentType | ( | ) | const [inline, inherited] |
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 }