ATLAS Offline Software
WriteHandle< T > Class Reference

A smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc). It d-casts and caches locally the pointed-at object, to speed-up subsequent accesses. It can be reset by the store for asynchronous updates (IOVSvc). More...

#include <WriteHandle.h>

Collaboration diagram for WriteHandle< T >:

Detailed Description

A smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc). It d-casts and caches locally the pointed-at object, to speed-up subsequent accesses. It can be reset by the store for asynchronous updates (IOVSvc).

SG::WriteHandle<T> can only create new objects in StoreGate; no proxy should already exist. This handle will only return the pointer that has been recorded.

Usage example:

class MyAlg : public AthAlgorithm
{
};
MyAlg::MyAlg(...) : ..., m_int("MyIntSgKey") {
declareProperty("IntHandle",
m_int = SG::WriteHandle<int>("MyIntSgKey"),
"a handle to an int in StoreGate");
}
{
ATH_CHECK( m_int.record (std::make_unique<int>(42)) );
ATH_MSG_INFO("int value @[" << m_int.name() << "]="
<< *m_int);
*m_int += 10;
ATH_MSG_INFO("int value @[" << m_int.name() << "]="
<< *m_int);
return StatusCode::SUCCESS;
}

For more information have a look under the package Control/AthenaExamples/AthExHelloWorld


The documentation for this class was generated from the following file:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76