ATLAS Offline Software
TypeProxy.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // EDM include(s):
8 
9 // Local include(s):
11 
12 namespace HLTNavDetails {
13 
14  StatusCode ITypeProxy::sync( StoreGateSvc* sg, const std::string& key ) {
15 
16  // Get a proxy for this object:
17  m_proxy = sg->proxy( m_clid, key );
18  if( ! m_proxy ) {
19  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "HLTNavDetails::ITypeProxy::sync" )
20  << "Couldn't get SG::DataProxy to the managed object";
21  return StatusCode::FAILURE;
22  }
23 
24  // Get the pointers:
27 
28  // Remember this key:
29  m_key = key;
30 
31  // The rest is up to the code in the template class:
32  return StatusCode::SUCCESS;
33  }
34 
36 
37  if( m_isAuxVectorBase ) {
38  return static_cast< SG::AuxVectorBase* >( m_ncPointer );
39  } else {
40  return 0;
41  }
42  }
43 
48 
49  return static_cast< SG::IAuxStore* >( m_ncPointer );
50  }
51 
52  bool ITypeProxy::contains( StoreGateSvc* sg, const std::string& key ) const {
53 
54  return sg->contains( m_clid, key );
55  }
56 
58  const std::string& key ) const {
59 
60  return sg->transientContains( m_clid, key );
61  }
62 
63  bool ITypeProxy::empty() const {
64 
65  return ( ( m_proxy == 0 ) && ( m_ncPointer == 0 ) );
66  }
67 
69 
70  return m_clid;
71  }
72 
73  const std::string& ITypeProxy::typeName() const {
74 
75  return m_typeName;
76  }
77 
78 } // namespace HLTNavDetails
HLTNavDetails::ITypeProxy::m_ncPointer
void * m_ncPointer
Non-const pointer to the proxied object.
Definition: TypeProxy.h:99
StoreGateSvc::contains
bool contains(const TKEY &key) const
Look up a keyed object in TDS (compare also tryRetrieve) returns false if object not available in TDS...
HLTNavDetails::ITypeProxy::m_isAuxVectorBase
bool m_isAuxVectorBase
Does the proxied type inherit from SG::AuxVectorBase?
Definition: TypeProxy.h:102
HLTNavDetails
Definition: Holder.cxx:118
HLTNavDetails::ITypeProxy::contains
bool contains(StoreGateSvc *sg, const std::string &key) const
Check whether StoreGate contains an object of this type and with the specified key.
Definition: TypeProxy.cxx:52
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
HLTNavDetails::ITypeProxy::m_key
std::string m_key
StoreGate key of the proxied object.
Definition: TypeProxy.h:97
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
HLTNavDetails::ITypeProxy::transientContains
bool transientContains(StoreGateSvc *sg, const std::string &key) const
Check whether StoreGate contains a modifyable object of this type and with the specified key.
Definition: TypeProxy.cxx:57
HLTNavDetails::ITypeProxy::castIAuxStore
SG::IAuxStore * castIAuxStore()
Return a pointer to the SG::IAuxStore base class of the object if possible.
Definition: TypeProxy.cxx:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HLTNavDetails::ITypeProxy::typeName
const std::string & typeName() const
The type name of the object being proxied.
Definition: TypeProxy.cxx:73
HLTNavDetails::ITypeProxy::m_proxy
SG::DataProxy * m_proxy
StoreGate proxy for the object.
Definition: TypeProxy.h:98
HLTNavDetails::ITypeProxy::clid
CLID clid() const
The CLID of the object being proxied.
Definition: TypeProxy.cxx:68
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreGateSvc::transientContains
bool transientContains(const TKEY &key) const
Look up a transient data object in TDS only (no Proxy lookup) returns false if object not available i...
HLTNavDetails::ITypeProxy::castAuxVectorBase
SG::AuxVectorBase * castAuxVectorBase()
Return a pointer to the SG::AuxVectorBase base class of the object if possible.
Definition: TypeProxy.cxx:35
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
SG::DataProxy_cast
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
HLTNavDetails::ITypeProxy::m_clid
CLID m_clid
The CLID of the type being proxied.
Definition: TypeProxy.h:95
StoreGateSvc::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
HLTNavDetails::ITypeProxy::m_pointer
const void * m_pointer
Const pointer to the proxied object.
Definition: TypeProxy.h:100
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
HLTNavDetails::ITypeProxy::empty
bool empty() const
True if proxy has not yet made object or not synced to any yet (0 pointer)
Definition: TypeProxy.cxx:63
IAuxStore.h
Interface for non-const operations on an auxiliary store.
HLTNavDetails::ITypeProxy::sync
virtual StatusCode sync(StoreGateSvc *sg, const std::string &key)
SG retrieve, and fill the proxy.
Definition: TypeProxy.cxx:14
HLTNavDetails::ITypeProxy::m_typeName
std::string m_typeName
The type name of the object being proxied.
Definition: TypeProxy.h:96
TypeProxy.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37