|
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/DataObject.h"
14 #include "GaudiKernel/IConverter.h"
15 #include "GaudiKernel/GenericAddress.h"
16 #include "GaudiKernel/MsgStream.h"
17 #include "GaudiKernel/EventContext.h"
50 static std::string storeName =
"StoreGateSvc";
51 m_storePtr = (*SG::getDataSourcePointerFunc) (storeName);
52 m_store = *m_storePtr;
61 if (*m_storePtr != m_store) {
62 *m_storePtr = m_store;
77 template <
class GAUDIREF>
78 void setGaudiRef(GAUDIREF* pgref, GAUDIREF*& pMember) {
79 if (0 != pgref) pgref->addRef();
80 if (0 != pMember) pMember->release();
85 template <
class GAUDIREF>
86 void resetGaudiRef(GAUDIREF*& pMember) { setGaudiRef((GAUDIREF*)0, pMember); }
91 DataProxy::DataProxy():
94 m_boundHandles(false),
98 m_dataLoader(nullptr),
109 bool constFlag,
bool resetOnly)
111 svc, constFlag, resetOnly)
120 bool constFlag,
bool resetOnly)
121 :
DataProxy (std::move(*tAddr),
svc, constFlag, resetOnly)
129 bool constFlag,
bool resetOnly):
131 m_resetFlag(resetOnly),
132 m_boundHandles(false),
134 m_origConst(constFlag),
136 m_tAddress(std::move(tAddr)),
150 bool constFlag,
bool resetOnly):
152 m_resetFlag(resetOnly),
153 m_boundHandles(false),
155 m_origConst(constFlag),
157 m_tAddress(std::move(*tAddr)),
158 m_dataLoader(nullptr),
169 bool constFlag,
bool resetOnly):
171 m_resetFlag(resetOnly),
172 m_boundHandles(false),
174 m_origConst(constFlag),
176 m_tAddress(std::move(tAddr)),
177 m_dataLoader(nullptr),
210 this->
lock (objLock);
270 for (
auto ih: handles) {
271 if (0 != ih) ih->finalReset();
327 if ( 0 ==
count )
delete this;
358 bool canRelease =
force;
361 MsgStream gLog(
m_ims,
"DataProxy");
364 << (canRelease ?
" release " :
" reset")
366 <<
name() <<
" CLID " <<
clID() <<
" address " << MSG::hex
382 setGaudiRef(dObject, dobj);
385 if (doreg) dobj->setRegistry(
this);
443 MsgStream gLog(
m_ims,
"DataProxy");
445 <<
"readData: ERROR recursive read for object"
447 <<
" Returning NULL DataObject pointer " <<
endmsg;
453 IConverter* dataLoader;
481 DataObject*
obj =
nullptr;
487 if (
sc.isSuccess()) {
489 return std::unique_ptr<DataObject>(
obj);
514 MsgStream gLog(
m_ims,
"DataProxy");
516 <<
"accessData: IOA pointer not set" <<
endmsg;
519 MsgStream gLog(
m_ims,
"DataProxy");
521 <<
"accessData: conversion failed for data object "
523 <<
" Returning NULL DataObject pointer " <<
endmsg;
529 DataObject*
obj = obju.release();
541 std::vector<CLID> base_clids = bi->
get_bases();
542 for (
unsigned i=0;
i < base_clids.size(); ++
i) {
550 MsgStream gLog(
m_ims,
"DataProxy");
552 <<
"accessData: ERROR registering object in t2p map"
554 <<
" Returning NULL DataObject pointer " <<
endmsg;
604 DataObject* pObject =
proxy->accessData();
654 EventContext* ctx = SG::DataProxy_cast<EventContext> (
proxy);
655 if (ctx)
return *ctx;
658 static const EventContext emptyContext;
std::vector< IResetable * > handleList_t
list of bound DataHandles
bool m_boundHandles
True if there are any bound handles.
singleton-like access to IMessageSvc via open function and helper
std::atomic< IProxyDict * > m_store
The store of which we are a part.
std::string find(const std::string &s)
return a remapped string
virtual void lock()=0
If the held object derives from ILockable, call lock() on it.
void resetBoundHandles(bool hard)
reset the bound DataHandles If HARD is true, then the bound objects should also clear any data that d...
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
virtual sgkey_t stringToKey(const std::string &str, CLID clid)=0
Find the key for a string/CLID pair.
virtual void registerTransient(void *p) override final
Register a transient object in a t2p map.
virtual void * object()=0
Athena::IMessageSvcHolder m_ims
std::lock_guard< objMutex_t > objLock_t
Temporarily change the current store.
void reset()
Retrieve IOpaqueAddress.
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
void lock(objLock_t &)
Lock the data object we're holding, if any.
virtual StatusCode createObj(IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject)
Call converter to create an object, possibly with locking.
Assign a CLID to EventContext.
void unbindHandle(IResetable *ir)
const std::string & name() const
Get the primary (hashed) SG key.
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const =0
Get proxy given a hashed key+clid.
a resetable object (e.g. a SG DataHandle)
bool requestRelease(bool force, bool hard)
Reset/release a proxy at the end of an event.
virtual IOpaqueAddress * address() const override final
Retrieve IOpaqueAddress.
const EventContext & contextFromStore() const
Retrieve the EventContext saved in the owning store.
virtual void boundHandle(IResetable *handle)
Tell the store that a handle has been bound to a proxy.
Manage DataProxy reference in ElementLink/DataLink.
::StatusCode StatusCode
StatusCode definition for legacy code.
static void resetCachedSource()
std::atomic< DataObject * > m_dObject
std::lock_guard< mutex_t > lock_t
CLID clID() const
Retrieve string key:
bool isValid(const EventContext *ctx, bool forceUpdate=false)
cache the pointer to the Address provider which can update this transient address
getDataSourcePointerFunc_t * getDataSourcePointerFunc
Default, invalid implementation of ClassID_traits.
bool t2pRegister(const void *const pTrans, DataProxy *const pPers)
bool m_origConst
Was the proxy created as const?
std::atomic< bool > m_const
Is the proxy currently const?
IProxyDict * store()
Return the store of which we're a part.
AthROOTErrorHandlerSvc * svc
bool bindHandle(IResetable *ir)
uint32_t CLID
The Class ID type.
CLID clID() const
Retrieve clid.
virtual unsigned long release() override final
release reference to object
void setObject(DataObject *obj, bool doreg=true)
set DataObject If doreg is true, then call setRegistry to set the backpointer from obj to the proxt.
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
virtual void unboundHandle(IResetable *handle)
Tell the store that a handle has been unbound from a proxy.
virtual unsigned long addRef() override final
Add reference to object.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
IProxyDict ** getDataSourcePointerFunc_t(const std::string &)
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
virtual const name_type & name() const override final
Retrieve data object key == string.
void resetRef()
Drop the reference to the data object.
void setAddress(IOpaqueAddress *pAddress)
Retrieve primary clid.
int ir
counter of the current depth
void reset(bool hard=false)
Other methods of DataProxy (not in Interface IRegistry):
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)
virtual void setAddress(IOpaqueAddress *ioa) override final
set an IOpaqueAddress
DataObject * accessDataOol()
Out-of-line part of accessData().
bool m_resetFlag
reset and not delete: default is true
The non-template portion of the BaseInfo implementation.
void setConst()
Mark this object as const.
bool isValidAddress() const
is the address valid?
enum ErrNo m_errno
errno-style error code for accessData
unsigned long refCount() const
return refCount
TransientAddress m_tAddress
std::unique_ptr< DataObject > readData()
Read in a new copy of the object referenced by this proxy.
IConverter * m_dataLoader