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 = true
 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 = nullptr
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.
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.

93{
94}

◆ 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 98 of file DataProxy.cxx.

101 : DataProxy (std::move(*tAddr),
102 svc, constFlag, resetOnly)
103{
104 delete tAddr;
105}
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 109 of file DataProxy.cxx.

112 : DataProxy (std::move(*tAddr), svc, constFlag, resetOnly)
113{
114 //assert( tAddr->clID() != 0 );
115 if (svc) svc->addRef();
116}
AthROOTErrorHandlerSvc * svc

◆ DataProxy() [4/7]

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

Definition at line 118 of file DataProxy.cxx.

120 :
122 m_const(constFlag),
123 m_origConst(constFlag),
124 m_tAddress(std::move(tAddr)),
125 m_dataLoader(svc)
126{
127 //assert( tAddr->clID() != 0 );
128 if (svc) svc->addRef();
129}
IConverter * m_dataLoader
Definition DataProxy.h:327
bool m_resetFlag
reset and not delete: default is true
Definition DataProxy.h:309
TransientAddress m_tAddress
Definition DataProxy.h:325
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

◆ DataProxy() [5/7]

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

build from DataObject

Definition at line 133 of file DataProxy.cxx.

135 :
137 m_const(constFlag),
138 m_origConst(constFlag),
139 m_tAddress(std::move(*tAddr))
140{
141 setObject(dObject);
142 delete tAddr;
143}
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 145 of file DataProxy.cxx.

147 :
149 m_const(constFlag),
150 m_origConst(constFlag),
151 m_tAddress(std::move(tAddr))
152{
153 setObject(dObject);
154}

◆ ~DataProxy()

DataProxy::~DataProxy ( )
virtual

Definition at line 157 of file DataProxy.cxx.

158{
159 finalReset();
160}
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 496 of file DataProxy.cxx.

497{
498 // This is done in the inlined accessData().
499 //if (0 != m_dObject) return m_dObject; // cached object
500
501 objLock_t objLock (m_objMutex);
502 // Check again after acquiring the lock.
503 if (0 != m_dObject) return m_dObject; // cached object
504
505 if (isValidAddress()) {
506 // An address provider called by isValidAddress may have set the object
507 // pointer directly, rather than filling in the address. So check
508 // the cached object pointer again.
509 if (0 != m_dObject) return m_dObject; // cached object
510 }
511
512 std::unique_ptr<DataObject> obju = readData (objLock, &m_errno);
513 if (!obju) {
514 if (m_errno == NOIOA) {
515 MsgStream gLog(m_ims, "DataProxy");
516 gLog << MSG::WARNING
517 << "accessData: IOA pointer not set" <<endmsg;
518 }
519 else if (m_errno == CNVFAILED) {
520 MsgStream gLog(m_ims, "DataProxy");
521 gLog << MSG::WARNING
522 << "accessData: conversion failed for data object "
523 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
524 <<" Returning NULL DataObject pointer " << endmsg;
525 }
526 setObject(objLock, 0, true);
527 return 0;
528 }
529
530 DataBucketBase* bucket = dynamic_cast<DataBucketBase*>(obju.get());
531 if (m_t2p) {
532 if (bucket) {
533 void* payload = bucket->object();
534 m_t2p->t2pRegister(payload, this);
535 m_errno=ALLOK;
536
537 // Register bases as well.
538 const SG::BaseInfoBase* bi = SG::BaseInfoBase::find (m_tAddress.clID());
539 if (bi) {
540 std::vector<CLID> base_clids = bi->get_bases();
541 for (unsigned i=0; i < base_clids.size(); ++i) {
542 // nb. DataProxy_cast here will give an infinite recursion!
543 void* bobj = SG::Storable_cast (obju.get(), base_clids[i], nullptr, true);
544 if (bobj && bobj != payload)
545 m_t2p->t2pRegister (bobj, this);
546 }
547 }
548 }
549 else {
550 MsgStream gLog(m_ims, "DataProxy");
551 gLog << MSG::ERROR
552 << "accessData: ERROR registering object in t2p map"
553 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
554 <<" Returning NULL DataObject pointer " << endmsg;
555 obju.reset();
556 m_errno=T2PREGFAILED;
557 }
558 }
559
560 // Must get everything else set up before setting m_dObject, because
561 // once we set it, it's immediately visible to other threads.
562 // In particular, we were previously doing this before the t2p registration.
563 // This meant that another thread could retrieve the pointer from
564 // the proxy, but then fail trying to map the pointer back to the proxy.
565 // See ATEAM-1126.
566 std::atomic_thread_fence (std::memory_order_seq_cst);
567 setObject(objLock, obju.release(), true);
568
569 return m_dObject;
570}
#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
std::atomic< DataObject * > m_dObject
Definition DataProxy.h:323
objMutex_t m_objMutex
Definition DataProxy.h:356
T2pMap * m_t2p
Definition DataProxy.h:329
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)

◆ addRef()

unsigned long DataProxy::addRef ( )
finaloverridevirtual

Add reference to object.

Definition at line 289 of file DataProxy.cxx.

290{
292 return ++m_refCount;
293}
unsigned int m_refCount
Definition DataProxy.h:306
std::lock_guard< mutex_t > lock_t
Definition DataProxy.h:341
mutex_t m_mutex
Definition DataProxy.h:342
virtual void lock() override
Lock the container.

◆ 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 185 of file DataProxy.cxx.

185 {
186 assert(ir);
188 if (ir->isSet()) {
189 return false;
190 } else {
191 m_handles.push_back(ir);
192 m_boundHandles = true;
193 if (IProxyDict* store = m_store)
194 store->boundHandle(ir);
195 return true;
196 }
197}
handleList_t m_handles
Definition DataProxy.h:333
bool m_boundHandles
True if there are any bound handles.
Definition DataProxy.h:316
IProxyDict * store()
Return the store of which we're a part.
std::atomic< IProxyDict * > m_store
The store of which we are a part.
Definition DataProxy.h:347
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 705 of file DataProxy.cxx.

706{
707 IProxyDict* store = m_store;
708 if (store) {
709 static const SG::sgkey_t ctxkey =
710 store->stringToKey ("EventContext", ClassID_traits<EventContext>::ID());
711 SG::DataProxy* proxy = store->proxy_exact (ctxkey);
712 if (proxy && proxy->object()) {
713 EventContext* ctx = SG::DataProxy_cast<EventContext> (proxy);
714 if (ctx) return *ctx;
715 }
716 }
717 static const EventContext emptyContext;
718 return emptyContext;
719}
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
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 226 of file DataProxy.cxx.

227{
228 handleList_t handles;
229 {
230 objLock_t objLock (m_objMutex);
232 m_const=false; //hack to force the resetting of proxy ptr in VarHandleBase
233
234 handles = m_handles;
235
236 DataObject* dobj = m_dObject;
237 resetGaudiRef(dobj);
238 m_dObject = dobj;
239 resetGaudiRef(m_dataLoader);
240
241 if (m_handles.empty()) {
242 m_boundHandles = false;
243 }
244 }
245
246 for (auto ih: handles) {
247 if (0 != ih) ih->finalReset();
248 }
249}
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 574 of file DataProxy.cxx.

575{
576 // Looking up the context is relatively expensive.
577 // So first try isValid() without the context.
578 {
580 if (const_cast<DataProxy*>(this)->m_tAddress.isValid(nullptr)) {
581 return true;
582 }
583 }
584 // Get the context. (Must not be holding m_mutex here.)
585 const EventContext& ctx = contextFromStore();
586 // Try again with the context.
588 return const_cast<DataProxy*>(this)->m_tAddress.isValid(&ctx);
589}
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 687 of file DataProxy.cxx.

688{
689 DataObject* dobj = m_dObject;
690 DataBucketBase* bucket = dynamic_cast<DataBucketBase*>(dobj);
691 if (bucket)
692 bucket->lock();
693}
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 403 of file DataProxy.cxx.

404{
405 // Public wrapper for readData().
406 objLock_t objLock (m_objMutex);
407 return readData (objLock, nullptr);
408}

◆ 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 422 of file DataProxy.cxx.

423{
424 if (errNo) {
425 if (*errNo == RECURSIVEREAD) {
426 // This can end up being called from noexcept functions.
427 // Creating a MsgStream can throw an exception --- don't let
428 // it escape.
429 try {
430 MsgStream gLog(m_ims, "DataProxy");
431 gLog << MSG::ERROR
432 << "readData: ERROR recursive read for object"
433 <<m_tAddress.clID() << '/' << m_tAddress.name() << '\n'
434 <<" Returning NULL DataObject pointer " << endmsg;
435 }
436 catch (const GaudiException&) {
437 std::cerr << "DataProxy::readData: Problem creating MsgStream\n";
438 }
439 return nullptr;
440 }
442 }
443
444 IConverter* dataLoader;
445 IProxyDict* store;
446 IOpaqueAddress* address;
447 {
449 if (0 == m_dataLoader) {
450 //MsgStream gLog(m_ims, "DataProxy");
451 //gLog << MSG::WARNING
452 // << "accessData: IConverter ptr not set" <<endmsg;
453 if (errNo) *errNo=NOCNVSVC;
454 return nullptr;
455 }
456
457 dataLoader = m_dataLoader;
458 store = m_store;
459 address = m_tAddress.address();
460 }
461
462 if (!isValidAddress()) {
463 //MsgStream gLog(m_ims, "DataProxy");
464 //gLog << MSG::WARNING
465 // << "accessData: IOA pointer not set" <<endmsg;
466 if (errNo) *errNo=NOIOA;
467 return nullptr;
468 }
469
470 SG::CurrentEventStore::Push push (store);
471
472 DataObject* obj = nullptr;
474 if (store)
475 sc = store->createObj (dataLoader, address, obj);
476 else
477 sc = dataLoader->createObj (address, obj);
478 if (sc.isSuccess()) {
479 if (errNo && *errNo == RECURSIVEREAD) *errNo = ALLOK;
480 return std::unique_ptr<DataObject>(obj);
481 }
482 if (!address) {
483 MsgStream gLog(m_ims, "DataProxy");
484 gLog << MSG::ERROR
485 << "readData: no address for " << clID() << "/" << name()
486 << " but validAddress returned true. You may be trying to retrieve"
487 << " alignments during initialization without having defined a campaign."
488 << endmsg;
489 }
490 if (errNo) *errNo = CNVFAILED;
491 return nullptr;
492}
static Double_t sc
CLID clID() const
Retrieve clid.
virtual const name_type & name() const override final
Retrieve data object key == string.
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 282 of file DataProxy.cxx.

283{
285 return m_refCount;
286}

◆ 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 674 of file DataProxy.cxx.

675{
677 if (m_t2p)
678 m_t2p->t2pRegister (p, this);
679}

◆ release()

unsigned long DataProxy::release ( )
finaloverridevirtual

release reference to object

Definition at line 296 of file DataProxy.cxx.

297{
298 unsigned long count;
299 {
301 count = --m_refCount;
302 }
303 if ( 0 == count ) delete this;
304 return count;
305}
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148

◆ 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 329 of file DataProxy.cxx.

329 {
330
331 if (m_boundHandles) {
332 resetBoundHandles(hard);
333 }
334 bool canRelease = force;
335 if (!m_resetFlag) canRelease = true;
336#if 0
337 MsgStream gLog(m_ims, "DataProxy");
338 if (gLog.level() <= MSG::VERBOSE) {
339 gLog << MSG::VERBOSE << "requestRelease(): "
340 << (canRelease ? " release " : " reset")
341 <<" object "
342 << name() << " CLID " << clID() << " address " << MSG::hex
343 << object() << MSG::dec << endmsg;
344 }
345#endif
346 if (!canRelease) {
347 resetRef();
348 }
349 return canRelease;
350}
void resetBoundHandles(bool hard)
reset the bound DataHandles If HARD is true, then the bound objects should also clear any data that d...
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 216 of file DataProxy.cxx.

217{
218 resetBoundHandles (hard);
219
220 objLock_t objLock (m_objMutex);
222 resetRef();
223}

◆ 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 252 of file DataProxy.cxx.

252 {
253 handleList_t handles;
254 {
256 // Early exit if the list is empty.
257 if (!m_boundHandles) return;
258
259 // Make a copy and drop the lock, so we're not holding the lock
260 // during the callback.
261 handles = m_handles;
262 }
263
264 for (IResetable* h : handles) {
265 h->reset(hard);
266 }
267}

◆ resetOnly()

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

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

◆ resetRef()

void DataProxy::resetRef ( )
inlineprivate

Drop the reference to the data object.

Definition at line 202 of file DataProxy.cxx.

203{
204 // Skip calling resetGaudiRef for the case where the proxy has never
205 // been defererenced.
206 if (m_dObject) {
207 DataObject* dobj = m_dObject;
208 resetGaudiRef(dobj);
209 m_dObject = dobj;
210 }
211 m_tAddress.reset();
213}

◆ setAddress() [1/2]

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

set an IOpaqueAddress

Definition at line 383 of file DataProxy.cxx.

384{
386 m_tAddress.setAddress(std::move(address));
387}

◆ setAddress() [2/2]

void DataProxy::setAddress ( IOpaqueAddress * ioa)
finaloverridevirtual

set an IOpaqueAddress

Definition at line 376 of file DataProxy.cxx.

377{
379 m_tAddress.setAddress(address);
380}

◆ 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 175 of file DataProxy.cxx.

176{
177 objLock_t objLock (m_objMutex);
179 if (!m_const) {
180 m_const = true;
181 this->lock (objLock);
182 }
183}

◆ 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 368 of file DataProxy.cxx.

369{
370 objLock_t objLock (m_objMutex);
371 setObject (objLock, dObject, doreg);
372}

◆ 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 355 of file DataProxy.cxx.

356{
357 DataObject* dobj = m_dObject;
358 setGaudiRef(dObject, dobj);
359 m_dObject = dobj;
360 if (0 != dobj) {
361 if (doreg) dobj->setRegistry(this);
362 if (m_const) this->lock (objLock);
363 }
364}

◆ 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 162 of file DataProxy.cxx.

163{
165 m_t2p = t2p;
166}

◆ 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 269 of file DataProxy.cxx.

269 {
270 assert(ir);
272 auto ifr = find(m_handles.begin(), m_handles.end(), ir );
273 if (ifr != m_handles.end()) {
274 m_handles.erase(ifr);
275 if (IProxyDict* store = m_store)
276 store->unboundHandle(ir);
277 }
278 m_boundHandles = !m_handles.empty();
279}
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140

◆ updateAddress()

bool DataProxy::updateAddress ( )

Definition at line 591 of file DataProxy.cxx.

592{
593 // Be sure to get the context before acquiring the lock.
594 const EventContext& ctx = contextFromStore();
596 return m_tAddress.isValid(&ctx, true);
597}

◆ 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.

316{};

◆ m_const

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

Is the proxy currently const?

Definition at line 319 of file DataProxy.h.

319{};

◆ m_dataLoader

IConverter* SG::DataProxy::m_dataLoader {}
private

Definition at line 327 of file DataProxy.h.

327{};

◆ m_dObject

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

Definition at line 323 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.

321{};

◆ m_refCount

unsigned int SG::DataProxy::m_refCount {}
private

Definition at line 306 of file DataProxy.h.

306{};

◆ m_resetFlag

bool SG::DataProxy::m_resetFlag = true
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.

347{};

◆ m_t2p

T2pMap* SG::DataProxy::m_t2p {}
private

Definition at line 329 of file DataProxy.h.

329{};

◆ 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: