ATLAS Offline Software
Loading...
Searching...
No Matches
SG::DataProxy Class Reference

#include <DataProxy.h>

Inheritance diagram for SG::DataProxy:

Public Types

enum  ErrNo {
  ALLOK , NOCNVSVC , NOIOA , CNVFAILED ,
  T2PREGFAILED , RECURSIVEREAD , NERRORS
}
typedef std::string name_type
typedef std::string id_type
typedef TransientAddress::TransientClidSet CLIDCont_t
typedef std::vector< std::string > AliasCont_t
typedef IStringPool::sgkey_t sgkey_t

Public Member Functions

 DataProxy ()
 DataProxy (TransientAddress *tAddr, IConverter *pDataLoader, bool constFlag=false, bool resetOnly=true)
 build from TransientAddress Takes ownership of tAddr.
 DataProxy (std::unique_ptr< TransientAddress > tAddr, IConverter *pDataLoader, bool constFlag=false, bool resetOnly=true)
 build from TransientAddress
 DataProxy (TransientAddress &&tAddr, IConverter *pDataLoader, bool constFlag=false, bool resetOnly=true)
 DataProxy (DataObject *dObject, TransientAddress *tAddr, bool constFlag=false, bool resetOnly=true)
 build from DataObject
 DataProxy (DataObject *dObject, TransientAddress &&tAddr, bool constFlag=false, bool resetOnly=true)
virtual ~DataProxy ()

IRegistry implementation

typedef std::vector< IResetable * > handleList_t
 list of bound DataHandles
typedef std::recursive_mutex mutex_t
typedef std::lock_guard< mutex_tlock_t
typedef std::recursive_mutex objMutex_t
typedef std::lock_guard< objMutex_tobjLock_t
class SG::DataStore
 For access to requestRelease.
unsigned int m_refCount
bool m_resetFlag
 reset and not delete: default is true
bool m_boundHandles
 True if there are any bound handles.
std::atomic< bool > m_const
 Is the proxy currently const?
bool m_origConst
 Was the proxy created as const?
std::atomic< DataObject * > m_dObject
TransientAddress m_tAddress
IConverter * m_dataLoader
T2pMapm_t2p
handleList_t m_handles
mutex_t m_mutex
Athena::IMessageSvcHolder m_ims
std::atomic< IProxyDict * > m_store
 The store of which we are a part.
enum ErrNo m_errno
 errno-style error code for accessData
objMutex_t m_objMutex
virtual unsigned long addRef () override final
 Add reference to object.
virtual unsigned long release () override final
 release reference to object
unsigned long refCount () const
 return refCount
virtual const name_typename () const override final
 Retrieve data object key == string.
virtual const id_typeidentifier () const override final
 Retrieve data object key == string duplicated for Gaudi folks does same as name()
virtual DataObject *object ATLAS_NOT_CONST_THREAD_SAFE () const override final
 Retrieve DataObject.
virtual void setAddress (IOpaqueAddress *ioa) override final
 set an IOpaqueAddress
void setAddress (CxxUtils::RefCountedPtr< IOpaqueAddress > ioa)
 set an IOpaqueAddress
virtual IOpaqueAddress * address () const override final
 Retrieve IOpaqueAddress.
virtual IDataProviderSvc * dataSvc () const override final
 set DataSvc (Gaudi-specific); do nothing for us
sgkey_t sgkey () const
 < Get the primary (hashed) SG key.
void setSGKey (sgkey_t sgkey)
 Return the ID of the store containing this proxy.
StoreID::type storeID () const
 check if it is a transient ID (primary or symLinked):
bool transientID (CLID id) const
 return the list of transient IDs (primary or symLinked):
CLIDCont_t transientID () const
void setTransientID (CLID id)
 Add a new transient ID.
AliasCont_t alias () const
 access set of proxy aliases Returns a COPY of the alias set.
bool hasAlias (const std::string &key) const
 Test to see if a given string is in the alias set.
void setAlias (const std::string &key)
 Add a new proxy alias.
bool removeAlias (const std::string &key)
 remove alias from proxy
IAddressProviderprovider ()
 Return the address provider.
void setProvider (IAddressProvider *provider, StoreID::type storeID)
 Set the address provider.
void setID (CLID id, const std::string &key)
 Set the CLID / key.
void reset (bool hard=false)
 Other methods of DataProxy (not in Interface IRegistry):
void finalReset ()
bool isValid () const
 called by destructor
bool isValidAddress () const
 is the address valid?
bool isValidObject () const
 is the object valid?
bool updateAddress ()
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.
DataObject * accessData ()
 Access DataObject on-demand using conversion service.
ErrNo errNo () const
CLID clID () const
 Retrieve clid.
bool isConst () const
 Check if it is a const object.
void setConst ()
 Mark this object as const.
void resetOnly (const bool &flag)
 set the reset only flag: Clear Store will reset and not delete.
bool isResetOnly () const
 Check reset only:
bool bindHandle (IResetable *ir)
void unbindHandle (IResetable *ir)
void setT2p (T2pMap *t2p)
virtual void registerTransient (void *p) override final
 Register a transient object in a t2p map.
void setStore (IProxyDict *store)
 Set the store of which we're a part.
IProxyDictstore ()
 Return the store of which we're a part.
const IProxyDictstore () const
 Return the store of which we're a part.
void resetBoundHandles (bool hard)
 reset the bound DataHandles If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store.
IConverter * loader ()
std::unique_ptr< DataObject > readData ()
 Read in a new copy of the object referenced by this proxy.
 DataProxy (const DataProxy &)=delete
DataProxyoperator= (const DataProxy &)=delete
DataObject * accessDataOol ()
 Out-of-line part of accessData().
bool requestRelease (bool force, bool hard)
 Reset/release a proxy at the end of an event.
void resetRef ()
 Drop the reference to the data object.
void lock (objLock_t &)
 Lock the data object we're holding, if any.
std::unique_ptr< DataObject > readData (objLock_t &objLock, ErrNo *errNo)
 Read in a new copy of the object referenced by this proxy.
void setObject (objLock_t &objLock, DataObject *obj, bool doreg)
 set DataObject If doreg is true, then call setRegistry to set the backpointer from obj to the proxt.
const EventContext & contextFromStore () const
 Retrieve the EventContext saved in the owning store.

Detailed Description

Definition at line 44 of file DataProxy.h.

Member Typedef Documentation

◆ AliasCont_t

typedef std::vector<std::string> SG::DataProxy::AliasCont_t

Definition at line 55 of file DataProxy.h.

◆ CLIDCont_t

◆ handleList_t

typedef std::vector<IResetable*> SG::DataProxy::handleList_t
private

list of bound DataHandles

Definition at line 332 of file DataProxy.h.

◆ id_type

typedef std::string SG::DataProxy::id_type

Definition at line 53 of file DataProxy.h.

◆ lock_t

typedef std::lock_guard<mutex_t> SG::DataProxy::lock_t
private

Definition at line 341 of file DataProxy.h.

◆ mutex_t

typedef std::recursive_mutex SG::DataProxy::mutex_t
private

Definition at line 340 of file DataProxy.h.

◆ name_type

typedef std::string SG::DataProxy::name_type

Definition at line 52 of file DataProxy.h.

◆ objLock_t

typedef std::lock_guard<objMutex_t> SG::DataProxy::objLock_t
private

Definition at line 355 of file DataProxy.h.

◆ objMutex_t

typedef std::recursive_mutex SG::DataProxy::objMutex_t
private

Definition at line 354 of file DataProxy.h.

◆ sgkey_t

Definition at line 56 of file DataProxy.h.

Member Enumeration Documentation

◆ ErrNo

Enumerator
ALLOK 
NOCNVSVC 
NOIOA 
CNVFAILED 
T2PREGFAILED 
RECURSIVEREAD 
NERRORS 

Definition at line 48 of file DataProxy.h.

Constructor & Destructor Documentation

◆ DataProxy() [1/7]

DataProxy::DataProxy ( )

Definition at line 92 of file DataProxy.cxx.

92 :
93 m_refCount(0),
94 m_resetFlag(true),
95 m_boundHandles(false),
96 m_const(false),
97 m_origConst(false),
98 m_dObject(nullptr),
99 m_dataLoader(nullptr),
100 m_t2p(nullptr),
101 m_store(nullptr),
103{
104}
unsigned int m_refCount
Definition DataProxy.h:306
IConverter * m_dataLoader
Definition DataProxy.h:327
bool m_resetFlag
reset and not delete: default is true
Definition DataProxy.h:309
bool m_boundHandles
True if there are any bound handles.
Definition DataProxy.h:316
enum ErrNo m_errno
errno-style error code for accessData
Definition DataProxy.h:350
std::atomic< IProxyDict * > m_store
The store of which we are a part.
Definition DataProxy.h:347
std::atomic< DataObject * > m_dObject
Definition DataProxy.h:323
std::atomic< bool > m_const
Is the proxy currently const?
Definition DataProxy.h:319
bool m_origConst
Was the proxy created as const?
Definition DataProxy.h:321
T2pMap * m_t2p
Definition DataProxy.h:329

◆ DataProxy() [2/7]

DataProxy::DataProxy ( TransientAddress * tAddr,
IConverter * pDataLoader,
bool constFlag = false,
bool resetOnly = true )

build from TransientAddress Takes ownership of tAddr.

Definition at line 108 of file DataProxy.cxx.

111 : DataProxy (std::move(*tAddr),
112 svc, constFlag, resetOnly)
113{
114 delete tAddr;
115}
void resetOnly(const bool &flag)
set the reset only flag: Clear Store will reset and not delete.

◆ DataProxy() [3/7]

DataProxy::DataProxy ( std::unique_ptr< TransientAddress > tAddr,
IConverter * pDataLoader,
bool constFlag = false,
bool resetOnly = true )

build from TransientAddress

Definition at line 119 of file DataProxy.cxx.

122 : DataProxy (std::move(*tAddr), svc, constFlag, resetOnly)
123{
124 //assert( tAddr->clID() != 0 );
125 if (svc) svc->addRef();
126}
AthROOTErrorHandlerSvc * svc

◆ DataProxy() [4/7]

DataProxy::DataProxy ( TransientAddress && tAddr,
IConverter * pDataLoader,
bool constFlag = false,
bool resetOnly = true )

Definition at line 128 of file DataProxy.cxx.

130 :
131 m_refCount(0),
133 m_boundHandles(false),
134 m_const(constFlag),
135 m_origConst(constFlag),
136 m_dObject(0),
137 m_tAddress(std::move(tAddr)),
138 m_dataLoader(svc),
139 m_t2p(nullptr),
140 m_store(nullptr),
142{
143 //assert( tAddr->clID() != 0 );
144 if (svc) svc->addRef();
145}
TransientAddress m_tAddress
Definition DataProxy.h:325

◆ DataProxy() [5/7]

DataProxy::DataProxy ( DataObject * dObject,
TransientAddress * tAddr,
bool constFlag = false,
bool resetOnly = true )

build from DataObject

Definition at line 149 of file DataProxy.cxx.

151 :
152 m_refCount(0),
154 m_boundHandles(false),
155 m_const(constFlag),
156 m_origConst(constFlag),
157 m_dObject(0),
158 m_tAddress(std::move(*tAddr)),
159 m_dataLoader(nullptr),
160 m_t2p(nullptr),
161 m_store(nullptr),
163{
164 setObject(dObject);
165 delete tAddr;
166}
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.

◆ DataProxy() [6/7]

DataProxy::DataProxy ( DataObject * dObject,
TransientAddress && tAddr,
bool constFlag = false,
bool resetOnly = true )

Definition at line 168 of file DataProxy.cxx.

170 :
171 m_refCount(0),
173 m_boundHandles(false),
174 m_const(constFlag),
175 m_origConst(constFlag),
176 m_dObject(0),
177 m_tAddress(std::move(tAddr)),
178 m_dataLoader(nullptr),
179 m_t2p(nullptr),
180 m_store(nullptr),
182{
183 setObject(dObject);
184}

◆ ~DataProxy()

DataProxy::~DataProxy ( )
virtual

Definition at line 187 of file DataProxy.cxx.

188{
189 finalReset();
190}
void finalReset()

◆ DataProxy() [7/7]

SG::DataProxy::DataProxy ( const DataProxy & )
privatedelete

Member Function Documentation

◆ accessData()

DataObject * SG::DataProxy::accessData ( )

Access DataObject on-demand using conversion service.

Exceptions
runtime_errorwhen converter fails

◆ accessDataOol()

DataObject * DataProxy::accessDataOol ( )
private

Out-of-line part of accessData().

Access DataObject on-demand using conversion service.

Definition at line 513 of file DataProxy.cxx.

514{
515 // This is done in the inlined accessData().
516 //if (0 != m_dObject) return m_dObject; // cached object
517
518 objLock_t objLock (m_objMutex);
519
520 if (isValidAddress()) {
521 // An address provider called by isValidAddress may have set the object
522 // pointer directly, rather than filling in the address. So check
523 // the cached object pointer again.
524 if (0 != m_dObject) return m_dObject; // cached object
525 }
526
527 std::unique_ptr<DataObject> obju = readData (objLock, &m_errno);
528 if (!obju) {
529 if (m_errno == NOIOA) {
530 MsgStream gLog(m_ims, "DataProxy");
531 gLog << MSG::WARNING
532 << "accessData: IOA pointer not set" <<endmsg;
533 }
534 else if (m_errno == CNVFAILED) {
535 MsgStream gLog(m_ims, "DataProxy");
536 gLog << MSG::WARNING
537 << "accessData: conversion failed for data object "
538 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
539 <<" Returning NULL DataObject pointer " << endmsg;
540 }
541 setObject(objLock, 0, true);
542 return 0;
543 }
544
545 DataObject* obj = obju.release();
546 setObject(objLock, obj, true);
547 DataBucketBase* bucket = dynamic_cast<DataBucketBase*>(obj);
548 if (m_t2p) {
549 if (bucket) {
550 void* payload = bucket->object();
551 m_t2p->t2pRegister(payload, this);
553
554 // Register bases as well.
555 const SG::BaseInfoBase* bi = SG::BaseInfoBase::find (m_tAddress.clID());
556 if (bi) {
557 std::vector<CLID> base_clids = bi->get_bases();
558 for (unsigned i=0; i < base_clids.size(); ++i) {
559 void* bobj = SG::DataProxy_cast (this, base_clids[i]);
560 if (bobj && bobj != payload)
561 m_t2p->t2pRegister (bobj, this);
562 }
563 }
564 }
565 else {
566 MsgStream gLog(m_ims, "DataProxy");
567 gLog << MSG::ERROR
568 << "accessData: ERROR registering object in t2p map"
569 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
570 <<" Returning NULL DataObject pointer " << endmsg;
571 obj=0;
572 setObject(objLock, 0, true);
574 }
575 }
576
577 return obj;
578}
#define endmsg
virtual void * object()=0
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Definition BaseInfo.cxx:570
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
Definition BaseInfo.cxx:304
std::lock_guard< objMutex_t > objLock_t
Definition DataProxy.h:355
std::unique_ptr< DataObject > readData()
Read in a new copy of the object referenced by this proxy.
bool isValidAddress() const
is the address valid?
Athena::IMessageSvcHolder m_ims
Definition DataProxy.h:344
objMutex_t m_objMutex
Definition DataProxy.h:356
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies

◆ addRef()

unsigned long DataProxy::addRef ( )
finaloverridevirtual

Add reference to object.

Definition at line 314 of file DataProxy.cxx.

315{
317 return ++m_refCount;
318}
void lock(objLock_t &)
Lock the data object we're holding, if any.
std::lock_guard< mutex_t > lock_t
Definition DataProxy.h:341
mutex_t m_mutex
Definition DataProxy.h:342

◆ address()

virtual IOpaqueAddress * SG::DataProxy::address ( ) const
finaloverridevirtual

Retrieve IOpaqueAddress.

◆ alias()

AliasCont_t SG::DataProxy::alias ( ) const

access set of proxy aliases Returns a COPY of the alias set.

◆ ATLAS_NOT_CONST_THREAD_SAFE()

virtual DataObject *object SG::DataProxy::ATLAS_NOT_CONST_THREAD_SAFE ( ) const
finaloverridevirtual

Retrieve DataObject.

◆ bindHandle()

bool DataProxy::bindHandle ( IResetable * ir)

Definition at line 215 of file DataProxy.cxx.

215 {
216 assert(ir);
218 if (ir->isSet()) {
219 return false;
220 } else {
221 m_handles.push_back(ir);
222 m_boundHandles = true;
223 if (IProxyDict* store = m_store)
224 store->boundHandle(ir);
225 return true;
226 }
227}
handleList_t m_handles
Definition DataProxy.h:333
IProxyDict * store()
Return the store of which we're a part.
int ir
counter of the current depth
Definition fastadd.cxx:49

◆ clID()

CLID SG::DataProxy::clID ( ) const

Retrieve clid.

◆ contextFromStore()

const EventContext & DataProxy::contextFromStore ( ) const
private

Retrieve the EventContext saved in the owning store.

Retrieve the EventContext saved in the parent store.

If there is no context recorded in the store, return a default-initialized context.

Do not call this holding m_mutex, or we could deadlock (ATEAM-755). (The store lock must be acquired before the DataProxy lock.)

Definition at line 713 of file DataProxy.cxx.

714{
715 IProxyDict* store = m_store;
716 if (store) {
717 static const SG::sgkey_t ctxkey =
718 store->stringToKey ("EventContext", ClassID_traits<EventContext>::ID());
719 SG::DataProxy* proxy = store->proxy_exact (ctxkey);
720 if (proxy && proxy->object()) {
721 EventContext* ctx = SG::DataProxy_cast<EventContext> (proxy);
722 if (ctx) return *ctx;
723 }
724 }
725 static const EventContext emptyContext;
726 return emptyContext;
727}
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32

◆ dataSvc()

virtual IDataProviderSvc * SG::DataProxy::dataSvc ( ) const
finaloverridevirtual

set DataSvc (Gaudi-specific); do nothing for us

◆ errNo()

ErrNo SG::DataProxy::errNo ( ) const

◆ finalReset()

void DataProxy::finalReset ( )

Definition at line 251 of file DataProxy.cxx.

252{
253 handleList_t handles;
254 {
255 objLock_t objLock (m_objMutex);
257 m_const=false; //hack to force the resetting of proxy ptr in VarHandleBase
258
259 handles = m_handles;
260
261 DataObject* dobj = m_dObject;
262 resetGaudiRef(dobj);
263 m_dObject = dobj;
264 resetGaudiRef(m_dataLoader);
265
266 if (m_handles.empty()) {
267 m_boundHandles = false;
268 }
269 }
270
271 for (auto ih: handles) {
272 if (0 != ih) ih->finalReset();
273 }
274}
std::vector< IResetable * > handleList_t
list of bound DataHandles
Definition DataProxy.h:332

◆ hasAlias()

bool SG::DataProxy::hasAlias ( const std::string & key) const

Test to see if a given string is in the alias set.

◆ identifier()

virtual const id_type & SG::DataProxy::identifier ( ) const
finaloverridevirtual

Retrieve data object key == string duplicated for Gaudi folks does same as name()

◆ isConst()

bool SG::DataProxy::isConst ( ) const

Check if it is a const object.

◆ isResetOnly()

bool SG::DataProxy::isResetOnly ( ) const

Check reset only:

◆ isValid()

bool SG::DataProxy::isValid ( ) const

called by destructor

am I valid?

◆ isValidAddress()

bool DataProxy::isValidAddress ( ) const

is the address valid?

Definition at line 582 of file DataProxy.cxx.

583{
584 // Looking up the context is relatively expensive.
585 // So first try isValid() without the context.
586 {
588 if (const_cast<DataProxy*>(this)->m_tAddress.isValid(nullptr)) {
589 return true;
590 }
591 }
592 // Get the context. (Must not be holding m_mutex here.)
593 const EventContext& ctx = contextFromStore();
594 // Try again with the context.
596 return const_cast<DataProxy*>(this)->m_tAddress.isValid(&ctx);
597}
const EventContext & contextFromStore() const
Retrieve the EventContext saved in the owning store.

◆ isValidObject()

bool SG::DataProxy::isValidObject ( ) const

is the object valid?

◆ loader()

IConverter * SG::DataProxy::loader ( )

◆ lock()

void DataProxy::lock ( objLock_t & )
private

Lock the data object we're holding, if any.

Should be called with the mutex held.

Definition at line 695 of file DataProxy.cxx.

696{
697 DataObject* dobj = m_dObject;
698 DataBucketBase* bucket = dynamic_cast<DataBucketBase*>(dobj);
699 if (bucket)
700 bucket->lock();
701}
virtual void lock()=0
If the held object derives from ILockable, call lock() on it.

◆ name()

virtual const name_type & SG::DataProxy::name ( ) const
finaloverridevirtual

Retrieve data object key == string.

◆ operator=()

DataProxy & SG::DataProxy::operator= ( const DataProxy & )
privatedelete

◆ provider()

IAddressProvider * SG::DataProxy::provider ( )

Return the address provider.

◆ readData() [1/2]

std::unique_ptr< DataObject > DataProxy::readData ( )

Read in a new copy of the object referenced by this proxy.

If this proxy has an associated loader and address, then load a new copy of the object and return it. Any existing copy held by the proxy is unaffected.

This will fail if the proxy does not refer to an object read from an input file.

Returns a null pointer on failure.

Definition at line 428 of file DataProxy.cxx.

429{
430 // Public wrapper for readData().
431 objLock_t objLock (m_objMutex);
432 return readData (objLock, nullptr);
433}

◆ readData() [2/2]

std::unique_ptr< DataObject > DataProxy::readData ( objLock_t & objLock,
ErrNo * errNo )
private

Read in a new copy of the object referenced by this proxy.

Parameters
errNoIf non-null, set to the resulting error code.

If this proxy has an associated loader and address, then load a new copy of the object and return it. Any existing copy held by the proxy is unaffected.

This will fail if the proxy does not refer to an object read from an input file.

Definition at line 447 of file DataProxy.cxx.

448{
449 if (errNo) {
450 if (*errNo == RECURSIVEREAD) {
451 // This can end up being called from noexcept functions.
452 // Creating a MsgStream can throw an exception --- don't let
453 // it escape.
454 try {
455 MsgStream gLog(m_ims, "DataProxy");
456 gLog << MSG::ERROR
457 << "readData: ERROR recursive read for object"
458 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
459 <<" Returning NULL DataObject pointer " << endmsg;
460 }
461 catch (const GaudiException&) {
462 std::cerr << "DataProxy::readData: Problem creating MsgStream\n";
463 }
464 return nullptr;
465 }
467 }
468
469 IConverter* dataLoader;
470 IProxyDict* store;
471 IOpaqueAddress* address;
472 {
474 if (0 == m_dataLoader) {
475 //MsgStream gLog(m_ims, "DataProxy");
476 //gLog << MSG::WARNING
477 // << "accessData: IConverter ptr not set" <<endmsg;
478 if (errNo) *errNo=NOCNVSVC;
479 return nullptr;
480 }
481
482 dataLoader = m_dataLoader;
483 store = m_store;
484 address = m_tAddress.address();
485 }
486
487 if (!isValidAddress()) {
488 //MsgStream gLog(m_ims, "DataProxy");
489 //gLog << MSG::WARNING
490 // << "accessData: IOA pointer not set" <<endmsg;
491 if (errNo) *errNo=NOIOA;
492 return nullptr;
493 }
494
495 SG::CurrentEventStore::Push push (store);
496
497 DataObject* obj = nullptr;
499 if (store)
500 sc = store->createObj (dataLoader, address, obj);
501 else
502 sc = dataLoader->createObj (address, obj);
503 if (sc.isSuccess()) {
504 if (errNo && *errNo == RECURSIVEREAD) *errNo = ALLOK;
505 return std::unique_ptr<DataObject>(obj);
506 }
507 if (errNo) *errNo = CNVFAILED;
508 return nullptr;
509}
ErrNo errNo() const
virtual IOpaqueAddress * address() const override final
Retrieve IOpaqueAddress.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ refCount()

unsigned long DataProxy::refCount ( ) const

return refCount

Definition at line 307 of file DataProxy.cxx.

308{
310 return m_refCount;
311}

◆ registerTransient()

void DataProxy::registerTransient ( void * p)
finaloverridevirtual

Register a transient object in a t2p map.

Parameters
transThe object to register.

(IRegisterTransient interface.)

Parameters
transThe object to register.

Implements SG::IRegisterTransient.

Definition at line 682 of file DataProxy.cxx.

683{
685 if (m_t2p)
686 m_t2p->t2pRegister (p, this);
687}

◆ release()

unsigned long DataProxy::release ( )
finaloverridevirtual

release reference to object

Definition at line 321 of file DataProxy.cxx.

322{
323 unsigned long count;
324 {
326 count = --m_refCount;
327 }
328 if ( 0 == count ) delete this;
329 return count;
330}
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ removeAlias()

bool SG::DataProxy::removeAlias ( const std::string & key)

remove alias from proxy

◆ requestRelease()

bool DataProxy::requestRelease ( bool force,
bool hard )
private

Reset/release a proxy at the end of an event.

Parameters
forceIf true, force a release rather than a reset.
hardDo a hard reset if true.
Returns
True if the caller should release the proxy.

This is usually called at the end of an event. No locking is done, so there should be no other threads accessing this proxy.

‘Release’ means that we want to remove the proxy from the store. ‘Reset’ means that we keep the proxy, but remove the data object that it references. Each proxy has a flag saying whether it wants to do a release or a reset. This can be forced via the FORCE argument; this would typically be done when deleting the store. This function does not actually release the proxy. If it returns true, the caller is expected to release the proxy.

See AthenaKernel/IResetable.h for the meaning of HARD.

Definition at line 354 of file DataProxy.cxx.

354 {
355
356 if (m_boundHandles) {
357 resetBoundHandles(hard);
358 }
359 bool canRelease = force;
360 if (!m_resetFlag) canRelease = true;
361#ifndef NDEBUG
362 MsgStream gLog(m_ims, "DataProxy");
363 if (gLog.level() <= MSG::VERBOSE) {
364 gLog << MSG::VERBOSE << "requestRelease(): "
365 << (canRelease ? " release " : " reset")
366 <<" object "
367 << name() << " CLID " << clID() << " address " << MSG::hex
368 << object() << MSG::dec << endmsg;
369 }
370#endif
371 if (!canRelease) {
372 resetRef();
373 }
374 return canRelease;
375}
CLID clID() const
Retrieve clid.
void resetBoundHandles(bool hard)
reset the bound DataHandles If HARD is true, then the bound objects should also clear any data that d...
virtual const name_type & name() const override final
Retrieve data object key == string.
void resetRef()
Drop the reference to the data object.
bool force
Definition calibdata.py:18

◆ reset()

void DataProxy::reset ( bool hard = false)

Other methods of DataProxy (not in Interface IRegistry):

Reset DataObject, Handles and IOpaqueAddress: If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store. (See IResetable.h.)

Definition at line 241 of file DataProxy.cxx.

242{
243 resetBoundHandles (hard);
244
245 objLock_t objLock (m_objMutex);
247 resetRef();
248}

◆ resetBoundHandles()

void DataProxy::resetBoundHandles ( bool hard)

reset the bound DataHandles If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store.

don't need no comment

(See IResetable.h.)

Definition at line 277 of file DataProxy.cxx.

277 {
278 handleList_t handles;
279 {
281 // Early exit if the list is empty.
282 if (!m_boundHandles) return;
283
284 // Make a copy and drop the lock, so we're not holding the lock
285 // during the callback.
286 handles = m_handles;
287 }
288
289 for (IResetable* h : handles) {
290 h->reset(hard);
291 }
292}

◆ resetOnly()

void SG::DataProxy::resetOnly ( const bool & flag)

set the reset only flag: Clear Store will reset and not delete.

◆ resetRef()

void DataProxy::resetRef ( )
private

Drop the reference to the data object.

Definition at line 231 of file DataProxy.cxx.

232{
233 DataObject* dobj = m_dObject;
234 resetGaudiRef(dobj);
235 m_dObject = dobj;
236 m_tAddress.reset();
238}

◆ setAddress() [1/2]

void DataProxy::setAddress ( CxxUtils::RefCountedPtr< IOpaqueAddress > ioa)

set an IOpaqueAddress

Definition at line 408 of file DataProxy.cxx.

409{
411 m_tAddress.setAddress(std::move(address));
412}

◆ setAddress() [2/2]

void DataProxy::setAddress ( IOpaqueAddress * ioa)
finaloverridevirtual

set an IOpaqueAddress

Definition at line 401 of file DataProxy.cxx.

402{
404 m_tAddress.setAddress(address);
405}

◆ setAlias()

void SG::DataProxy::setAlias ( const std::string & key)

Add a new proxy alias.

◆ setConst()

void DataProxy::setConst ( )

Mark this object as const.

(Lock the object.)

If the object held that derives from ILockable, then we also call lock on the object.

Definition at line 205 of file DataProxy.cxx.

206{
207 objLock_t objLock (m_objMutex);
209 if (!m_const) {
210 m_const = true;
211 this->lock (objLock);
212 }
213}

◆ setID()

void SG::DataProxy::setID ( CLID id,
const std::string & key )

Set the CLID / key.

This will only succeed if the clid/key are currently clear.

◆ setObject() [1/2]

void DataProxy::setObject ( DataObject * obj,
bool doreg = true )

set DataObject If doreg is true, then call setRegistry to set the backpointer from obj to the proxt.

set a DataObject address

Definition at line 393 of file DataProxy.cxx.

394{
395 objLock_t objLock (m_objMutex);
396 setObject (objLock, dObject, doreg);
397}

◆ setObject() [2/2]

void DataProxy::setObject ( objLock_t & objLock,
DataObject * obj,
bool doreg )
private

set DataObject If doreg is true, then call setRegistry to set the backpointer from obj to the proxt.

set a DataObject address If doreg is true, then call setRegistry to set the backpointer from obj to the proxt.

Definition at line 380 of file DataProxy.cxx.

381{
382 DataObject* dobj = m_dObject;
383 setGaudiRef(dObject, dobj);
384 m_dObject = dobj;
385 if (0 != dobj) {
386 if (doreg) dobj->setRegistry(this);
387 if (m_const) this->lock (objLock);
388 }
389}

◆ setProvider()

void SG::DataProxy::setProvider ( IAddressProvider * provider,
StoreID::type storeID )

Set the address provider.

◆ setSGKey()

void SG::DataProxy::setSGKey ( sgkey_t sgkey)

Return the ID of the store containing this proxy.

◆ setStore()

void SG::DataProxy::setStore ( IProxyDict * store)

Set the store of which we're a part.

◆ setT2p()

void DataProxy::setT2p ( T2pMap * t2p)

Definition at line 192 of file DataProxy.cxx.

193{
195 m_t2p = t2p;
196}

◆ setTransientID()

void SG::DataProxy::setTransientID ( CLID id)

Add a new transient ID.

◆ sgkey()

sgkey_t SG::DataProxy::sgkey ( ) const

< Get the primary (hashed) SG key.

Set the primary (hashed) SG key.

◆ store() [1/2]

IProxyDict * SG::DataProxy::store ( )

Return the store of which we're a part.

◆ store() [2/2]

const IProxyDict * SG::DataProxy::store ( ) const

Return the store of which we're a part.

◆ storeID()

StoreID::type SG::DataProxy::storeID ( ) const

check if it is a transient ID (primary or symLinked):

◆ transientID() [1/2]

CLIDCont_t SG::DataProxy::transientID ( ) const

◆ transientID() [2/2]

bool SG::DataProxy::transientID ( CLID id) const

return the list of transient IDs (primary or symLinked):

◆ unbindHandle()

void DataProxy::unbindHandle ( IResetable * ir)

Definition at line 294 of file DataProxy.cxx.

294 {
295 assert(ir);
297 auto ifr = find(m_handles.begin(), m_handles.end(), ir );
298 if (ifr != m_handles.end()) {
299 m_handles.erase(ifr);
300 if (IProxyDict* store = m_store)
301 store->unboundHandle(ir);
302 }
303 m_boundHandles = !m_handles.empty();
304}
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ updateAddress()

bool DataProxy::updateAddress ( )

Definition at line 599 of file DataProxy.cxx.

600{
601 // Be sure to get the context before acquiring the lock.
602 const EventContext& ctx = contextFromStore();
604 return m_tAddress.isValid(&ctx, true);
605}

◆ SG::DataStore

friend class SG::DataStore
friend

For access to requestRelease.

Definition at line 265 of file DataProxy.h.

Member Data Documentation

◆ m_boundHandles

bool SG::DataProxy::m_boundHandles
private

True if there are any bound handles.

Definition at line 316 of file DataProxy.h.

◆ m_const

std::atomic<bool> SG::DataProxy::m_const
private

Is the proxy currently const?

Definition at line 319 of file DataProxy.h.

◆ m_dataLoader

IConverter* SG::DataProxy::m_dataLoader
private

Definition at line 327 of file DataProxy.h.

◆ m_dObject

std::atomic<DataObject*> SG::DataProxy::m_dObject
private

Definition at line 323 of file DataProxy.h.

◆ m_errno

enum ErrNo SG::DataProxy::m_errno
private

errno-style error code for accessData

Definition at line 350 of file DataProxy.h.

◆ m_handles

handleList_t SG::DataProxy::m_handles
private

Definition at line 333 of file DataProxy.h.

◆ m_ims

Athena::IMessageSvcHolder SG::DataProxy::m_ims
private

Definition at line 344 of file DataProxy.h.

◆ m_mutex

mutex_t SG::DataProxy::m_mutex
mutableprivate

Definition at line 342 of file DataProxy.h.

◆ m_objMutex

objMutex_t SG::DataProxy::m_objMutex
mutableprivate

Definition at line 356 of file DataProxy.h.

◆ m_origConst

bool SG::DataProxy::m_origConst
private

Was the proxy created as const?

Definition at line 321 of file DataProxy.h.

◆ m_refCount

unsigned int SG::DataProxy::m_refCount
private

Definition at line 306 of file DataProxy.h.

◆ m_resetFlag

bool SG::DataProxy::m_resetFlag
private

reset and not delete: default is true

Definition at line 309 of file DataProxy.h.

◆ m_store

std::atomic<IProxyDict*> SG::DataProxy::m_store
private

The store of which we are a part.

Definition at line 347 of file DataProxy.h.

◆ m_t2p

T2pMap* SG::DataProxy::m_t2p
private

Definition at line 329 of file DataProxy.h.

◆ m_tAddress

TransientAddress SG::DataProxy::m_tAddress
private

Definition at line 325 of file DataProxy.h.


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