ATLAS Offline Software
|
Common object getter code for retrieving from StoreGate. More...
#include <SGGetterImpl.h>
Inherits D3PD::IObjGetterTool.
Inherited by D3PD::SGCollectionGetterTool< CONT >, D3PD::SGDataVectorGetterTool, D3PD::SGObjGetterTool, D3PD::SGCollectionGetterTool< CaloCalibrationHitContainer >, D3PD::SGCollectionGetterTool< INav4MomLinkContainer >, D3PD::SGCollectionGetterTool< IParticleLinks >, D3PD::SGCollectionGetterTool< LArHitContainer >, D3PD::SGCollectionGetterTool< LArRawChannelContainer >, D3PD::SGCollectionGetterTool< Obj4Container >, D3PD::SGCollectionGetterTool< TileDigitsContainer >, D3PD::SGCollectionGetterTool< TileHitVector >, D3PD::SGCollectionGetterTool< TileRawChannelContainer >, and D3PD::SGCollectionGetterTool< TrackRecordCollection >.
Public Member Functions | |
SGGetterImpl (const std::string &name, ServiceHandle< StoreGateSvc > &sg) | |
Constructor. 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... | |
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 Attributes | |
CLID | m_clid |
CLID for the object being retrieved. More... | |
ServiceHandle< StoreGateSvc > & | m_sg |
The event storage service. More... | |
Common object getter code for retrieving from StoreGate.
This class fulfills part of the IObjGetterTool
interface, fetching an object from StoreGate. It's structured as a mixin class, so it can be used both for single-object and container getter tools.
This class uses a few properties, but since it's a mixin (and doesn't derive from AlgTool
) it can't declare the properties itself. Instead, it defines the macro SGGETTERIMPL_PROPS
, which should be used in the constructor of the derived AlgTool
class. You should also call initializeImpl()
from initialize()
.
The object being retrieved is specified by the properties TypeName
and SGKey
. SGKey may be a comma or space-separated list; the first entry that's actually present in the event store will be used. In addition, the property ClassIDSvc
may be used to specify the instance of this service.
Definition at line 50 of file SGGetterImpl.h.
D3PD::SGGetterImpl::SGGetterImpl | ( | const std::string & | name, |
ServiceHandle< StoreGateSvc > & | sg | ||
) |
Constructor.
name | Name of this tool. |
sg | The event storage service. |
Definition at line 26 of file SGGetterImpl.cxx.
CLID D3PD::SGGetterImpl::clid | ( | ) | const |
Return the class ID being read by this tool.
Definition at line 54 of file SGGetterImpl.cxx.
|
inherited |
|
pure virtualinherited |
|
inherited |
Gaudi interface definition.
|
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()
.
|
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.
|
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.
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.
|
protected |
Initialize this mixin class.
Call this from initialize
.
Definition at line 105 of file SGGetterImpl.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 |
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 |
CLID for the object being retrieved.
Definition at line 126 of file SGGetterImpl.h.
|
protected |
Property: Instance of the ClassIDSvc to use.
Definition at line 119 of file SGGetterImpl.h.
|
protected |
Helper: Resolve the SG key to use.
Definition at line 122 of file SGGetterImpl.h.
|
private |
The event storage service.
Definition at line 129 of file SGGetterImpl.h.
|
protected |
Property: StoreGate key of the object being retrieved.
Definition at line 116 of file SGGetterImpl.h.
|
protected |
Property: Name of the type of the object being retrieved.
Definition at line 113 of file SGGetterImpl.h.