Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SG::TransientAddress Class Reference

#include <TransientAddress.h>

Collaboration diagram for SG::TransientAddress:

Public Types

typedef std::vector< CLIDTransientClidSet
 Strictly a set, but there shouldn't be more than a handful of entries, so store it as a sorted vector instead. More...
 
typedef std::set< std::string > TransientAliasSet
 
typedef IStringPool::sgkey_t sgkey_t
 Default Constructor. More...
 

Public Member Functions

 TransientAddress ()
 Construct from clid and string key: More...
 
 TransientAddress (CLID id, const std::string &key)
 Construct from clid, key and IOpaqueAddress. More...
 
 TransientAddress (CLID id, const std::string &key, IOpaqueAddress *addr, bool clearAddress=true)
 Constructor giving full list of symlinked IDs — used from DataHeaderElement::getAddress(). More...
 
 TransientAddress (CLID id, const std::string &key, IOpaqueAddress *addr, const std::vector< CLID > &clids)
 
 TransientAddress (const TransientAddress &)
 
 TransientAddress (TransientAddress &&)
 Destructor. More...
 
 ~TransientAddress ()
 
TransientAddressoperator= (const TransientAddress &)
 
TransientAddressoperator= (TransientAddress &&)
 
void setID (CLID id, const std::string &key)
 Set the CLID / key. More...
 
void reset ()
 Retrieve IOpaqueAddress. More...
 
IOpaqueAddress *address ATLAS_NOT_CONST_THREAD_SAFE () const
 set IOpaqueAddress More...
 
void setAddress (IOpaqueAddress *pAddress)
 Retrieve primary clid. More...
 
CLID clID () const
 Retrieve string key: More...
 
const std::string & name () const
 Get the primary (hashed) SG key. More...
 
sgkey_t sgkey () const
 Set the primary (hashed) SG key. More...
 
void setSGKey (sgkey_t sgkey)
 check if it is a transient ID (primary or symLinked): More...
 
bool transientID (CLID id) const
 set transient CLID's More...
 
void setTransientID (CLID id)
 get transient CLID's More...
 
const TransientClidSettransientID () const
 set alias' More...
 
void setAlias (const std::string &key)
 set alias' More...
 
void setAlias (const std::set< std::string > &keys)
 set alias' More...
 
void setAlias (std::set< std::string > &&keys)
 set transient Alias' More...
 
bool removeAlias (const std::string &key)
 remove alias from proxy More...
 
const TransientAliasSetalias () const
 set the clearAddress flag: IOA will not be deleted in proxy More...
 
void clearAddress (const bool &flag)
 Return the clearAddress flag. More...
 
bool clearAddress () const
 this sets the flag whether to consult the provider to update this transient address if the IOA is not valid. More...
 
void consultProvider (const bool &flag)
 Check the validity of the Transient Address. More...
 
bool isValid (const EventContext *ctx, bool forceUpdate=false)
 cache the pointer to the Address provider which can update this transient address More...
 
IAddressProviderprovider ()
 
StoreID::type storeID () const
 
void setProvider (IAddressProvider *provider, StoreID::type storeID)
 

Private Member Functions

 TransientAddress (CLID id, const std::string &key, IOpaqueAddress *addr, bool clearAddress, bool consultProvider)
 

Private Attributes

std::atomic< CLIDm_clid
 < clid of the concrete class (persistent clid) More...
 
std::atomic< sgkey_tm_sgkey
 Store type, needed by updateAddress. More...
 
StoreID::type m_storeID
 Controls if IOpaqueAddress should be deleted: More...
 
bool m_clearAddress
 Control whether the Address Provider must be consulted. More...
 
bool m_consultProvider
 IOpaqueAddress: More...
 
IOpaqueAddress * m_address
 AddressProvider. More...
 
IAddressProviderm_pAddressProvider
 string key of this object More...
 
CxxUtils::CachedValue< std::string > m_name
 all transient clids. They come from symlinks More...
 
TransientClidSet m_transientID
 all alias names for a DataObject. They come from setAlias More...
 
TransientAliasSet m_transientAlias
 

Static Private Attributes

static const std::string s_emptyString
 

Detailed Description

Definition at line 31 of file TransientAddress.h.

Member Typedef Documentation

◆ sgkey_t

Default Constructor.

Definition at line 41 of file TransientAddress.h.

◆ TransientAliasSet

typedef std::set<std::string> SG::TransientAddress::TransientAliasSet

Definition at line 40 of file TransientAddress.h.

◆ TransientClidSet

Strictly a set, but there shouldn't be more than a handful of entries, so store it as a sorted vector instead.

Definition at line 38 of file TransientAddress.h.

Constructor & Destructor Documentation

◆ TransientAddress() [1/7]

TransientAddress::TransientAddress ( )

Construct from clid and string key:

Definition at line 18 of file TransientAddress.cxx.

19  : TransientAddress (CLID_NULL, "", nullptr, true, false)
20 {
21 }

◆ TransientAddress() [2/7]

TransientAddress::TransientAddress ( CLID  id,
const std::string &  key 
)

Construct from clid, key and IOpaqueAddress.

Definition at line 25 of file TransientAddress.cxx.

26  : TransientAddress (id, key, nullptr, true, false)
27 {
28  if (id != CLID_NULL)
29  m_transientID.push_back(id);
30 }

◆ TransientAddress() [3/7]

TransientAddress::TransientAddress ( CLID  id,
const std::string &  key,
IOpaqueAddress *  addr,
bool  clearAddress = true 
)

Constructor giving full list of symlinked IDs — used from DataHeaderElement::getAddress().

Definition at line 34 of file TransientAddress.cxx.

37  : TransientAddress (id, key, addr, clearAddress, true)
38 {
39  if (id != CLID_NULL)
40  m_transientID.push_back(id);
41 }

◆ TransientAddress() [4/7]

TransientAddress::TransientAddress ( CLID  id,
const std::string &  key,
IOpaqueAddress *  addr,
const std::vector< CLID > &  clids 
)

Definition at line 46 of file TransientAddress.cxx.

49  : TransientAddress (id, key, addr, true, true)
50 {
51  m_transientID.reserve (clids.size() + 1);
52  m_transientID = clids;
53  if (id != CLID_NULL) {
54  m_transientID.push_back (id);
55  std::ranges::sort (m_transientID);
56  }
57 }

◆ TransientAddress() [5/7]

TransientAddress::TransientAddress ( const TransientAddress other)

Definition at line 83 of file TransientAddress.cxx.

84  : m_clid (static_cast<CLID>(other.m_clid)),
85  m_sgkey (static_cast<sgkey_t>(other.m_sgkey)),
86  m_storeID (other.m_storeID),
87  m_clearAddress (other.m_clearAddress),
88  m_consultProvider (other.m_consultProvider),
89  m_pAddressProvider (other.m_pAddressProvider),
90  m_name (other.m_name),
91  m_transientID (other.m_transientID),
92  m_transientAlias (other.m_transientAlias)
93 {
94  m_address = nullptr;
95  setAddress (other.m_address);
96 }

◆ TransientAddress() [6/7]

TransientAddress::TransientAddress ( TransientAddress &&  other)

Destructor.

Definition at line 99 of file TransientAddress.cxx.

100  : m_clid (static_cast<CLID>(other.m_clid)),
101  m_sgkey (static_cast<sgkey_t>(other.m_sgkey)),
102  m_storeID (other.m_storeID),
103  m_clearAddress (other.m_clearAddress),
104  m_consultProvider (other.m_consultProvider),
105  m_pAddressProvider (other.m_pAddressProvider),
106  m_name (std::move (other.m_name)),
107  m_transientID (std::move (other.m_transientID)),
108  m_transientAlias (std::move (other.m_transientAlias))
109 {
110  m_address = other.m_address;
111  other.m_address = nullptr;
112 }

◆ ~TransientAddress()

TransientAddress::~TransientAddress ( )

Definition at line 116 of file TransientAddress.cxx.

117 {
118  setAddress(0);
119 }

◆ TransientAddress() [7/7]

TransientAddress::TransientAddress ( CLID  id,
const std::string &  key,
IOpaqueAddress *  addr,
bool  clearAddress,
bool  consultProvider 
)
private

Definition at line 62 of file TransientAddress.cxx.

66  : m_clid(id),
67  m_sgkey(0),
71  m_address(nullptr),
72  m_pAddressProvider(nullptr)
73 {
74  if (!key.empty()) {
75  m_name.store (key);
76  }
77  if (addr) {
78  setAddress(addr);
79  }
80 }

Member Function Documentation

◆ alias()

const TransientAddress::TransientAliasSet & SG::TransientAddress::alias ( ) const
inline

set the clearAddress flag: IOA will not be deleted in proxy

get transient Alias'

Definition at line 284 of file TransientAddress.h.

285  {
286  return m_transientAlias;
287  }

◆ ATLAS_NOT_CONST_THREAD_SAFE()

IOpaqueAddress* address SG::TransientAddress::ATLAS_NOT_CONST_THREAD_SAFE ( ) const

set IOpaqueAddress

◆ clearAddress() [1/2]

bool SG::TransientAddress::clearAddress ( ) const
inline

this sets the flag whether to consult the provider to update this transient address if the IOA is not valid.

Return the clearAddress flag.

Definition at line 298 of file TransientAddress.h.

299  {
300  return m_clearAddress;
301  }

◆ clearAddress() [2/2]

void SG::TransientAddress::clearAddress ( const bool &  flag)
inline

Return the clearAddress flag.

set the clearAddress flag: IOA will not be deleted in proxy

Definition at line 291 of file TransientAddress.h.

292  {
294  }

◆ clID()

CLID SG::TransientAddress::clID ( ) const
inline

Retrieve string key:

Retrieve clid.

Definition at line 207 of file TransientAddress.h.

208  {
209  return m_clid;
210  }

◆ consultProvider()

void SG::TransientAddress::consultProvider ( const bool &  flag)
inline

Check the validity of the Transient Address.

cache the pointer to the Address provider which can update this transient address

If forceUpdate is true, then call updateAddress even if we already have an address. If ctx is nullptr, we don't try to update the address.

Definition at line 304 of file TransientAddress.h.

◆ isValid()

bool TransientAddress::isValid ( const EventContext *  ctx,
bool  forceUpdate = false 
)

cache the pointer to the Address provider which can update this transient address

Definition at line 199 of file TransientAddress.cxx.

201 {
202  if (!forceUpdate && 0 != address()) return true;
203 
204  if (ctx && m_consultProvider && 0 != provider()) {
205  if ((provider()->updateAddress(storeID(), this, *ctx)).isSuccess())
206  return true;
207  }
208  return false;
209 }

◆ name()

const std::string & SG::TransientAddress::name ( ) const
inline

Get the primary (hashed) SG key.

Return StoreGate key.

Definition at line 214 of file TransientAddress.h.

215  {
216  // Most of the time, m_name is set when the TransientAddress is created
217  // and then never changed. To handle dummy proxies though, m_name
218  // can be created as blank and filled in later, but then never changed
219  // again. Used CachedValue to avoid having to use a lock for this.
220  if (m_name.isValid()) {
221  return *m_name.ptr();
222  }
223  return s_emptyString;
224  }

◆ operator=() [1/2]

TransientAddress & TransientAddress::operator= ( const TransientAddress other)

Definition at line 122 of file TransientAddress.cxx.

123 {
124  if (this != &other) {
125  m_clid = static_cast<CLID>(other.m_clid);
126  m_name = other.m_name;
127  m_transientID = other.m_transientID;
128  m_transientAlias = other.m_transientAlias;
129  m_clearAddress = other.m_clearAddress;
130  m_consultProvider = other.m_consultProvider;
131  m_pAddressProvider = other.m_pAddressProvider;
132  m_storeID = other.m_storeID;
133  m_sgkey = static_cast<sgkey_t>(other.m_sgkey);
134 
135  setAddress (other.m_address);
136  }
137  return *this;
138 }

◆ operator=() [2/2]

TransientAddress & TransientAddress::operator= ( TransientAddress &&  other)

Definition at line 141 of file TransientAddress.cxx.

142 {
143  if (this != &other) {
144  m_clid = static_cast<CLID>(other.m_clid);
145  m_name = std::move (other.m_name);
146  m_transientID = std::move (other.m_transientID);
147  m_transientAlias = std::move (other.m_transientAlias);
148  m_clearAddress = other.m_clearAddress;
149  m_consultProvider = other.m_consultProvider;
150  m_pAddressProvider = other.m_pAddressProvider;
151  m_storeID = other.m_storeID;
152  m_sgkey = static_cast<sgkey_t>(other.m_sgkey);
153 
154  m_address = other.m_address;
155  other.m_address = nullptr;
156  }
157  return *this;
158 }

◆ provider()

IAddressProvider * SG::TransientAddress::provider ( )
inline

Definition at line 312 of file TransientAddress.h.

313  {
314  return m_pAddressProvider;
315  }

◆ removeAlias()

bool SG::TransientAddress::removeAlias ( const std::string &  key)
inline

remove alias from proxy

remove alias

get transient alias

Definition at line 277 of file TransientAddress.h.

278  {
279  return (m_transientAlias.erase(key) == 1) ? true:false;
280  }

◆ reset()

void SG::TransientAddress::reset ( )
inline

Retrieve IOpaqueAddress.

Definition at line 193 of file TransientAddress.h.

194  {
195  if (m_clearAddress) setAddress(0);
196  }

◆ setAddress()

void TransientAddress::setAddress ( IOpaqueAddress *  pAddress)

Retrieve primary clid.

set IOpaqueAddress

Definition at line 192 of file TransientAddress.cxx.

193 {
194  if (0 != pAddress) pAddress->addRef();
195  if (0 != m_address) m_address->release();
196  m_address = pAddress;
197 }

◆ setAlias() [1/3]

void SG::TransientAddress::setAlias ( const std::set< std::string > &  keys)
inline

set alias'

set transient Alias'

Definition at line 264 of file TransientAddress.h.

265  {
267  }

◆ setAlias() [2/3]

void SG::TransientAddress::setAlias ( const std::string &  key)
inline

set alias'

set transient Alias'

Definition at line 257 of file TransientAddress.h.

258  {
259  m_transientAlias.insert(key);
260  }

◆ setAlias() [3/3]

void SG::TransientAddress::setAlias ( std::set< std::string > &&  keys)
inline

set transient Alias'

Definition at line 271 of file TransientAddress.h.

272  {
273  m_transientAlias = std::move(keys);
274  }

◆ setID()

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

Set the CLID / key.

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

Parameters
idThe new CLID.
keyThe new StoreGate key.

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

Definition at line 181 of file TransientAddress.cxx.

182 {
183  assert (m_clid == CLID_NULL && !m_name.isValid() && m_transientID.empty() &&
184  m_transientAlias.empty());
185  m_clid = id;
186  m_name.set (key);
187  if (id != CLID_NULL)
188  m_transientID.push_back(id);
189 }

◆ setProvider()

void SG::TransientAddress::setProvider ( IAddressProvider provider,
StoreID::type  storeID 
)
inline

Definition at line 323 of file TransientAddress.h.

325  {
327  m_consultProvider = true;
329  }

◆ setSGKey()

void SG::TransientAddress::setSGKey ( sgkey_t  sgkey)
inline

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

Set the primary (hashed) SG key.

Definition at line 235 of file TransientAddress.h.

236  {
237  m_sgkey = sgkey;
238  }

◆ setTransientID()

void TransientAddress::setTransientID ( CLID  id)

get transient CLID's

set transient CLID's

Definition at line 162 of file TransientAddress.cxx.

163 {
164  if (m_transientID.empty()) {
165  m_transientID.push_back (id);
166  }
167  else if (!transientID (id)) {
168  m_transientID.push_back (id);
169  std::sort (m_transientID.begin(), m_transientID.end());
170  }
171 }

◆ sgkey()

TransientAddress::sgkey_t SG::TransientAddress::sgkey ( ) const
inline

Set the primary (hashed) SG key.

Get the primary (hashed) SG key.

Definition at line 228 of file TransientAddress.h.

229  {
230  return m_sgkey;
231  }

◆ storeID()

StoreID::type SG::TransientAddress::storeID ( ) const
inline

Definition at line 317 of file TransientAddress.h.

318  {
319  return m_storeID;
320  }

◆ transientID() [1/2]

const TransientAddress::TransientClidSet & SG::TransientAddress::transientID ( ) const
inline

set alias'

get transient CLID's

Definition at line 250 of file TransientAddress.h.

251  {
252  return m_transientID;
253  }

◆ transientID() [2/2]

bool SG::TransientAddress::transientID ( CLID  id) const
inline

set transient CLID's

check if it is a transient ID:

Definition at line 242 of file TransientAddress.h.

243  {
244  return std::find (m_transientID.begin(), m_transientID.end(), id) !=
245  m_transientID.end();
246  }

Member Data Documentation

◆ m_address

IOpaqueAddress* SG::TransientAddress::m_address
private

AddressProvider.

Definition at line 171 of file TransientAddress.h.

◆ m_clearAddress

bool SG::TransientAddress::m_clearAddress
private

Control whether the Address Provider must be consulted.

Definition at line 165 of file TransientAddress.h.

◆ m_clid

std::atomic<CLID> SG::TransientAddress::m_clid
private

< clid of the concrete class (persistent clid)

(hashed) SG key for primary clid / key.

Definition at line 156 of file TransientAddress.h.

◆ m_consultProvider

bool SG::TransientAddress::m_consultProvider
private

IOpaqueAddress:

Definition at line 168 of file TransientAddress.h.

◆ m_name

CxxUtils::CachedValue<std::string> SG::TransientAddress::m_name
private

all transient clids. They come from symlinks

Definition at line 177 of file TransientAddress.h.

◆ m_pAddressProvider

IAddressProvider* SG::TransientAddress::m_pAddressProvider
private

string key of this object

Definition at line 174 of file TransientAddress.h.

◆ m_sgkey

std::atomic<sgkey_t> SG::TransientAddress::m_sgkey
private

Store type, needed by updateAddress.

Definition at line 159 of file TransientAddress.h.

◆ m_storeID

StoreID::type SG::TransientAddress::m_storeID
private

Controls if IOpaqueAddress should be deleted:

Definition at line 162 of file TransientAddress.h.

◆ m_transientAlias

TransientAliasSet SG::TransientAddress::m_transientAlias
private

Definition at line 183 of file TransientAddress.h.

◆ m_transientID

TransientClidSet SG::TransientAddress::m_transientID
private

all alias names for a DataObject. They come from setAlias

Definition at line 180 of file TransientAddress.h.

◆ s_emptyString

const std::string TransientAddress::s_emptyString
staticprivate

Definition at line 185 of file TransientAddress.h.


The documentation for this class was generated from the following files:
SG::TransientAddress::m_clid
std::atomic< CLID > m_clid
< clid of the concrete class (persistent clid)
Definition: TransientAddress.h:156
CxxUtils::CachedValue::ptr
const T * ptr() const
Return a pointer to the cached value.
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
SG::TransientAddress::storeID
StoreID::type storeID() const
Definition: TransientAddress.h:317
SG::TransientAddress::m_name
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
Definition: TransientAddress.h:177
CxxUtils::CachedValue::isValid
bool isValid() const
Test to see if the value is valid.
SG::TransientAddress::sgkey
sgkey_t sgkey() const
Set the primary (hashed) SG key.
Definition: TransientAddress.h:228
SG::TransientAddress::clearAddress
bool clearAddress() const
this sets the flag whether to consult the provider to update this transient address if the IOA is not...
Definition: TransientAddress.h:298
SG::TransientAddress::m_address
IOpaqueAddress * m_address
AddressProvider.
Definition: TransientAddress.h:171
CxxUtils::CachedValue::store
void store(const T &val)
Store a new value.
SG::TransientAddress::m_storeID
StoreID::type m_storeID
Controls if IOpaqueAddress should be deleted:
Definition: TransientAddress.h:162
SG::TransientAddress::m_transientID
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias
Definition: TransientAddress.h:180
SG::TransientAddress::m_sgkey
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
Definition: TransientAddress.h:159
SG::TransientAddress::provider
IAddressProvider * provider()
Definition: TransientAddress.h:312
master.flag
bool flag
Definition: master.py:29
SG::TransientAddress::sgkey_t
IStringPool::sgkey_t sgkey_t
Default Constructor.
Definition: TransientAddress.h:41
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
SG::TransientAddress::m_transientAlias
TransientAliasSet m_transientAlias
Definition: TransientAddress.h:183
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
SG::TransientAddress::m_clearAddress
bool m_clearAddress
Control whether the Address Provider must be consulted.
Definition: TransientAddress.h:165
CxxUtils::CachedValue::set
void set(const T &val) const
Set the value, assuming it is currently invalid.
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
SG::TransientAddress::setAddress
void setAddress(IOpaqueAddress *pAddress)
Retrieve primary clid.
Definition: TransientAddress.cxx:192
SG::TransientAddress::transientID
const TransientClidSet & transientID() const
set alias'
Definition: TransientAddress.h:250
SG::TransientAddress::consultProvider
void consultProvider(const bool &flag)
Check the validity of the Transient Address.
Definition: TransientAddress.h:304
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
SG::TransientAddress::m_consultProvider
bool m_consultProvider
IOpaqueAddress:
Definition: TransientAddress.h:168
StoreID::UNKNOWN
@ UNKNOWN
Definition: StoreID.h:32
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
SG::TransientAddress::TransientAddress
TransientAddress()
Construct from clid and string key:
Definition: TransientAddress.cxx:18
SG::TransientAddress::m_pAddressProvider
IAddressProvider * m_pAddressProvider
string key of this object
Definition: TransientAddress.h:174
SG::TransientAddress::s_emptyString
static const std::string s_emptyString
Definition: TransientAddress.h:185
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37