Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
SG::VarHandleBase Class Referenceabstract

Base class for VarHandle types. More...

#include <VarHandleBase.h>

Inherits IResetable.

Inherited by SG::ReadHandle< AthenaHitsVector< LArG4H6FrontHit > >, SG::ReadHandle< DataVector >, SG::ReadHandle< LArHitContainer >, SG::ReadHandle< LVL1::jTowerContainer >, SG::ReadHandle< McEventCollection >, SG::ReadHandle< MyDataObj >, SG::ReadHandle< PixelGangedClusterAmbiguities >, SG::ReadHandle< SpacePointContainer >, SG::ReadHandle< SpacePointOverlapCollection >, SG::ReadHandle< T_Cont >, SG::ReadHandle< TBEventInfo >, SG::ReadHandle< Trk::PRDtoTrackMap >, SG::ReadHandle< VxContainer >, SG::ReadHandle< xAOD::TruthParticleContainer >, SG::ReadHandle< T >, SG::TypelessWriteHandle, SG::UpdateHandle< T >, SG::WriteHandle< T >, SG::WriteHandle< AthenaHitsVector >, SG::WriteHandle< AtlasHitsVector >, SG::WriteHandle< CaloCalibrationHitContainer >, SG::WriteHandle< CaloCellContainer >, SG::WriteHandle< DataVector >, SG::WriteHandle< HGTD_RDO_Container >, SG::WriteHandle< HijingEventParams >, SG::WriteHandle< HitContainerType >, SG::WriteHandle< InDetRawDataContainer >, SG::WriteHandle< InDetSimDataCollection >, SG::WriteHandle< LArHitContainer >, SG::WriteHandle< McEventCollection >, SG::WriteHandle< Muon::MuonPrepDataContainer >, SG::WriteHandle< SG::ThinningDecision >, SG::WriteHandle< TBEventInfo >, SG::WriteHandle< TBTrack >, SG::WriteHandle< TrigRoiDescriptorCollection >, SG::WriteHandle< xAOD::VertexAuxContainer_v1 >, and SG::WriteHandle< ZDC_SimFiberHit_Collection >.

Collaboration diagram for SG::VarHandleBase:

Public Member Functions

 VarHandleBase (CLID clid, Gaudi::DataHandle::Mode mode)
 Constructor with default key. More...
 
 VarHandleBase (CLID clid, const std::string &sgkey, Gaudi::DataHandle::Mode mode, const std::string &storename, const EventContext *ctx)
 Constructor with full arguments. More...
 
 VarHandleBase (const VarHandleKey &key, const EventContext *ctx)
 Constructor from a VarHandleKey. More...
 
 VarHandleBase (SG::DataProxy *proxy, Gaudi::DataHandle::Mode mode)
 Constructor from a DataProxy. More...
 
 VarHandleBase (const VarHandleBase &rhs)
 Copy constructor. More...
 
 VarHandleBase (VarHandleBase &&rhs) noexcept
 Move constructor. More...
 
VarHandleBaseoperator= (const VarHandleBase &rhs)
 Assignment operator. More...
 
VarHandleBaseoperator= (VarHandleBase &&rhs) noexcept
 Move operator. More...
 
virtual ~VarHandleBase () override
 Destructor. More...
 
virtual const std::string & key () const override final
 Return the StoreGate ID for the referenced object. More...
 
const std::string & name () const
 Return the StoreGate ID for the referenced object. More...
 
std::string store () const
 Return the name of the store holding the object we are proxying. More...
 
virtual bool isValid ()=0
 Can the handle be successfully dereferenced? More...
 
bool isPresent () const
 Is the referenced object present in SG? More...
 
bool isInitialized () const
 Has a proxy been retrieved from SG? More...
 
virtual bool isSet () const override final
 Has a proxy been retrieved from SG? More...
 
bool isConst () const
 True if this handle has a proxy, and the proxy is const. More...
 
StatusCode initialize (bool used=true)
 Verify that the handle has been configured properly. More...
 
StatusCode setState ()
 Retrieve and cache all information managed by a handle. More...
 
virtual StatusCode setProxyDict (IProxyDict *store)
 Explicitly set the event store. More...
 
virtual void reset (bool hard) override
 Reset this handle. More...
 
virtual void finalReset () override final
 Reset this handle at the end of processing. More...
 
StatusCode setConst ()
 Set the 'const' bit for the bound proxy in the store. More...
 
CLID clid () const
 Return the class ID for the referenced object. More...
 
const ServiceHandle< IProxyDict > & storeHandle () const
 Return handle to the referenced store. More...
 
Gaudi::DataHandle::Mode mode () const
 Return the mode (read/write/update) for this handle. More...
 
const std::string & objKey () const
 Return the key string of the underlying DataObjID. More...
 
const DataObjID & fullKey () const
 Return the key as a DataObjID. More...
 
SG::VarHandleKeyvhKey ()
 Return a non-const reference to the HandleKey. More...
 
StatusCode assign (const std::string &sgkey)
 Update the underlying key from a string. More...
 

Protected Member Functions

StatusCode setState (SG::DataProxy *proxy)
 Set the state of the handle to a given proxy. More...
 
StatusCode setState (IProxyDict *store, const std::string &name)
 Set the state of a handle from a store and a key name. More...
 
StatusCode record_impl (std::unique_ptr< DataObject > dobj, void *dataPtr, bool allowMods, bool returnExisting)
 Helper to record an object in the event store. More...
 
const void * put_impl (const EventContext *ctx, std::unique_ptr< DataObject > dobj, const void *dataPtr, bool allowMods, bool returnExisting, IProxyDict *&store) const
 Helper to record an object in the event store. More...
 
void * typeless_dataPointer_impl (bool quiet)
 Retrieve an object from StoreGate. More...
 
void * typeless_dataPointer (bool quiet=defaultQuiet)
 Retrieve an object from StoreGate. More...
 
const void * typeless_cptr ()
 Retrieve an object from StoreGate as a const pointer. More...
 
void * typeless_ptr (bool quiet=defaultQuiet)
 Retrieve an object from StoreGate as non-const pointer. More...
 
const void * get_impl (const EventContext *ctx, bool quiet=defaultQuiet) const
 
StatusCode symLink_impl (CLID newClid, const std::string &newKey)
 Make a symlink or alias to the object currently referenced by this handle. More...
 
bool isPresent_impl (const std::string &key) const
 Is the referenced object present in SG? More...
 

Protected Attributes

void * m_ptr
 The object to which we are bound. More...
 
SG::DataProxym_proxy
 Proxy holding the object to which we are bound. More...
 
IProxyDictm_store
 Pointer to the store that owns the object. More...
 
bool m_storeWasSet
 True if the store was set explicitly via setProxyDict. More...
 

Private Member Functions

IProxyDictstoreFromHandle (const EventContext *ctx) const
 Return the store instance to use. More...
 
bool setStoreFromHandle (const EventContext *ctx)
 Initialize the store pointer from the store handle. More...
 
void resetProxy ()
 Clear the m_proxy field and release the old proxy. More...
 
void setProxy (SG::DataProxy *proxy)
 Set a new proxy. More...
 
void * typeless_dataPointer_fromProxy (SG::DataProxy *proxy, bool quiet) const
 Retrieve a pointer from a proxy. More...
 

Private Attributes

std::unique_ptr< VarHandleKeym_ownedKey
 An owned VarHandleKey. More...
 
const VarHandleKeym_key
 The associated key object. More...
 

Friends

void Athena_test::varHandleTest (SGTest::TestStore &)
 
void Athena_test::resetableTest (void)
 
void Athena_test::refCountTest (void)
 
std::ostream & operator<< (std::ostream &, const VarHandleBase &)
 Output stream. More...
 

Detailed Description

Base class for VarHandle types.

This is the base class for smart pointer types used to access objects in an IProxyDict (such as a StoreGateSvc). The handle types ReadHandle, WriteHandle, and UpdateHandle derive from this; see those classes for usage information.

This class references a VarHandleKey, which holds the CLID of the class we're referencing (which gets passed to the constructor of this class from the templated derived classes), the StoreGate key of the object we're referencing, and a handle to the event store. The key object can be passed to this object via the constructor; otherwise, we create and own a new VarHandleKey object.

In this class, we keep a pointer to the actual event store being used (may be thread-dependent), a pointer to the DataProxy for the referenced object, and a cached pointer to the object itself.

A handle object may be used as a algorithm/tool property directly. Because the handle caches state, however, this means that the component using it cannot be reentrant. In such a case, the handle will be reset when the current algorithm completes. In this case, the handle will be bound to the proxy.

The preferred way of using handles is to use a HandleKey object (one of ReadHandleKey<T>, WriteHandleKey<T>, UpdateHandleKey<T>) as the property, and to create a handle instance on the stack from the key object (and the event context, if available). In this case, the handle will not be bound to the proxy. A handle created in this way should not live beyond the end of the algorithm in which it was created.

Definition at line 82 of file StoreGate/StoreGate/VarHandleBase.h.

Constructor & Destructor Documentation

◆ VarHandleBase() [1/6]

SG::VarHandleBase::VarHandleBase ( CLID  clid,
Gaudi::DataHandle::Mode  mode 
)
explicit

Constructor with default key.

Parameters
clidCLID of the referenced class.
modeMode of this handle (read/write/update).

Definition at line 113 of file StoreGate/src/VarHandleBase.cxx.

113  :
114  IResetable(),
115  m_ptr(0),
116  m_proxy(0),
117  m_store(nullptr),
118  m_storeWasSet(false),
119  m_ownedKey (std::make_unique<VarHandleKey> (clid, "", mode)),
120  m_key (m_ownedKey.get())
121  {
122  m_ownedKey->setOwningHandle (this);
123 #ifdef DEBUG_VHB
124  dbg::print(stderr, "VarHandleBase() {}\n", dbg::ptr(this));
125 #endif
126  }

◆ VarHandleBase() [2/6]

SG::VarHandleBase::VarHandleBase ( CLID  clid,
const std::string &  sgkey,
Gaudi::DataHandle::Mode  mode,
const std::string &  storename,
const EventContext *  ctx 
)
explicit

Constructor with full arguments.

Parameters
clidCLID of the referenced class.
sgkeyStoreGate key of the referenced object.
modeMode of this handle (read/write/update).
storenameName of the referenced event store.
ctxThe event context to use, or nullptr.

Definition at line 137 of file StoreGate/src/VarHandleBase.cxx.

141  :
142  IResetable(),
143  m_ptr(NULL),
144  m_proxy(NULL),
145  m_store(nullptr),
146  m_storeWasSet(false),
147  m_ownedKey (std::make_unique<VarHandleKey> (clid, sgkey, mode, storename)),
148  m_key (m_ownedKey.get())
149  {
150  m_ownedKey->setOwningHandle (this);
151 
152  if (ctx && !setStoreFromHandle(ctx)) {
153  throw SG::ExcHandleInitError (clid, sgkey, storename);
154  }
155  }

◆ VarHandleBase() [3/6]

SG::VarHandleBase::VarHandleBase ( const VarHandleKey key,
const EventContext *  ctx 
)
explicit

Constructor from a VarHandleKey.

Parameters
keyThe key object holding the clid/key/store.
ctxThe event context to use, or nullptr.

This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.

If the default event store has been requested, then the thread-specific store from ctx will be used. If ctx is null, then the current event context will be read.

Parameters
keyThe key object holding the clid/key/store.
ctxThe event context to use, or nullptr.

This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.

Definition at line 45 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.

47  : m_key (&key)
48  {
49  }

◆ VarHandleBase() [4/6]

SG::VarHandleBase::VarHandleBase ( SG::DataProxy proxy,
Gaudi::DataHandle::Mode  mode 
)
explicit

Constructor from a DataProxy.

Parameters
proxyThe proxy to which to bind.
modeMode of this handle (read/write/update).

This handle will be bound to the given proxy.

Definition at line 194 of file StoreGate/src/VarHandleBase.cxx.

196  : IResetable(),
197  m_ptr (nullptr),
198  m_proxy (nullptr),
199  m_store (proxy->store()),
200  m_storeWasSet (true),
201  m_ownedKey (std::make_unique<VarHandleKey> (proxy->clID(),
202  proxy->name(),
203  mode,
204  m_store ? m_store->name() : "")),
205  m_key (m_ownedKey.get())
206  {
207  m_ownedKey->setOwningHandle (this);
208  setProxy (proxy);
209  }

◆ VarHandleBase() [5/6]

SG::VarHandleBase::VarHandleBase ( const VarHandleBase rhs)

Copy constructor.

Definition at line 215 of file StoreGate/src/VarHandleBase.cxx.

215  :
216  IResetable(),
217  m_ptr(rhs.m_ptr),
218  m_proxy(nullptr),
219  m_store(rhs.m_store),
220  m_storeWasSet(rhs.m_storeWasSet)
221  {
222  if (rhs.m_ownedKey) {
223  m_ownedKey = std::make_unique<VarHandleKey> (*rhs.m_ownedKey);
224  m_ownedKey->setOwningHandle (this);
225  m_key = m_ownedKey.get();
226  }
227  else {
228  m_key = rhs.m_key;
229  }
230 #ifdef DEBUG_VHB
231  dbg::print(stderr, "::VHB::copy constr from {} to {} with proxy={} => {}, key={}, store={}\n", dbg::ptr(&rhs), dbg::ptr(this), dbg::proxy(this->m_proxy), dbg::proxy(rhs.m_proxy), this->key(), dbg::store(this->m_store));
232 #endif
233 
234  setProxy (rhs.m_proxy);
235  }

◆ VarHandleBase() [6/6]

SG::VarHandleBase::VarHandleBase ( VarHandleBase &&  rhs)
noexcept

Move constructor.

Definition at line 241 of file StoreGate/src/VarHandleBase.cxx.

241  :
242  IResetable(),
243  m_ptr(rhs.m_ptr),
244  m_proxy(nullptr),
245  m_store(rhs.m_store),
246  m_storeWasSet(rhs.m_storeWasSet),
247  m_ownedKey (std::move (rhs.m_ownedKey)),
248  m_key (rhs.m_key)
249  {
250  if (m_ownedKey) {
251  m_ownedKey->setOwningHandle (this);
252  }
253  rhs.m_ptr=0;
254 
255  if (rhs.m_proxy) {
256  if (m_ownedKey) {
257  rhs.m_proxy->unbindHandle (&rhs);
258  rhs.m_proxy->bindHandle(this);
259  }
260  m_proxy = rhs.m_proxy;
261  rhs.m_proxy=0; //no release: this has the ref now
262  }
263 #ifdef DEBUG_VHB
264  dbg::print(stderr, "::VHB::move constr from {} to {} with proxy={}, key={}, store={}\n", dbg::ptr(&rhs), dbg::ptr(this), dbg::proxy(this->m_proxy), this->key(), dbg::store(this->m_store));
265 #endif
266  }

◆ ~VarHandleBase()

SG::VarHandleBase::~VarHandleBase ( )
overridevirtual

Destructor.

Definition at line 337 of file StoreGate/src/VarHandleBase.cxx.

338  {
339 #ifdef DEBUG_VHB
340  dbg::print(stderr, "::VHB:: DESTROY {} with ptr={}, proxy={}, key={}, store={}\n", dbg::ptr(this), dbg::ptr(this->m_ptr), dbg::proxy(this->m_proxy), this->key(), dbg::store(this->m_store));
341 #endif
342 
343  if (m_ownedKey) {
344  resetProxy();
345  }
346  m_ptr = 0;
347  }

Member Function Documentation

◆ assign()

StatusCode SG::VarHandleBase::assign ( const std::string &  sgkey)

Update the underlying key from a string.

If this handle was initialized from a HandleKey, then this doesn't work (since the HandleKey is const). ExcNonConstHandleKey will be thrown in that case.

See VarHandleKey::assign.

Definition at line 648 of file StoreGate/src/VarHandleBase.cxx.

649  {
650  return vhKey().assign (sgkey);
651  }

◆ clid()

CLID SG::VarHandleBase::clid ( ) const

Return the class ID for the referenced object.

◆ finalReset()

void SG::VarHandleBase::finalReset ( )
finaloverridevirtual

Reset this handle at the end of processing.

hard If true, anything depending on the event store is cleared.

Same as reset(true);

Reimplemented from IResetable.

Definition at line 601 of file StoreGate/src/VarHandleBase.cxx.

601  {
602 #ifdef DEBUG_VHB
603  dbg::print(stderr, "::VHB::finalReset {} with proxy={}, key={}, store={}\n", dbg::ptr(this), dbg::proxy(m_proxy), this->key(), dbg::store(this->m_store));
604 #endif
605  reset (true);
606  }

◆ fullKey()

const DataObjID& SG::VarHandleBase::fullKey ( ) const

Return the key as a DataObjID.

◆ get_impl()

const void * SG::VarHandleBase::get_impl ( const EventContext *  ctx,
bool  quiet = defaultQuiet 
) const
protected

Definition at line 882 of file StoreGate/src/VarHandleBase.cxx.

884  {
885  if (this->mode() != Gaudi::DataHandle::Reader) {
886  if (!quiet)
887  REPORT_ERROR (StatusCode::FAILURE)
888  << "get_impl called for a non-read handle.";
889  return nullptr;
890  }
891 
892  if (this->key().empty()) {
893  if (!quiet)
894  REPORT_ERROR (StatusCode::FAILURE)
895  << "Cannot initialize a Read/Write/Update handle with a null key.";
896  return nullptr;
897  }
898 
900  if (!store) {
901  if (!quiet)
902  REPORT_ERROR (StatusCode::FAILURE) << "No store.";
903  return nullptr;
904  }
905 
906  SG::DataProxy* proxy = store->proxy_exact(m_key->hashedKey());
907  if (!proxy) {
908  proxy = store->proxy(this->clid(), this->key());
909  if (!proxy) {
910  if (!quiet)
911  REPORT_ERROR (StatusCode::FAILURE)
912  << "Cannot find proxy for "
913  << this->clid() << "/" << this->key();
914  return nullptr;
915  }
916  }
917 
918  return typeless_dataPointer_fromProxy (proxy, quiet);
919  }

◆ initialize()

StatusCode SG::VarHandleBase::initialize ( bool  used = true)

Verify that the handle has been configured properly.

Parameters
usedIf false, then this handle is not to be used. Instead of normal initialization, the key will be cleared.

This will return failure if the key is blank or if the event store cannot be found.

Definition at line 458 of file StoreGate/src/VarHandleBase.cxx.

459  {
460  if (!used) {
461  if (m_ownedKey) {
462  CHECK( m_ownedKey->initialize (used) );
463  }
464  return StatusCode::SUCCESS;
465  }
466 
467  if (!m_store) {
468  if (m_ownedKey) {
469  CHECK( m_ownedKey->initialize() );
470  }
471  m_store = &*(this->storeHandle());
472  m_storeWasSet = false;
473  }
474 
475  if (!m_store) {
476  return StatusCode::FAILURE;
477  }
478 
479  return StatusCode::SUCCESS;
480  }

◆ isConst()

bool SG::VarHandleBase::isConst ( ) const

True if this handle has a proxy, and the proxy is const.

Refers to the state of the proxy, not of the handle.

Definition at line 438 of file StoreGate/src/VarHandleBase.cxx.

439  {
440 #ifdef DEBUG_VHB
441  dbg::print(stderr, "::VHB::isConst({}, proxy={}) const\n", dbg::ptr(this), dbg::proxy(m_proxy));
442 #endif
443  return 0 != m_proxy
444  ? m_proxy->isConst()
445  : false;
446  }

◆ isInitialized()

bool SG::VarHandleBase::isInitialized ( ) const

Has a proxy been retrieved from SG?

(Weaker test than isValid, but does not touch the disk.)

Definition at line 412 of file StoreGate/src/VarHandleBase.cxx.

413  {
414 #ifdef DEBUG_VHB
415  dbg::print(stderr, "::VHB::isInitialized({}, proxy={}) const\n", dbg::ptr(this), dbg::proxy(m_proxy));
416 #endif
417  return (0 != m_proxy);
418  }

◆ isPresent()

bool SG::VarHandleBase::isPresent ( ) const

Is the referenced object present in SG?

Const method; the handle does not change as a result of this.

Definition at line 400 of file StoreGate/src/VarHandleBase.cxx.

401  {
402  return isPresent_impl (key());
403  }

◆ isPresent_impl()

bool SG::VarHandleBase::isPresent_impl ( const std::string &  key) const
protected

Is the referenced object present in SG?

Parameters
keySG key to test.

Const method; the handle does not change as a result of this.

Definition at line 1107 of file StoreGate/src/VarHandleBase.cxx.

1108  {
1109  const DataProxy* proxy = m_proxy;
1110  if (!proxy) {
1111  const IProxyDict* store = m_store;
1112  if (!store)
1113  store = this->storeHandle().get();
1114  if (store)
1115  proxy = store->proxy(this->clid(), key);
1116  }
1117  if (proxy) {
1118  return proxy->isValid();
1119  }
1120  return false;
1121  }

◆ isSet()

bool SG::VarHandleBase::isSet ( ) const
finaloverridevirtual

Has a proxy been retrieved from SG?

Same as isInitialized; this is an interface required by IResetable.

Implements IResetable.

Definition at line 426 of file StoreGate/src/VarHandleBase.cxx.

427  {
428  return isInitialized();
429  }

◆ isValid()

virtual bool SG::VarHandleBase::isValid ( )
pure virtual

Can the handle be successfully dereferenced?

Non-const method; the handle may cache information as a result of this.

Implemented in SG::UpdateHandle< T >, SG::WriteHandle< T >, SG::WriteHandle< McEventCollection >, SG::WriteHandle< HijingEventParams >, SG::WriteHandle< InDetSimDataCollection >, SG::WriteHandle< Muon::MuonPrepDataContainer >, SG::WriteHandle< HGTD_RDO_Container >, SG::WriteHandle< TrigRoiDescriptorCollection >, SG::WriteHandle< HitContainerType >, SG::WriteHandle< SG::ThinningDecision >, SG::WriteHandle< DataVector >, SG::WriteHandle< xAOD::VertexAuxContainer_v1 >, SG::WriteHandle< CaloCellContainer >, SG::WriteHandle< CaloCalibrationHitContainer >, SG::WriteHandle< AtlasHitsVector >, SG::WriteHandle< InDetRawDataContainer >, SG::WriteHandle< AthenaHitsVector >, SG::WriteHandle< TBTrack >, SG::WriteHandle< TBEventInfo >, SG::WriteHandle< ZDC_SimFiberHit_Collection >, SG::WriteHandle< LArHitContainer >, SG::ReadHandle< T >, SG::ReadHandle< McEventCollection >, SG::ReadHandle< SpacePointOverlapCollection >, SG::ReadHandle< AthenaHitsVector< LArG4H6FrontHit > >, SG::ReadHandle< PixelGangedClusterAmbiguities >, SG::ReadHandle< DataVector >, SG::ReadHandle< Trk::PRDtoTrackMap >, SG::ReadHandle< xAOD::TruthParticleContainer >, SG::ReadHandle< LVL1::jTowerContainer >, SG::ReadHandle< VxContainer >, SG::ReadHandle< MyDataObj >, SG::ReadHandle< TBEventInfo >, SG::ReadHandle< SpacePointContainer >, SG::ReadHandle< T_Cont >, SG::ReadHandle< LArHitContainer >, and SG::TypelessWriteHandle.

◆ key()

const std::string & SG::VarHandleBase::key ( ) const
finaloverridevirtual

Return the StoreGate ID for the referenced object.

This is defined in VarHandleKey. We need to redefine it here because it's also in IResetable. (Otherwise there would be an ambiguity.)

Implements IResetable.

Definition at line 64 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.

65  {
66  return m_key->key();
67  }

◆ mode()

Gaudi::DataHandle::Mode SG::VarHandleBase::mode ( ) const

Return the mode (read/write/update) for this handle.

◆ name()

const std::string & SG::VarHandleBase::name ( ) const

Return the StoreGate ID for the referenced object.

A synonym for key().

Definition at line 75 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.

76  {
77  return this->key();
78  }

◆ objKey()

const std::string& SG::VarHandleBase::objKey ( ) const

Return the key string of the underlying DataObjID.

Compared to key(), this will be prefixed with the store name.

◆ operator=() [1/2]

VarHandleBase & SG::VarHandleBase::operator= ( const VarHandleBase rhs)

Assignment operator.

Definition at line 273 of file StoreGate/src/VarHandleBase.cxx.

274  {
275  if (this != &rhs) {
276  if (rhs.m_ownedKey) {
277  m_ownedKey = std::make_unique<VarHandleKey> (*rhs.m_ownedKey);
278  m_ownedKey->setOwningHandle (this);
279  m_key = m_ownedKey.get();
280  }
281  else {
282  m_key = rhs.m_key;
283  m_ownedKey.reset();
284  }
285 
286  m_ptr = rhs.m_ptr;
287  m_store = rhs.m_store;
288  m_storeWasSet = rhs.m_storeWasSet;
289  setProxy (rhs.m_proxy);
290  }
291 #ifdef DEBUG_VHB
292  dbg::print(stderr, "::VHB::assignment from {} to {} with proxy={}, key={}, store={}\n", dbg::ptr(&rhs), dbg::ptr(this), dbg::proxy(this->m_proxy), this->key(), dbg::store(this->m_store));
293 #endif
294  return *this;
295  }

◆ operator=() [2/2]

VarHandleBase & SG::VarHandleBase::operator= ( VarHandleBase &&  rhs)
noexcept

Move operator.

Definition at line 302 of file StoreGate/src/VarHandleBase.cxx.

303  {
304  if (this != &rhs) {
305  m_ownedKey = std::move (rhs.m_ownedKey);
306  if (m_ownedKey) {
307  m_ownedKey->setOwningHandle (this);
308  }
309  m_key = rhs.m_key;
310 
311  m_ptr = rhs.m_ptr;
312  m_store = rhs.m_store;
313  m_storeWasSet = rhs.m_storeWasSet;
314 
315  rhs.m_ptr=0;
316 
317  resetProxy();
318  if (rhs.m_proxy) {
319  if (m_ownedKey) {
320  rhs.m_proxy->unbindHandle (&rhs);
321  rhs.m_proxy->bindHandle (this);
322  }
323  m_proxy = rhs.m_proxy;
324  rhs.m_proxy=0; //no release: this has the ref now
325  }
326  }
327 #ifdef DEBUG_VHB
328  dbg::print(stderr, "::VHB:: move assign from {} to {} with proxy={}, key={}, store={}\n", dbg::ptr(&rhs), dbg::ptr(this), dbg::proxy(this->m_proxy), this->key(), dbg::store(this->m_store));
329 #endif
330  return *this;
331  }

◆ put_impl()

const void * SG::VarHandleBase::put_impl ( const EventContext *  ctx,
std::unique_ptr< DataObject >  dobj,
const void *  dataPtr,
bool  allowMods,
bool  returnExisting,
IProxyDict *&  store 
) const
protected

Helper to record an object in the event store.

Unlike record, put does not change the handle and does not cache the pointer in the handle.

Parameters
ctxThe event context, or nullptr to use the current context.
dobjThe wrapped data object (DataBucket) to record.
dataPtrPointer to the transient object itself.
allowModsIf false, record the object as const.
returnExistingAllow an existing object.
[out]storeThe store being used.

Returns the object placed in the store, or nullptr if there was an error. If there was already an object in the store with the given key, then return null, unless returnExisting is true, in which case return success. In either case, dobj is destroyed.

Definition at line 788 of file StoreGate/src/VarHandleBase.cxx.

794  {
795  if (this->name().empty()) {
796  REPORT_ERROR (StatusCode::FAILURE) << "Attempt to record an object with a null key";
797  return nullptr;
798  }
799 
800  store = storeFromHandle (ctx);
801  if (!store) {
802  REPORT_ERROR (StatusCode::FAILURE) << "No store.";
803  return nullptr;
804  }
805 
806  SG::DataObjectSharedPtr<DataObject> sptr (std::move (dobj));
807  unsigned int initRefCount = sptr->refCount();
808  SG::DataProxy* new_proxy =
809  store->recordObject (sptr, this->name(), allowMods, returnExisting);
810  if (!new_proxy) {
811  REPORT_ERROR (StatusCode::FAILURE) << "recordObject failed";
812  return nullptr;
813  }
814 
815  if (new_proxy && initRefCount == sptr->refCount() && new_proxy->isValid()) {
816  // If the reference count hasn't changed, then we've returned an existing
817  // object rather than recording a new one. Retrieve the pointer.
818  dataPtr = typeless_dataPointer_fromProxy (new_proxy, true);
819  }
820 
821  return dataPtr;
822  }

◆ record_impl()

StatusCode SG::VarHandleBase::record_impl ( std::unique_ptr< DataObject >  dobj,
void *  dataPtr,
bool  allowMods,
bool  returnExisting 
)
protected

Helper to record an object in the event store.

Parameters
Thewrapped data object (DataBucket) to record.
dataPtrPointer to the transient object itself.
allowModsIf false, record the object as const.
returnExistingAllow an existing object.

If there is already an existing object with our key, then return failure, unless returnExisting is true, in which case return success. In either case, dobj is destroyed.

Definition at line 719 of file StoreGate/src/VarHandleBase.cxx.

723  {
724  if (!m_store) {
725  if (m_ownedKey) {
726  CHECK (m_ownedKey->initialize());
727  }
728  m_store = &*(this->storeHandle());
729  m_storeWasSet = false;
730  }
731 
732  if (this->name().empty()) {
733  REPORT_ERROR (StatusCode::FAILURE) << "Attempt to record an object with a null key";
734  return StatusCode::FAILURE;
735  }
736 
737  SG::DataObjectSharedPtr<DataObject> sptr (dobj.release());
738  unsigned int initRefCount = sptr->refCount();
739  SG::DataProxy* new_proxy =
740  m_store->recordObject (sptr, this->name(), allowMods, returnExisting);
741  if (!new_proxy) {
742  REPORT_ERROR (StatusCode::FAILURE) << "recordObject failed";
743  resetProxy();
744  return StatusCode::FAILURE;
745  }
746  if (m_proxy != new_proxy) {
747  CHECK (this->setState (new_proxy));
748  }
749 
750  if (new_proxy && initRefCount == sptr->refCount() && new_proxy->isValid()) {
751  // If the reference count hasn't changed, then we've returned an existing
752  // object rather than recording a new one. Retrieve the pointer, making
753  // sure that it isn't const.
754  if (m_proxy->isConst()) {
755  REPORT_ERROR (StatusCode::FAILURE)
756  << "Found an existing const object from recordOrRetrieve.";
757  return StatusCode::FAILURE;
758  }
760  if (!allowMods)
761  CHECK( setConst() );
762  }
763  else
764  m_ptr=(void*)dataPtr;
765 
766  return StatusCode::SUCCESS;
767  }

◆ reset()

void SG::VarHandleBase::reset ( bool  hard)
overridevirtual

Reset this handle.

Parameters
hardIf true, anything depending on the event store is cleared.

If the handle stays associated with a given event store, then hard=false. In that case, we clear the cached pointer; the proxy is also dropped if it is reset only. If hard=true, then we always drop the proxy and in addition clear the cached pointer to the event store.

Implements IResetable.

Reimplemented in SG::UpdateHandle< T >.

Definition at line 576 of file StoreGate/src/VarHandleBase.cxx.

576  {
577 #ifdef DEBUG_VHB
578  dbg::print(stderr, "::VHB::reset {} with proxy={}, key={}, store={} (hard={})\n", dbg::ptr(this), dbg::proxy(m_proxy), this->key(), dbg::store(this->m_store), hard);
579 #endif
580  m_ptr = 0;
581 
582  if (hard) {
583  m_store = 0;
584  m_storeWasSet = false;
585  }
586 
587  //if the proxy is not resetOnly then release it as it will become invalid
588  // Also release on a hard reset.
589  if (0 != m_proxy && (!m_proxy->isResetOnly() || hard)) {
590  resetProxy();
591  }
592  }

◆ resetProxy()

void SG::VarHandleBase::resetProxy ( )
private

Clear the m_proxy field and release the old proxy.

Definition at line 1010 of file StoreGate/src/VarHandleBase.cxx.

1011  {
1012  if (m_proxy) {
1013  if (m_ownedKey) {
1014  m_proxy->unbindHandle(this);
1015  m_proxy->release();
1016  }
1017  m_proxy = nullptr;
1018  }
1019  }

◆ setConst()

StatusCode SG::VarHandleBase::setConst ( )

Set the 'const' bit for the bound proxy in the store.

Definition at line 612 of file StoreGate/src/VarHandleBase.cxx.

613  {
614  if (typeless_dataPointer()) {
615  m_proxy->setConst();
616  return StatusCode::SUCCESS;
617  }
618  return StatusCode::FAILURE;
619  }

◆ setProxy()

void SG::VarHandleBase::setProxy ( SG::DataProxy proxy)
private

Set a new proxy.

Release any old one first.

Parameters
proxyThe new proxy.

Definition at line 1026 of file StoreGate/src/VarHandleBase.cxx.

1027  {
1028  resetProxy();
1029  if (proxy) {
1030  if (m_ownedKey) {
1031  proxy->addRef();
1032  proxy->bindHandle (this);
1033  }
1034  m_proxy = proxy;
1035  }
1036  }

◆ setProxyDict()

StatusCode SG::VarHandleBase::setProxyDict ( IProxyDict store)
virtual

◆ setState() [1/3]

StatusCode SG::VarHandleBase::setState ( )

Retrieve and cache all information managed by a handle.

This will retrieve and cache the associated DataProxy.

Note for the case of a WriteHandle that has not yet been written to, the proxy may not exist. We return Success in that case; however, isInitialized will still return false.

Definition at line 493 of file StoreGate/src/VarHandleBase.cxx.

494  {
495  CHECK( initialize() );
496  if (!m_storeWasSet) {
497  IProxyDict* store = storeFromHandle (nullptr);
498  if (store) m_store = store;
499  }
500 
501 #ifdef DEBUG_VHB
502  dbg::print(stderr, "::VHB:: setState() on {} with key={} ({}) and store={} (CLID: {})\n", dbg::ptr(this), this->key(), m_key->hashedKey(), dbg::store(m_store), this->clid());
503 #endif
504 
506  if (!proxy) {
507 #ifdef DEBUG_VHB
508  dbg::print(stderr, "::VHB:: setState() on {} ==> null proxy!\n", dbg::ptr(this));
509 #endif
510  proxy = m_store->proxy(this->clid(), this->key());
511  }
512 
513  if (!proxy) {
514 #ifdef DEBUG_VHB
515  dbg::print(stderr, "::VHB:: setState() on {} ==> STILL null proxy!\n", dbg::ptr(this));
516 #endif
517  }
518  else if (!proxy->isValid()) {
519 #ifdef DEBUG_VHB
520  dbg::print(stderr, "::VHB:: setState() on {} ==> proxy not valid! Dumping Store\n", dbg::ptr(this));
521  if (!m_store) {
522  dbg::print(stderr, "::VHB:: setState() on {} ==> m_store is a nullptr\n", dbg::ptr(this));
523  }
524  else {
525  SGImplSvc* stor = dynamic_cast<SGImplSvc*>(m_store);
526  if (!stor) {
527  dbg::print(stderr, "::VHB:: setState() on {} ==> m_store points not to an SGImplSvc but to a {}\n", dbg::ptr(this), boost::core::demangle(typeid(*m_store).name()));
528  }
529  else {
530  dbg::print(stderr, "\n{}\n", stor->dump());
531  }
532  }
533 #endif
534  }
535  StatusCode sc = this->setState(proxy);
536 
537  // Failure to find the proxy is ok in the case of a @c WriteHandle
538  // that has not yet been written to.
539  if (sc.isFailure() && mode() == Gaudi::DataHandle::Writer && m_ptr == nullptr)
540  return StatusCode::SUCCESS;
541 
542  return sc;
543  }

◆ setState() [2/3]

StatusCode SG::VarHandleBase::setState ( IProxyDict store,
const std::string &  key 
)
protected

Set the state of a handle from a store and a key name.

Parameters
storeThe event store to access.
nameThe StoreGate key to search for.

Fails if no such object is recorded.

Parameters
storeThe event store to access.
nameThe StoreGate key to search for.

Definition at line 692 of file StoreGate/src/VarHandleBase.cxx.

693  {
694  if (0 == store) {
695  return StatusCode::FAILURE;
696  }
697 #ifdef DEBUG_VHB
698  dbg::print(stderr, "::VHB::setState({}, store={}, key={}) const\n", dbg::ptr(this), dbg::store(store), key);
699 #endif
700  CLID cid = this->clid();
701  SG::DataProxy* proxy = store->proxy(cid, key);
702  // std::cerr << "::VHB:: -- clid=[" << cid << "] proxy=[" << proxy << "]\n";
703  return this->setState(proxy);
704  }

◆ setState() [3/3]

StatusCode SG::VarHandleBase::setState ( SG::DataProxy proxy)
protected

Set the state of the handle to a given proxy.

Parameters
proxyThe proxy to set.

The proxy must be valid; otherwise FAILURE will be returned.

Definition at line 666 of file StoreGate/src/VarHandleBase.cxx.

667  {
668 #ifdef DEBUG_VHB
669  dbg::print(stderr, "::VHB::setState({}, proxy={}) const\n", dbg::ptr(this), dbg::proxy(proxy));
670 #endif
671  if (0 == proxy || !proxy->isValid()) {
672  return StatusCode::FAILURE;
673  }
674 
675  if (m_proxy != proxy) {
676  // We're changing proxies. Release the old and bind to the new.
677  setProxy (proxy);
678  // Clear cached pointer.
679  m_ptr=0;
680  }
681 
682  return StatusCode::SUCCESS;
683  }

◆ setStoreFromHandle()

bool SG::VarHandleBase::setStoreFromHandle ( const EventContext *  ctx)
private

Initialize the store pointer from the store handle.

Also checks that the key is valid.

Parameters
ctxThe current event context, or nullptr.

Returns true on success.

Definition at line 993 of file StoreGate/src/VarHandleBase.cxx.

994  {
995  if (m_ownedKey) {
996  if (m_ownedKey->initialize().isFailure()) {
997  return false;
998  }
999  }
1000  m_store = storeFromHandle (ctx);
1001  m_storeWasSet = (ctx && m_store ==
1002  Atlas::getExtendedEventContext(*ctx).proxy());
1003  return true;
1004  }

◆ store()

std::string SG::VarHandleBase::store ( ) const

Return the name of the store holding the object we are proxying.

Definition at line 382 of file StoreGate/src/VarHandleBase.cxx.

383  {
384  if (m_store)
385  return m_store->name();
386  return this->storeHandle().name();
387  }

◆ storeFromHandle()

IProxyDict * SG::VarHandleBase::storeFromHandle ( const EventContext *  ctx) const
private

Return the store instance to use.

Parameters
ctxThe current event context, or nullptr.
ctxThe current event context, or nullptr.

If we're referencing the default event store, pick the specific store to use in this order:

  • Store associated with an explicitly-provided context.
  • A store explicitly set via setProxyDict.
  • Store associated with the current context.

For another store:

  • A store explicitly set via setProxyDict.
  • The store retrieved from the handle, resolved to the current slot if it's a hive store.

Definition at line 963 of file StoreGate/src/VarHandleBase.cxx.

964  {
965  if (m_key->isEventStore()) {
966  if (ctx)
967  return Atlas::getExtendedEventContext(*ctx).proxy();
968  if (m_storeWasSet && m_store) return m_store;
969 
970  if ( Atlas::hasExtendedEventContext (Gaudi::Hive::currentContext()) ) {
971  return Atlas::getExtendedEventContext (Gaudi::Hive::currentContext()).proxy();
972  } else {
973  return nullptr;
974  }
975  }
976 
977  if (m_storeWasSet && m_store) return m_store;
979  if (!store)
980  store = &*this->storeHandle();
981 
982  return store->hiveProxyDict();
983  }

◆ storeHandle()

const ServiceHandle<IProxyDict>& SG::VarHandleBase::storeHandle ( ) const

Return handle to the referenced store.

◆ symLink_impl()

StatusCode SG::VarHandleBase::symLink_impl ( CLID  newClid,
const std::string &  newKey 
)
protected

Make a symlink or alias to the object currently referenced by this handle.

Parameters
newClidCLID of link.
newKeySG key of link.

If newClid matches the existing clid, then make an alias. If newKey matches the existing key, then make a symlink. If neither match, it's an error.

Definition at line 932 of file StoreGate/src/VarHandleBase.cxx.

934  {
935  if (!m_ptr || !m_store) {
936  REPORT_ERROR (StatusCode::FAILURE) << "symlink: Handle not valid.";
937  return StatusCode::FAILURE;
938  }
939 
940  SG::DataObjectSharedPtr<DataObject> obj (new SymlinkDataObject (newClid, m_ptr));
941  SG::DataProxy* prox = m_store->recordObject (obj, newKey, false, true);
942  if (!prox)
943  return StatusCode::FAILURE;
944  return StatusCode::SUCCESS;
945  }

◆ typeless_cptr()

const void* SG::VarHandleBase::typeless_cptr ( )
protected

Retrieve an object from StoreGate as a const pointer.

Same as typeless_dataPointer with the return value converted to const.

◆ typeless_dataPointer()

void* SG::VarHandleBase::typeless_dataPointer ( bool  quiet = defaultQuiet)
protected

Retrieve an object from StoreGate.

Parameters
quietIf true, suppress failure messages.

Inline method: first check cached pointer, then call the _impl method.

◆ typeless_dataPointer_fromProxy()

void * SG::VarHandleBase::typeless_dataPointer_fromProxy ( SG::DataProxy proxy,
bool  quiet 
) const
private

Retrieve a pointer from a proxy.

Parameters
proxyThe proxy object.
quietIf true, suppress failure messages.

Warning — doesn't enforce const rules; the caller must do that.

Definition at line 1047 of file StoreGate/src/VarHandleBase.cxx.

1049  {
1050  if (!proxy || !proxy->isValid()) {
1051  // invalid proxy
1052  if (!quiet) {
1053  REPORT_MESSAGE(MSG::WARNING)
1054  << "Proxy "
1055  << " [" << (proxy != 0 ? proxy->clID() : 0)
1056  << "/" << (proxy != 0
1057  ? proxy->name()
1058  : std::string("<N/A>"))
1059  << "] is in an invalid state";
1060  } //quiet
1061  return nullptr;
1062  }
1063 
1064  DataObject* dobj = proxy->accessData();
1065  if (!dobj) {
1066  // invalid dobj
1067  if (!quiet) {
1068  REPORT_MESSAGE(MSG::WARNING)
1069  << "this proxy " << MSG::hex << proxy
1070  << MSG::dec << " has a NULL data object ptr";
1071  }
1072  return nullptr;
1073  }
1074 
1075  const CLID clid = this->clid();
1076  void* ptr = SG::Storable_cast(dobj, clid, nullptr, true, proxy);
1077  if (ptr)
1078  return ptr;
1079 
1080  // If ptr is null, probably the clid we gave wasn't the clid
1081  // the object was stored with, nor it inherits from it.
1082  // before giving up, let's check its transient CLIDs
1083  DataBucketBase *dbb = 0;
1084  if (proxy->transientID(clid) &&
1085  0 != (dbb = dynamic_cast<DataBucketBase*>(dobj))) {
1086  // it is a symlink after all.
1087  // Let's hard cast (and keep our fingers Xed)
1088  ptr = static_cast<void*>(dbb->object());
1089  } else {
1090  if (!quiet) {
1091  REPORT_MESSAGE(MSG::WARNING)
1092  << "Request for an invalid object; requested CLID = "
1093  << clid
1094  << ", proxy primary ID is " << proxy->clID();
1095  }
1096  } // try symlink -- endif
1097  return ptr;
1098  }

◆ typeless_dataPointer_impl()

void * SG::VarHandleBase::typeless_dataPointer_impl ( bool  quiet)
protected

Retrieve an object from StoreGate.

Parameters
quietIf true, suppress failure messages.

Definition at line 830 of file StoreGate/src/VarHandleBase.cxx.

831  {
832 #ifdef DEBUG_VHB
833  dbg::print(stderr, "::VHB::typeless_dataPointer_impl({}, ptr={}, proxy={}, key={}, store={})\n", dbg::ptr(this), dbg::ptr(this->m_ptr), dbg::proxy(this->m_proxy), this->key(), dbg::store(this->m_store));
834 #endif
835 
836  // First check for cached pointer.
837  if (0 != m_ptr)
838  return m_ptr;
839 
840  if (0 == m_proxy) {
841  // No proxy, need to look it up.
842  if (this->setState().isFailure() || !m_proxy) {
843  if (!quiet) {
844  REPORT_MESSAGE(MSG::WARNING)
845  << "could not get proxy for key " << key();
846  if (this->mode() != Gaudi::DataHandle::Reader) {
847  REPORT_MESSAGE(MSG::WARNING)<< " try using a ReadHandle";
848  }
849  } //quiet
850  return 0;
851  } //setstate
852  } //m_proxy
853 
855  return m_ptr;
856  }

◆ typeless_ptr()

void * SG::VarHandleBase::typeless_ptr ( bool  quiet = defaultQuiet)
protected

Retrieve an object from StoreGate as non-const pointer.

Calls typeless_dataPointer, then raises an exception if the proxy is marked as const.

Definition at line 865 of file StoreGate/src/VarHandleBase.cxx.

866  {
867  void* p = typeless_dataPointer(quiet);
868  if (p != nullptr && isConst())
869  throw SG::ExcConstObject (clid(), key(), store());
870  return p;
871  }

◆ vhKey()

SG::VarHandleKey & SG::VarHandleBase::vhKey ( )

Return a non-const reference to the HandleKey.

If this handle was initialized from a HandleKey, then this doesn't work (since the HandleKey is const). ExcNonConstHandleKey will be thrown in that case.

Definition at line 629 of file StoreGate/src/VarHandleBase.cxx.

630  {
631  if (!m_ownedKey) {
633  m_key->storeHandle().name());
634  }
635  return *m_ownedKey;
636  }

Friends And Related Function Documentation

◆ Athena_test::refCountTest

void Athena_test::refCountTest ( void  )
friend

◆ Athena_test::resetableTest

void Athena_test::resetableTest ( void  )
friend

◆ Athena_test::varHandleTest

◆ operator<<

std::ostream& operator<< ( std::ostream &  ,
const VarHandleBase  
)
friend

Output stream.

Parameters
outStream to which to write.
oObject to write.

Definition at line 107 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.

108  {
109  out << "VarHandleBase @" << &o
110  // << " store=" <<o.store()
111  << ", key=" <<o.key();
112  return out;
113  }

Member Data Documentation

◆ m_key

const VarHandleKey* SG::VarHandleBase::m_key
private

The associated key object.

If we were initialized from a key object, then this points at that. Otherwise, it points at the same object as m_ownedKey.

Definition at line 525 of file StoreGate/StoreGate/VarHandleBase.h.

◆ m_ownedKey

std::unique_ptr<VarHandleKey> SG::VarHandleBase::m_ownedKey
private

An owned VarHandleKey.

This is set in the case where a VarHandle is not initialized from a key object.

Definition at line 520 of file StoreGate/StoreGate/VarHandleBase.h.

◆ m_proxy

SG::DataProxy* SG::VarHandleBase::m_proxy
protected

Proxy holding the object to which we are bound.

Definition at line 507 of file StoreGate/StoreGate/VarHandleBase.h.

◆ m_ptr

void* SG::VarHandleBase::m_ptr
protected

The object to which we are bound.

Definition at line 504 of file StoreGate/StoreGate/VarHandleBase.h.

◆ m_store

IProxyDict* SG::VarHandleBase::m_store
protected

Pointer to the store that owns the object.

Definition at line 510 of file StoreGate/StoreGate/VarHandleBase.h.

◆ m_storeWasSet

bool SG::VarHandleBase::m_storeWasSet
protected

True if the store was set explicitly via setProxyDict.

Definition at line 513 of file StoreGate/StoreGate/VarHandleBase.h.


The documentation for this class was generated from the following files:
used
SGTest::store
TestStore store
Definition: TestStore.cxx:23
common.sgkey
def sgkey(tool)
Definition: common.py:1028
REPORT_ERROR
#define REPORT_ERROR(SC)
Report an error.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:355
IProxyDict::proxy
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const =0
Get proxy with given id and key.
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:395
SG::DataProxy::isConst
bool isConst() const
Check if it is a const object.
SG::VarHandleBase::storeFromHandle
IProxyDict * storeFromHandle(const EventContext *ctx) const
Return the store instance to use.
Definition: StoreGate/src/VarHandleBase.cxx:963
SG::VarHandleBase::m_ownedKey
std::unique_ptr< VarHandleKey > m_ownedKey
An owned VarHandleKey.
Definition: StoreGate/StoreGate/VarHandleBase.h:520
SG::VarHandleBase::typeless_dataPointer
void * typeless_dataPointer(bool quiet=defaultQuiet)
Retrieve an object from StoreGate.
DataBucketBase
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
Definition: DataBucketBase.h:24
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
SG::VarHandleKey::storeHandle
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::VarHandleBase::setState
StatusCode setState()
Retrieve and cache all information managed by a handle.
Definition: StoreGate/src/VarHandleBase.cxx:493
DataBucketBase::object
virtual void * object()=0
SG::VarHandleBase::clid
CLID clid() const
Return the class ID for the referenced object.
SG::VarHandleBase::typeless_dataPointer_impl
void * typeless_dataPointer_impl(bool quiet)
Retrieve an object from StoreGate.
Definition: StoreGate/src/VarHandleBase.cxx:830
Atlas::hasExtendedEventContext
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
Definition: ExtendedEventContext.cxx:23
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
get_generator_info.stderr
stderr
Definition: get_generator_info.py:40
SG::DataProxy::isValid
bool isValid() const
called by destructor
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
SG::VarHandleBase::setConst
StatusCode setConst()
Set the 'const' bit for the bound proxy in the store.
Definition: StoreGate/src/VarHandleBase.cxx:612
SG::DataProxy::unbindHandle
void unbindHandle(IResetable *ir)
Definition: DataProxy.cxx:293
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
IProxyDict::proxy_exact
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const =0
Get proxy given a hashed key+clid.
IResetable
a resetable object (e.g. a SG DataHandle)
Definition: IResetable.h:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
SG::VarHandleBase::resetProxy
void resetProxy()
Clear the m_proxy field and release the old proxy.
Definition: StoreGate/src/VarHandleBase.cxx:1010
SG::VarHandleKey::assign
virtual StatusCode assign(const std::string &sgkey)
Change the key of the object to which we're referring.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:88
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::VarHandleBase::m_key
const VarHandleKey * m_key
The associated key object.
Definition: StoreGate/StoreGate/VarHandleBase.h:525
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:382
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
LHEF::Reader
Pythia8::Reader Reader
Definition: Prophecy4fMerger.cxx:11
SG::VarHandleKey::isEventStore
bool isEventStore() const
Does this key reference the primary event store?
SGImplSvc
The Athena Transient Store API.
Definition: SGImplSvc.h:111
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleBase::m_proxy
SG::DataProxy * m_proxy
Proxy holding the object to which we are bound.
Definition: StoreGate/StoreGate/VarHandleBase.h:507
SG::ExcConstObject
Exception — Tried to retrieve non-const pointer to const object.
Definition: Control/StoreGate/StoreGate/exceptions.h:134
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
SG::VarHandleBase::isInitialized
bool isInitialized() const
Has a proxy been retrieved from SG?
Definition: StoreGate/src/VarHandleBase.cxx:412
SG::DataProxy::release
virtual unsigned long release() override final
release reference to object
Definition: DataProxy.cxx:320
SGImplSvc::dump
std::string dump() const
dump objects in store.
Definition: SGImplSvc.cxx:557
SG::VarHandleBase::mode
Gaudi::DataHandle::Mode mode() const
Return the mode (read/write/update) for this handle.
SG::VarHandleBase::isPresent_impl
bool isPresent_impl(const std::string &key) const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:1107
SG::VarHandleBase::reset
virtual void reset(bool hard) override
Reset this handle.
Definition: StoreGate/src/VarHandleBase.cxx:576
SG::VarHandleBase::typeless_dataPointer_fromProxy
void * typeless_dataPointer_fromProxy(SG::DataProxy *proxy, bool quiet) const
Retrieve a pointer from a proxy.
Definition: StoreGate/src/VarHandleBase.cxx:1047
SG::VarHandleKey::clid
CLID clid() const
Return the class ID for the referenced object.
Definition: StoreGate/src/VarHandleKey.cxx:185
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
SG::throwExcNonConstHandleKey
void throwExcNonConstHandleKey(CLID clid, const std::string &sgkey, const std::string &storename)
Throw a SG::ExcNonConstHandleKey exception.
Definition: Control/StoreGate/src/exceptions.cxx:337
SG::VarHandleBase::storeHandle
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
SG::VarHandleBase::setStoreFromHandle
bool setStoreFromHandle(const EventContext *ctx)
Initialize the store pointer from the store handle.
Definition: StoreGate/src/VarHandleBase.cxx:993
columnar::empty
bool empty() const noexcept
Definition: ObjectRange.h:129
SG::Storable_cast
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:37
SG::DataProxy::setConst
void setConst()
Mark this object as const.
Definition: DataProxy.cxx:204
SG::VarHandleKey::hashedKey
SG::sgkey_t hashedKey() const
Return the hashed StoreGate key.
SG::VarHandleBase::initialize
StatusCode initialize(bool used=true)
Verify that the handle has been configured properly.
Definition: StoreGate/src/VarHandleBase.cxx:458
SG::ExcHandleInitError
Exception — Error initializing VarHandle from VarHandleKey.
Definition: Control/StoreGate/StoreGate/exceptions.h:92
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
SG::VarHandleBase::m_storeWasSet
bool m_storeWasSet
True if the store was set explicitly via setProxyDict.
Definition: StoreGate/StoreGate/VarHandleBase.h:513
SG::VarHandleBase::m_ptr
void * m_ptr
The object to which we are bound.
Definition: StoreGate/StoreGate/VarHandleBase.h:504
IProxyDict::recordObject
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)=0
Record an object in the store.
SG::DataProxy::isResetOnly
bool isResetOnly() const
Check reset only:
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
SG::VarHandleBase::isConst
bool isConst() const
True if this handle has a proxy, and the proxy is const.
Definition: StoreGate/src/VarHandleBase.cxx:438
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:45
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::VarHandleBase::m_store
IProxyDict * m_store
Pointer to the store that owns the object.
Definition: StoreGate/StoreGate/VarHandleBase.h:510
SG::DataProxy
Definition: DataProxy.h:45
IProxyDict::hiveProxyDict
virtual IProxyDict * hiveProxyDict() override
Return the current event-slot-specific store.
Definition: IProxyDict.cxx:83
SG::VarHandleBase::setProxy
void setProxy(SG::DataProxy *proxy)
Set a new proxy.
Definition: StoreGate/src/VarHandleBase.cxx:1026