ATLAS Offline Software
|
Getter tool to retrieve DataVector/List collections from StoreGate. More...
#include <SGDataVectorGetterTool.h>
Public Member Functions | |
SGDataVectorGetterTool (const std::string &type, const std::string &name, const IInterface *parent) | |
Standard Gaudi tool constructor. More... | |
virtual StatusCode | initialize () |
Standard Gaudi initialize method. More... | |
virtual StatusCode | finalize () |
Standard Gaudi finalize method. 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 std::type_info & | typeinfo () const |
Return the type of object retrieved by this tool. More... | |
CLID | clid () const |
Return the class ID being read by this tool. More... | |
virtual const void * | getUntyped (bool allowMissing=false) |
Return the target object. More... | |
DeclareInterfaceID (IObjGetterTool, 1, 0) | |
Gaudi interface definition. More... | |
template<class T > | |
const T * | get (bool allowMissing=false) |
Type-safe wrapper for get . More... | |
virtual void | releaseObjectUntyped (const void *p) |
Release an object retrieved from the getter. More... | |
template<class T > | |
void | releaseObject (const T *p) |
Type-safe wrapper for releaseObjectUntyped . More... | |
template<class T > | |
StatusCode | configureD3PD () |
Test type compatibility. More... | |
virtual const void * | getTypeinfo (const std::type_info &ti, bool allowMissing=false)=0 |
Return the target object cast to a different pointer type. More... | |
void | releaseObjectTypeinfo (const void *p, const std::type_info &ti) |
Release an object retrieved from the getter. More... | |
virtual StatusCode | configureTypeinfo (const std::type_info &ti)=0 |
Test type compatibility. 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... | |
Protected Member Functions | |
StatusCode | initializeImpl () |
Initialize this mixin class. More... | |
Protected Attributes | |
std::string | m_typename |
Property: Name of the type of the object being retrieved. More... | |
std::string | m_sgkey |
Property: StoreGate key of the object being retrieved. More... | |
ServiceHandle< IClassIDSvc > | m_clidsvc |
Property: Instance of the ClassIDSvc to use. More... | |
SGKeyResolver | m_resolver |
Helper: Resolve the SG key to use. More... | |
Private Member Functions | |
const DataModel_detail::DVLInfoBase * | getInfo (const std::type_info &ti) |
Retrieve DataVector/List information for this collection. More... | |
Private Attributes | |
ServiceHandle< IAthenaPoolCnvSvc > | m_athenaPoolCnvSvc |
Used to auto-load converters, if needed. More... | |
const DataModel_detail::DVLInfoBase * | m_info |
DataVector/List information for this collection. More... | |
DataModel_detail::DVLIteratorBase * | m_it |
Current iterator over the collection. More... | |
TypeConverter | m_converter |
Converter from the pointer that we get from StoreGate to a pointer to the collection over which we iterate (which may be a base of what we get from SG). More... | |
CLID | m_clid |
CLID for the object being retrieved. More... | |
ServiceHandle< StoreGateSvc > & | m_sg |
The event storage service. 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_backConverter |
Helper to convert pointers back, for releaseElement . More... | |
Getter tool to retrieve DataVector/List collections from StoreGate.
This is a Getter tool that retrieves a collection of objects from StoreGate. This class handles DataVector
and DataList
collections. (Collections deriving from these may also be used, provided that proper SG_BASE
macros were used.)
Properties: TypeName - Name of the type of the object being retrieved. SGKey - StoreGate key of the object being retrieved. Can also be a comma or space-separated list. In that case, the first key that actually exists in the data store will be used. ClassIDSvc - ClassIDSvc instance to use.
Definition at line 53 of file SGDataVectorGetterTool.h.
D3PD::SGDataVectorGetterTool::SGDataVectorGetterTool | ( | const std::string & | type, |
const std::string & | name, | ||
const IInterface * | parent | ||
) |
Standard Gaudi tool constructor.
type | The name of the tool type. |
name | The tool name. |
parent | The tool's Gaudi parent. |
Definition at line 29 of file SGDataVectorGetterTool.cxx.
|
inherited |
Return the class ID being read by this tool.
Definition at line 54 of file SGGetterImpl.cxx.
|
inherited |
|
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.
|
pure virtualinherited |
|
inherited |
Gaudi interface definition.
|
virtual |
Return the element type of the collection.
I.e., nextUntyped
returns a pointer to this type.
Definition at line 119 of file SGDataVectorGetterTool.cxx.
|
virtual |
Standard Gaudi finalize
method.
Definition at line 106 of file SGDataVectorGetterTool.cxx.
|
inherited |
Type-safe wrapper for get
.
allowMissing | If true, then we should not generate errors if the requested object is missing. |
Return the object as a pointer to T
. Return 0 if the get fails or if the pointer can't be converted.
This is implemented in terms of getTypeinfo()
.
|
private |
Retrieve DataVector/List information for this collection.
ti | Type that we get from SG. |
Definition at line 199 of file SGDataVectorGetterTool.cxx.
|
pure virtualinherited |
Return the target object cast to a different pointer type.
ti | The desired type. |
allowMissing | If true, then we should not generate errors if the requested object is missing. |
Return the object as a pointer to the ti
type. Return 0 if the get fails or if the pointer can't be converted.
|
virtualinherited |
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.
Implements D3PD::IObjGetterTool.
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 >.
Definition at line 68 of file SGGetterImpl.cxx.
|
virtual |
|
protectedinherited |
Initialize this mixin class.
Call this from initialize
.
Definition at line 105 of file SGGetterImpl.cxx.
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.
Definition at line 167 of file SGDataVectorGetterTool.cxx.
|
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.
|
inherited |
Type-safe wrapper for releaseObjectUntyped
.
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.
This is implemented in terms of releaseObjectTypeinfo()
.
|
inherited |
Release an object retrieved from the getter.
p | The object to release. |
ti | The type of p. |
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.
|
virtualinherited |
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.
Definition at line 132 of file SGDataVectorGetterTool.cxx.
|
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.)
Definition at line 185 of file SGDataVectorGetterTool.cxx.
|
virtualinherited |
Return the type of object retrieved by this tool.
Implements D3PD::IObjGetterTool.
Reimplemented in D3PD::SGCollectionGetterTool< CONT >, D3PD::SGTileDigitsGetterTool, D3PD::SGTileHitGetterTool, D3PD::SGTileModuleBitsGetterTool, and D3PD::SGTileRawChannelGetterTool.
Definition at line 39 of file SGGetterImpl.cxx.
|
private |
Used to auto-load converters, if needed.
Definition at line 117 of file SGDataVectorGetterTool.h.
|
privateinherited |
Helper to convert pointers back, for releaseElement
.
Definition at line 106 of file CollectionGetterToolImpl.h.
|
privateinherited |
CLID for the object being retrieved.
Definition at line 126 of file SGGetterImpl.h.
|
protectedinherited |
Property: Instance of the ClassIDSvc to use.
Definition at line 119 of file SGGetterImpl.h.
|
private |
Converter from the pointer that we get from StoreGate to a pointer to the collection over which we iterate (which may be a base of what we get from SG).
Definition at line 131 of file SGDataVectorGetterTool.h.
|
private |
DataVector/List information for this collection.
Definition at line 123 of file SGDataVectorGetterTool.h.
|
private |
Current iterator over the collection.
Definition at line 126 of file SGDataVectorGetterTool.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.
|
protectedinherited |
Helper: Resolve the SG key to use.
Definition at line 122 of file SGGetterImpl.h.
|
privateinherited |
The event storage service.
Definition at line 129 of file SGGetterImpl.h.
|
protectedinherited |
Property: StoreGate key of the object being retrieved.
Definition at line 116 of file SGGetterImpl.h.
|
protectedinherited |
Property: Name of the type of the object being retrieved.
Definition at line 113 of file SGGetterImpl.h.