|
ATLAS Offline Software
|
Getter tool to retrieve single objects from StoreGate.
More...
#include <SGObjGetterTool.h>
Getter tool to retrieve single objects from StoreGate.
This is a Getter tool that retrieves a single object from StoreGate, given the type name and SG key. This class should be able to handle any type that can be put into StoreGate.
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 46 of file SGObjGetterTool.h.
◆ SGObjGetterTool()
D3PD::SGObjGetterTool::SGObjGetterTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Standard Gaudi tool constructor.
- Parameters
-
type | The name of the tool type. |
name | The tool name. |
parent | The tool's Gaudi parent. |
Definition at line 28 of file SGObjGetterTool.cxx.
◆ clid()
CLID D3PD::SGGetterImpl::clid |
( |
| ) |
const |
|
inherited |
Return the class ID being read by this tool.
Definition at line 54 of file SGGetterImpl.cxx.
◆ configureD3PD()
template<class T >
StatusCode D3PD::IObjGetterTool::configureD3PD |
( |
| ) |
|
|
inherited |
Test type compatibility.
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.
This is implemented in terms of configureTypeinfo
.
◆ configureTypeinfo() [1/2]
StatusCode D3PD::ObjGetterToolImpl::configureTypeinfo |
( |
const std::type_info & |
ti | ) |
|
|
virtualinherited |
Test type compatibility.
- Parameters
-
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 124 of file ObjGetterToolImpl.cxx.
◆ configureTypeinfo() [2/2]
virtual StatusCode D3PD::IObjGetterTool::configureTypeinfo |
( |
const std::type_info & |
ti | ) |
|
|
pure virtualinherited |
Test type compatibility.
- Parameters
-
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.
◆ DeclareInterfaceID()
Gaudi interface definition.
◆ get()
template<class T >
const T* D3PD::IObjGetterTool::get |
( |
bool |
allowMissing = false | ) |
|
|
inherited |
Type-safe wrapper for get
.
- Parameters
-
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()
.
◆ getTypeinfo() [1/2]
const void * D3PD::ObjGetterToolImpl::getTypeinfo |
( |
const std::type_info & |
ti, |
|
|
bool |
allowMissing = false |
|
) |
| |
|
virtualinherited |
Return the target object cast to a different pointer type.
- Parameters
-
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.
Definition at line 45 of file ObjGetterToolImpl.cxx.
50 this->m_converter.dstTypeinfo() != ti)
57 const void*
p = this->getUntyped (allowMissing);
◆ getTypeinfo() [2/2]
virtual const void* D3PD::IObjGetterTool::getTypeinfo |
( |
const std::type_info & |
ti, |
|
|
bool |
allowMissing = false |
|
) |
| |
|
pure virtualinherited |
Return the target object cast to a different pointer type.
- Parameters
-
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.
◆ getUntyped()
const void * D3PD::SGGetterImpl::getUntyped |
( |
bool |
allowMissing = false | ) |
|
|
virtualinherited |
Return the target object.
- Parameters
-
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.
◆ initialize()
StatusCode D3PD::SGObjGetterTool::initialize |
( |
| ) |
|
|
virtual |
◆ initializeImpl()
StatusCode D3PD::SGGetterImpl::initializeImpl |
( |
| ) |
|
|
protectedinherited |
Initialize this mixin class.
Call this from initialize
.
Definition at line 105 of file SGGetterImpl.cxx.
113 return StatusCode::SUCCESS;
◆ releaseObject()
template<class T >
void D3PD::IObjGetterTool::releaseObject |
( |
const T * |
p | ) |
|
|
inherited |
Type-safe wrapper for releaseObjectUntyped
.
- Parameters
-
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()
.
◆ releaseObjectTypeinfo() [1/2]
void D3PD::ObjGetterToolImpl::releaseObjectTypeinfo |
( |
const void * |
p, |
|
|
const std::type_info & |
ti |
|
) |
| |
|
inherited |
Release an object retrieved from the getter.
- Parameters
-
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.
Definition at line 82 of file ObjGetterToolImpl.cxx.
90 this->m_backConverter.srcTypeinfo() != ti)
94 <<
"Can't configure pointer conversion from "
95 << System::typeinfoName (ti) <<
" to "
96 << System::typeinfoName (this->typeinfo());
106 this->releaseObjectUntyped (
p);
◆ releaseObjectTypeinfo() [2/2]
void D3PD::IObjGetterTool::releaseObjectTypeinfo |
( |
const void * |
p, |
|
|
const std::type_info & |
ti |
|
) |
| |
|
inherited |
Release an object retrieved from the getter.
- Parameters
-
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.
◆ releaseObjectUntyped()
virtual void D3PD::IObjGetterTool::releaseObjectUntyped |
( |
const void * |
p | ) |
|
|
virtualinherited |
Release an object retrieved from the getter.
- Parameters
-
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.
◆ typeinfo()
const std::type_info & D3PD::SGGetterImpl::typeinfo |
( |
| ) |
const |
|
virtualinherited |
◆ m_backConverter
◆ m_clid
CLID D3PD::SGGetterImpl::m_clid |
|
privateinherited |
◆ m_clidsvc
◆ m_converter
◆ m_resolver
◆ m_sg
◆ m_sgkey
std::string D3PD::SGGetterImpl::m_sgkey |
|
protectedinherited |
◆ m_typename
std::string D3PD::SGGetterImpl::m_typename |
|
protectedinherited |
The documentation for this class was generated from the following files:
std::string dstName() const
Return the name of the destination type, or an empty string.
StatusCode initialize(CLID clid, const std::string &typname)
Initialize.
StatusCode init(const std::type_info &src_ti, const std::type_info &dst_ti)
Initialize the converter.
std::string srcName() const
Return the name of the source type, or an empty string.
const void * convertUntyped(const void *p) const
Convert pointer.
StatusCode nameToCLID(const std::string &name, CLID &clid, const std::string &context, ServiceHandle< IClassIDSvc > clidsvc=ServiceHandle< IClassIDSvc >("ClassIDSvc", "TypeNameConversions"))
Convert from a class name to a CLID.
#define CHECK(...)
Evaluate an expression and check for errors.
SGGetterImpl(const std::string &name, ServiceHandle< StoreGateSvc > &sg)
Constructor.
StatusCode clidToTypeinfo(CLID clid, const std::string &nmae, std::type_info const *&ti, const std::string &context)
Convert from a CLID to a type_info; we also already know the name.
CLID m_clid
CLID for the object being retrieved.
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
std::string key()
Return the SG key we should use.
bool isValid() const
Test to see if this converter has been properly initialized.
#define REPORT_MESSAGE(LVL)
Report a message.
#define SGGETTERIMPL_PROPS
Use this macro in the constructor of the derived AlgTool class.
std::string m_typename
Property: Name of the type of the object being retrieved.
SGKeyResolver m_resolver
Helper: Resolve the SG key to use.
ServiceHandle< IClassIDSvc > m_clidsvc
Property: Instance of the ClassIDSvc to use.
Interface for const operations on an auxiliary store.
ServiceHandle< StoreGateSvc > & m_sg
The event storage service.
StatusCode initializeImpl()
Initialize this mixin class.