ATLAS Offline Software
|
Type-safe wrapper for ICollectionGetterTool
.
More...
#include <CollectionGetterTool.h>
Public Member Functions | |
CollectionGetterTool (const std::string &type, const std::string &name, const IInterface *parent) | |
Standard Gaudi tool constructor. More... | |
virtual const void * | getUntyped (bool allowMissing=false) |
Return the target object. More... | |
virtual const std::type_info & | typeinfo () const |
Return the type of the collection object retrieved by this tool. More... | |
virtual const std::type_info & | elementTypeinfo () const |
Return the element type of the collection. More... | |
virtual StatusCode | reset (bool allowMissing=false) |
Reset the iteration to the start of the collection. More... | |
virtual const void * | nextUntyped () |
Return a pointer to the next element in the collection. More... | |
virtual size_t | sizeHint (bool allowMissing=false) |
Return an estimate of the number of elements in the iteration. More... | |
virtual const CONT * | get (bool allowMissing=false)=0 |
Return the collection object. More... | |
virtual void | releaseObject (const CONT *p) |
Release an object retrieved from the getter. More... | |
virtual void | releaseObjectUntyped (const void *p) |
Release an object retrieved from the getter. More... | |
StatusCode | initialize () |
Standard Gaudi initialize method. More... | |
const void * | nextTypeinfo (const std::type_info &ti) |
Return the next object cast to a different pointer type. More... | |
StatusCode | configureElementTypeinfo (const std::type_info &ti) |
Test type compatibility. More... | |
void | releaseElementTypeinfo (const void *p, const std::type_info &ti) |
Release an element retrieved from the getter. More... | |
Private Attributes | |
CONT::const_iterator | m_it |
The current iterator. More... | |
CONT::const_iterator | m_end |
The iterator at the end of the container. More... | |
std::string | m_label |
Property: label to assign to this getter (or null). More... | |
ToolHandle< ICollectionGetterRegistryTool > | m_registry |
The collection getter registry tool. More... | |
TypeConverter | m_converter |
Helper to convert pointers. More... | |
TypeConverter | m_backConverter |
Helper to convert pointers back, for releaseElement . More... | |
Type-safe wrapper for ICollectionGetterTool
.
The template argument gives the type of the container that we're returning. This class implements the iteration over the container. If your container obeys the standard iteration protocol (for a forward_iterator
), then you just need to derive from this class and implement get()
, and optionally releaseObject()
.
Definition at line 38 of file CollectionGetterTool.h.
D3PD::CollectionGetterTool< CONT >::CollectionGetterTool | ( | const std::string & | type, |
const std::string & | name, | ||
const IInterface * | parent | ||
) |
|
inherited |
Test type compatibility.
ti | The desired type. |
Test to see if the object being returned by the tool can be converted to a pointer to T
. This can be used to perform type checks during job initialization.
Definition at line 146 of file CollectionGetterToolImpl.cxx.
|
virtual |
Return the element type of the collection.
I.e., nextUntyped
returns a pointer to this type.
|
pure virtual |
Return the collection object.
Return 0 on failure.
allowMissing | If true, then we should not generate errors if the requested object is missing. |
Implemented in D3PD::SGCollectionGetterTool< CONT >, D3PD::SGCollectionGetterTool< Obj4Container >, D3PD::SGCollectionGetterTool< TileDigitsContainer >, D3PD::SGCollectionGetterTool< CaloCalibrationHitContainer >, D3PD::SGCollectionGetterTool< TileHitVector >, D3PD::SGCollectionGetterTool< TrackRecordCollection >, D3PD::SGCollectionGetterTool< TileRawChannelContainer >, D3PD::SGCollectionGetterTool< LArHitContainer >, D3PD::SGCollectionGetterTool< INav4MomLinkContainer >, D3PD::SGCollectionGetterTool< LArRawChannelContainer >, and D3PD::SGCollectionGetterTool< IParticleLinks >.
|
virtual |
Return the target object.
allowMissing | If true, then we should not generate errors if the requested object is missing. |
Should be of the type given by typeinfo
. Return 0 on failure.
This is implemented by calling get()
.
Reimplemented in D3PD::SGCollectionGetterTool< CONT >, D3PD::SGCollectionGetterTool< Obj4Container >, D3PD::SGCollectionGetterTool< TileDigitsContainer >, D3PD::SGCollectionGetterTool< CaloCalibrationHitContainer >, D3PD::SGCollectionGetterTool< TileHitVector >, D3PD::SGCollectionGetterTool< TrackRecordCollection >, D3PD::SGCollectionGetterTool< TileRawChannelContainer >, D3PD::SGCollectionGetterTool< LArHitContainer >, D3PD::SGCollectionGetterTool< INav4MomLinkContainer >, D3PD::SGCollectionGetterTool< LArRawChannelContainer >, and D3PD::SGCollectionGetterTool< IParticleLinks >.
|
inherited |
Return the next object cast to a different pointer type.
Return the next element from the collection as a pointer to the ti
type. Return 0 if the pointer can't be converted or at the end of the iteration.
Definition at line 68 of file CollectionGetterToolImpl.cxx.
|
virtual |
Return a pointer to the next element in the collection.
Return 0 when the collection has been exhausted.
Reimplemented in D3PD::SGTileDigitsGetterTool, D3PD::SGTileHitGetterTool, D3PD::SGTileModuleBitsGetterTool, and D3PD::SGTileRawChannelGetterTool.
|
inherited |
Release an element retrieved from the getter.
p | The element to release. |
ti | The type of p. |
Call this when you are done with the element returned by nextUntyped()
. The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.
Definition at line 104 of file CollectionGetterToolImpl.cxx.
|
virtual |
Release an object retrieved from the getter.
p | The object to release. |
Call this when you are done with the object returned by get()
. The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.
|
virtual |
Release an object retrieved from the getter.
p | The object to release. |
Call this when you are done with the object returned by getUntyped()
. The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.
|
virtual |
Reset the iteration to the start of the collection.
allowMissing | If true, then we should not generate errors if the requested object is missing. |
Return failure if the container cannot be retrieved.
Reimplemented in D3PD::SGTileDigitsGetterTool, D3PD::SGTileHitGetterTool, D3PD::SGTileModuleBitsGetterTool, and D3PD::SGTileRawChannelGetterTool.
|
virtual |
Return an estimate of the number of elements in the iteration.
allowMissing | If true, then we should not generate errors if the requested object is missing. |
This can be used to pre-allocate memory. (It's possible that this isn't known in advance of iterating over the entire collection, for example if a selection is being applied, so this is only a hint.)
Reimplemented in D3PD::SGTileDigitsGetterTool, D3PD::SGTileHitGetterTool, D3PD::SGTileModuleBitsGetterTool, and D3PD::SGTileRawChannelGetterTool.
|
virtual |
Return the type of the collection object retrieved by this tool.
Reimplemented in D3PD::SGCollectionGetterTool< CONT >, D3PD::SGCollectionGetterTool< Obj4Container >, D3PD::SGCollectionGetterTool< TileDigitsContainer >, D3PD::SGCollectionGetterTool< CaloCalibrationHitContainer >, D3PD::SGCollectionGetterTool< TileHitVector >, D3PD::SGCollectionGetterTool< TrackRecordCollection >, D3PD::SGCollectionGetterTool< TileRawChannelContainer >, D3PD::SGCollectionGetterTool< LArHitContainer >, D3PD::SGCollectionGetterTool< INav4MomLinkContainer >, D3PD::SGCollectionGetterTool< LArRawChannelContainer >, and D3PD::SGCollectionGetterTool< IParticleLinks >.
|
privateinherited |
Helper to convert pointers back, for releaseElement
.
Definition at line 106 of file CollectionGetterToolImpl.h.
|
privateinherited |
Helper to convert pointers.
Definition at line 103 of file CollectionGetterToolImpl.h.
|
private |
The iterator at the end of the container.
Definition at line 148 of file CollectionGetterTool.h.
|
private |
The current iterator.
Definition at line 145 of file CollectionGetterTool.h.
|
privateinherited |
Property: label to assign to this getter (or null).
Definition at line 97 of file CollectionGetterToolImpl.h.
|
privateinherited |
The collection getter registry tool.
Definition at line 100 of file CollectionGetterToolImpl.h.