ATLAS Offline Software
Loading...
Searching...
No Matches
DataHandleBase Class Referenceabstract

an iterator over instances of a given type in an IProxyDict (such as StoreGateSvc). More...

#include <DataHandleBase.h>

Inheritance diagram for DataHandleBase:
Collaboration diagram for DataHandleBase:

Public Types

typedef std::string ID_type

Public Member Functions

 DataHandleBase ()
 Default constructor:
 DataHandleBase (const DataHandleBase &rhs)
 Copy constructor:
DataHandleBaseoperator= (const DataHandleBase &rhs)
 Assignment operator:
 DataHandleBase (SG::DataProxy *proxy)
 Constructor with parameters:
 DataHandleBase (const SG::ConstProxyIterator &itr1, const SG::ConstProxyIterator &itr2)
virtual ~DataHandleBase ()
 Destructor:
virtual void reset (bool hard)=0
 Clear cached data from this object.
virtual void finalReset ()
 optional special action on final reset call (e.g. in caller destructor)

validity checks

SG::ConstProxyIterator m_itr
 iterator pointing at the beginning of the range of proxies
SG::ConstProxyIterator m_itrEnd
 iterator pointing at the end of the range of proxies
SG::DataProxym_proxy
 the proxy holding the object we are bound to
bool m_useItr
 use the proxy-iterator or just the proxy ?
bool isConst () const
bool isInitialized () const
 weaker test but it does not touch the disk!
virtual bool isSet () const override
virtual const std::string & key () const override
 Get the key string with which the current object was stored.
StatusCode setState (SG::DataProxy *proxy) const
StatusCode setState (IProxyDict *store, const ID_type &name) const
StatusCode setState (SG::ConstProxyIterator &itr1, const SG::ConstProxyIterator &itr2) const
virtual CLID clid () const =0
 the CLID of the object we are bound to
ID_type ID () const
 get the data object key (ID)
StatusCode setState (SG::DataProxy *proxy)
StatusCode setState (IProxyDict *store, const ID_type &name)

Detailed Description

an iterator over instances of a given type in an IProxyDict (such as StoreGateSvc).

It d-casts and caches locally the pointed-at object, to speed-up subsequent accesses. It can be reset by the store for asynchronous updates (IOVSvc)

Definition at line 37 of file DataHandleBase.h.

Member Typedef Documentation

◆ ID_type

typedef std::string DataHandleBase::ID_type

Definition at line 44 of file DataHandleBase.h.

Constructor & Destructor Documentation

◆ DataHandleBase() [1/4]

DataHandleBase::DataHandleBase ( )

Default constructor:

Definition at line 27 of file DataHandleBase.cxx.

27 :
28 IResetable(),
29 m_itr(),
30 m_itrEnd(),
31 m_proxy(0),
32 //m_ptr(0),
33 m_useItr(false)
34{}
SG::DataProxy * m_proxy
the proxy holding the object we are bound to
bool m_useItr
use the proxy-iterator or just the proxy ?
SG::ConstProxyIterator m_itrEnd
iterator pointing at the end of the range of proxies
SG::ConstProxyIterator m_itr
iterator pointing at the beginning of the range of proxies

◆ DataHandleBase() [2/4]

DataHandleBase::DataHandleBase ( const DataHandleBase & rhs)

Copy constructor:

Definition at line 37 of file DataHandleBase.cxx.

37 :
38 IResetable(),
39 m_itr(rhs.m_itr),
40 m_itrEnd(rhs.m_itrEnd),
41 m_proxy(rhs.m_proxy),
42 //m_ptr(rhs.m_ptr),
44{
45 if (m_proxy) {
46 m_proxy->addRef();
47 }
48}

◆ DataHandleBase() [3/4]

DataHandleBase::DataHandleBase ( SG::DataProxy * proxy)

Constructor with parameters:

Definition at line 74 of file DataHandleBase.cxx.

74 :
75 IResetable(),
76 m_itr(),
77 m_itrEnd(),
78 m_proxy(proxy),
79 //m_ptr(0),
80 m_useItr(false)
81{
82 if (m_proxy) {
83 m_proxy->addRef();
84 }
85}

◆ DataHandleBase() [4/4]

DataHandleBase::DataHandleBase ( const SG::ConstProxyIterator & itr1,
const SG::ConstProxyIterator & itr2 )

Definition at line 87 of file DataHandleBase.cxx.

88 :
89 IResetable(),
90 m_itr(itr),
91 m_itrEnd(itrEnd),
92 m_proxy(0),
93 //m_ptr(0),
94 m_useItr(true)
95{
96 if (m_itr != m_itrEnd) {
97 m_proxy = m_itr->second;
98 }
99
100 if (m_proxy) {
101 m_proxy->addRef();
102 }
103}

◆ ~DataHandleBase()

DataHandleBase::~DataHandleBase ( )
virtual

Destructor:

Definition at line 107 of file DataHandleBase.cxx.

108{
109 if (m_proxy != 0) {
110 m_proxy->unbindHandle(this);
111 m_proxy->release();
112 }
113}

Member Function Documentation

◆ clid()

◆ finalReset()

virtual void IResetable::finalReset ( )
inlinevirtualinherited

optional special action on final reset call (e.g. in caller destructor)

Reimplemented in SG::VarHandleBase.

Definition at line 33 of file IResetable.h.

33{};

◆ ID()

ID_type DataHandleBase::ID ( ) const
inline

get the data object key (ID)

Definition at line 94 of file DataHandleBase.h.

94{ return isInitialized() ? m_proxy->name() : "NONE"; }
bool isInitialized() const
weaker test but it does not touch the disk!

◆ isConst()

bool DataHandleBase::isConst ( ) const

Definition at line 196 of file DataHandleBase.cxx.

197{
198 return 0 != m_proxy
199 ? m_proxy->isConst()
200 : false;
201}

◆ isInitialized()

bool DataHandleBase::isInitialized ( ) const

weaker test but it does not touch the disk!

Definition at line 207 of file DataHandleBase.cxx.

208{
209 return (0 != m_proxy);
210}

◆ isSet()

virtual bool DataHandleBase::isSet ( ) const
inlineoverridevirtual

Implements IResetable.

Definition at line 77 of file DataHandleBase.h.

77{ return isInitialized(); }

◆ key()

const std::string & DataHandleBase::key ( ) const
overridevirtual

Get the key string with which the current object was stored.

Implements IResetable.

Definition at line 186 of file DataHandleBase.cxx.

187{
188 if (m_itr == m_itrEnd) {
189 return m_proxy->name();
190 } else {
191 return m_itr->first;
192 }
193}

◆ operator=()

DataHandleBase & DataHandleBase::operator= ( const DataHandleBase & rhs)

Assignment operator:

Definition at line 53 of file DataHandleBase.cxx.

54{
55 if (this != &rhs) {
56 if (m_proxy) {
57 m_proxy->release();
58 }
59
60 m_itr = rhs.m_itr;
61 m_itrEnd = rhs.m_itrEnd;
62 m_useItr = rhs.m_useItr;
63 m_proxy = rhs.m_proxy;
64 //m_ptr = rhs.m_ptr;
65 if (m_proxy) {
66 m_proxy->addRef();
67 }
68 }
69
70 return *this;
71}

◆ reset()

virtual void IResetable::reset ( bool hard)
pure virtualinherited

Clear cached data from this object.

If HARD is true, then also clear any data that depends on the identity of the current event store. HARD will be set if the handle could potentially be looking at a different store the next time it is used. (This happens in Hive.)

For example, a VarHandle caches both a pointer to the referenced object and a pointer to the DataProxy used to reference it. If HARD is false, then only the object pointer need be cleared; but if it is true, then the DataProxy pointer should be cleared as well (and the object deregistered from the store).

Implemented in DataHandle< DATA >, DataHandle< AthenaAttributeList >, DataHandle< CondMultChanCollection< AlignableTransform > >, DataHandle< GenericDbTable >, DataHandle< ILArPedestal >, DataHandle< ILArShape >, DataHandle< StrawDxContainer >, SG::UpdateHandle< T >, SG::UpdateHandle< IDCBackend >, and SG::VarHandleBase.

◆ setState() [1/5]

StatusCode DataHandleBase::setState ( IProxyDict * store,
const ID_type & name )

Definition at line 235 of file DataHandleBase.cxx.

236{
237 if (0 == store) {
238 return StatusCode::FAILURE;
239 }
240 CLID cid = this->clid();
241 SG::DataProxy* proxy = store->proxy(cid, key);
242 return this->setState(proxy);
243}
uint32_t CLID
The Class ID type.
StatusCode setState(SG::DataProxy *proxy) const
virtual const std::string & key() const override
Get the key string with which the current object was stored.
virtual CLID clid() const =0
the CLID of the object we are bound to
virtual SG::DataProxy * proxy(const void *const pTransient) const override
TestStore store
Definition TestStore.cxx:23

◆ setState() [2/5]

StatusCode DataHandleBase::setState ( IProxyDict * store,
const ID_type & name ) const

Definition at line 175 of file DataHandleBase.cxx.

176{
177 if (0 == store) {
178 return StatusCode::FAILURE;
179 }
180 CLID cid = this->clid();
181 SG::DataProxy* proxy = store->proxy(cid, key);
182 return this->setState(proxy);
183}

◆ setState() [3/5]

StatusCode DataHandleBase::setState ( SG::ConstProxyIterator & itr1,
const SG::ConstProxyIterator & itr2 ) const

Definition at line 123 of file DataHandleBase.cxx.

125{
126 if (m_proxy) m_proxy->release();
127
128 m_itr = itr;
129 m_itrEnd = itrEnd;
130 m_useItr = true;
131
132 // ouch! FIXME ?
133 // we could have a void* m_ptr data member and have a
134 // typeless_dataPointer method using the typeless machinery of
135 // DataProxy+DataBucketBase...
136 const_cast<DataHandleBase*>(this)->reset (false);
137
138 // scan from itr to itrEnd and set m_itr to the first valid iterator:
139
140 for (; itr != itrEnd; ++itr) {
141 if (itr->second->isValid()) {
142 m_itr = itr;
143 m_proxy = m_itr->second;
144 if (m_proxy) m_proxy->addRef();
145 return StatusCode::SUCCESS;
146 }
147 }
148
149 m_itr = itrEnd;
150 m_proxy = 0;
151
152 return StatusCode::FAILURE;
153}
DataHandleBase()
Default constructor:
virtual void reset(bool hard)=0
Clear cached data from this object.

◆ setState() [4/5]

StatusCode DataHandleBase::setState ( SG::DataProxy * proxy)

Definition at line 217 of file DataHandleBase.cxx.

218{
219 if (0 == proxy || !proxy->isValid() || proxy->isConst()) {
220 return StatusCode::FAILURE;
221 }
222
223 if (m_proxy != proxy) {
224 if (m_proxy) m_proxy->release();
225 m_proxy = proxy;
226 m_proxy->addRef();
227 }
228
229 m_useItr = false;
230 this->reset (false);
231 return StatusCode::SUCCESS;
232}

◆ setState() [5/5]

StatusCode DataHandleBase::setState ( SG::DataProxy * proxy) const

Definition at line 156 of file DataHandleBase.cxx.

157{
158 if (0 == proxy || !proxy->isValid()) {
159 return StatusCode::FAILURE;
160 }
161
162 if (m_proxy != proxy) {
163 if (m_proxy) m_proxy->release();
164 m_proxy = proxy;
165 m_proxy->addRef();
166 }
167
168 m_useItr = false;
169 const_cast<DataHandleBase*>(this)->reset (false);
170
171 return StatusCode::SUCCESS;
172}

Member Data Documentation

◆ m_itr

SG::ConstProxyIterator DataHandleBase::m_itr
mutableprotected

iterator pointing at the beginning of the range of proxies

Definition at line 109 of file DataHandleBase.h.

◆ m_itrEnd

SG::ConstProxyIterator DataHandleBase::m_itrEnd
mutableprotected

iterator pointing at the end of the range of proxies

Definition at line 112 of file DataHandleBase.h.

◆ m_proxy

SG::DataProxy* DataHandleBase::m_proxy
mutableprotected

the proxy holding the object we are bound to

Definition at line 115 of file DataHandleBase.h.

◆ m_useItr

bool DataHandleBase::m_useItr
mutableprotected

use the proxy-iterator or just the proxy ?

Definition at line 118 of file DataHandleBase.h.


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