ATLAS Offline Software
Loading...
Searching...
No Matches
WriteHandle< T > Class Reference

A smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc). 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");
}
StatusCode MyAlg::execute()
{
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;
}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
Base class from which all concrete Athena algorithm classes should be derived.

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


The documentation for this class was generated from the following file: