ATLAS Offline Software
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::vector< 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, CxxUtils::RefCountedPtr< IOpaqueAddress > addr, bool clearAddress=true)
 Constructor giving full list of symlinked IDs — used from DataHeaderElement::getAddress(). More...
 
 TransientAddress (CLID id, const std::string &key, CxxUtils::RefCountedPtr< 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 (CxxUtils::RefCountedPtr< 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::vector< std::string > &keys)
 set alias' More...
 
void setAlias (std::vector< std::string > &&keys)
 set transient Alias' More...
 
bool removeAlias (const std::string &key)
 remove alias from proxy More...
 
bool hasAlias (const std::string &key) const
 get transient alias 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, CxxUtils::RefCountedPtr< 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...
 
CxxUtils::RefCountedPtr< 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 33 of file TransientAddress.h.

Member Typedef Documentation

◆ sgkey_t

Default Constructor.

Definition at line 43 of file TransientAddress.h.

◆ TransientAliasSet

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

Definition at line 42 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 40 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,
CxxUtils::RefCountedPtr< 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, std::move(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,
CxxUtils::RefCountedPtr< IOpaqueAddress >  addr,
const std::vector< CLID > &  clids 
)

Definition at line 46 of file TransientAddress.cxx.

49  : TransientAddress (id, key, std::move(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 80 of file TransientAddress.cxx.

81  : m_clid (static_cast<CLID>(other.m_clid)),
82  m_sgkey (static_cast<sgkey_t>(other.m_sgkey)),
83  m_storeID (other.m_storeID),
84  m_clearAddress (other.m_clearAddress),
85  m_consultProvider (other.m_consultProvider),
86  m_address (other.m_address),
87  m_pAddressProvider (other.m_pAddressProvider),
88  m_name (other.m_name),
89  m_transientID (other.m_transientID),
90  m_transientAlias (other.m_transientAlias)
91 {
92 }

◆ TransientAddress() [6/7]

TransientAddress::TransientAddress ( TransientAddress &&  other)

Destructor.

Definition at line 95 of file TransientAddress.cxx.

96  : m_clid (static_cast<CLID>(other.m_clid)),
97  m_sgkey (static_cast<sgkey_t>(other.m_sgkey)),
98  m_storeID (other.m_storeID),
99  m_clearAddress (other.m_clearAddress),
100  m_consultProvider (other.m_consultProvider),
101  m_address (std::move (other.m_address)),
102  m_pAddressProvider (other.m_pAddressProvider),
103  m_name (std::move (other.m_name)),
104  m_transientID (std::move (other.m_transientID)),
105  m_transientAlias (std::move (other.m_transientAlias))
106 {
107 }

◆ ~TransientAddress()

TransientAddress::~TransientAddress ( )

Definition at line 111 of file TransientAddress.cxx.

112 {
113 }

◆ TransientAddress() [7/7]

TransientAddress::TransientAddress ( CLID  id,
const std::string &  key,
CxxUtils::RefCountedPtr< 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(std::move(addr)),
72  m_pAddressProvider(nullptr)
73 {
74  if (!key.empty()) {
75  m_name.store (key);
76  }
77 }

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 298 of file TransientAddress.h.

299  {
300  return m_transientAlias;
301  }

◆ 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 312 of file TransientAddress.h.

313  {
314  return m_clearAddress;
315  }

◆ 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 305 of file TransientAddress.h.

306  {
308  }

◆ 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 318 of file TransientAddress.h.

◆ hasAlias()

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

get transient alias

Test for an alias.

Definition at line 291 of file TransientAddress.h.

292  {
293  return std::ranges::binary_search (m_transientAlias, key);
294  }

◆ 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 194 of file TransientAddress.cxx.

196 {
197  if (!forceUpdate && 0 != address()) return true;
198 
199  if (ctx && m_consultProvider && 0 != provider()) {
200  if ((provider()->updateAddress(storeID(), this, *ctx)).isSuccess())
201  return true;
202  }
203  return false;
204 }

◆ 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 116 of file TransientAddress.cxx.

117 {
118  if (this != &other) {
119  m_clid = static_cast<CLID>(other.m_clid);
120  m_name = other.m_name;
121  m_transientID = other.m_transientID;
122  m_transientAlias = other.m_transientAlias;
123  m_clearAddress = other.m_clearAddress;
124  m_consultProvider = other.m_consultProvider;
125  m_pAddressProvider = other.m_pAddressProvider;
126  m_storeID = other.m_storeID;
127  m_sgkey = static_cast<sgkey_t>(other.m_sgkey);
128  m_address = other.m_address;
129  }
130  return *this;
131 }

◆ operator=() [2/2]

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

Definition at line 134 of file TransientAddress.cxx.

135 {
136  if (this != &other) {
137  m_clid = static_cast<CLID>(other.m_clid);
138  m_name = std::move (other.m_name);
139  m_transientID = std::move (other.m_transientID);
140  m_transientAlias = std::move (other.m_transientAlias);
141  m_clearAddress = other.m_clearAddress;
142  m_consultProvider = other.m_consultProvider;
143  m_pAddressProvider = other.m_pAddressProvider;
144  m_storeID = other.m_storeID;
145  m_sgkey = static_cast<sgkey_t>(other.m_sgkey);
146  m_address = std::move (other.m_address);
147  }
148  return *this;
149 }

◆ provider()

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

Definition at line 326 of file TransientAddress.h.

327  {
328  return m_pAddressProvider;
329  }

◆ removeAlias()

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

remove alias from proxy

remove alias

Test for an alias.

Definition at line 280 of file TransientAddress.h.

281  {
282  auto it = std::ranges::lower_bound (m_transientAlias, key);
283  if (it != m_transientAlias.end() && *it == key) {
284  m_transientAlias.erase (it);
285  return true;
286  }
287  return false;
288  }

◆ reset()

void TransientAddress::reset ( )

Retrieve IOpaqueAddress.

Definition at line 183 of file TransientAddress.cxx.

184 {
186 }

◆ setAddress()

void TransientAddress::setAddress ( CxxUtils::RefCountedPtr< IOpaqueAddress >  pAddress)

Retrieve primary clid.

set IOpaqueAddress

Definition at line 189 of file TransientAddress.cxx.

190 {
191  m_address = std::move(pAddress);
192 }

◆ setAlias() [1/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  auto it = std::ranges::lower_bound (m_transientAlias, key);
260  if (it == m_transientAlias.end() || *it != key) {
261  m_transientAlias.insert (it, key);
262  }
263  }

◆ setAlias() [2/3]

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

set alias'

set transient Alias'

Definition at line 267 of file TransientAddress.h.

268  {
270  }

◆ setAlias() [3/3]

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

set transient Alias'

Definition at line 274 of file TransientAddress.h.

275  {
276  m_transientAlias = std::move(keys);
277  }

◆ 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 172 of file TransientAddress.cxx.

173 {
174  assert (m_clid == CLID_NULL && !m_name.isValid() && m_transientID.empty() &&
175  m_transientAlias.empty());
176  m_clid = id;
177  m_name.set (key);
178  if (id != CLID_NULL)
179  m_transientID.push_back(id);
180 }

◆ setProvider()

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

Definition at line 337 of file TransientAddress.h.

339  {
341  m_consultProvider = true;
343  }

◆ 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 153 of file TransientAddress.cxx.

154 {
155  if (m_transientID.empty()) {
156  m_transientID.push_back (id);
157  }
158  else if (!transientID (id)) {
159  m_transientID.push_back (id);
160  std::sort (m_transientID.begin(), m_transientID.end());
161  }
162 }

◆ 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 331 of file TransientAddress.h.

332  {
333  return m_storeID;
334  }

◆ 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

CxxUtils::RefCountedPtr<IOpaqueAddress> SG::TransientAddress::m_address
private

AddressProvider.

Definition at line 177 of file TransientAddress.h.

◆ m_clearAddress

bool SG::TransientAddress::m_clearAddress
private

Control whether the Address Provider must be consulted.

Definition at line 171 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 162 of file TransientAddress.h.

◆ m_consultProvider

bool SG::TransientAddress::m_consultProvider
private

IOpaqueAddress:

Definition at line 174 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 183 of file TransientAddress.h.

◆ m_pAddressProvider

IAddressProvider* SG::TransientAddress::m_pAddressProvider
private

string key of this object

Definition at line 180 of file TransientAddress.h.

◆ m_sgkey

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

Store type, needed by updateAddress.

Definition at line 165 of file TransientAddress.h.

◆ m_storeID

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

Controls if IOpaqueAddress should be deleted:

Definition at line 168 of file TransientAddress.h.

◆ m_transientAlias

TransientAliasSet SG::TransientAddress::m_transientAlias
private

Definition at line 189 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 186 of file TransientAddress.h.

◆ s_emptyString

const std::string TransientAddress::s_emptyString
staticprivate

Definition at line 191 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:162
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
CxxUtils::RefCountedPtr::reset
void reset(T *ptr=nullptr)
Change the pointer.
SG::TransientAddress::storeID
StoreID::type storeID() const
Definition: TransientAddress.h:331
SG::TransientAddress::m_name
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
Definition: TransientAddress.h:183
SG::TransientAddress::m_address
CxxUtils::RefCountedPtr< IOpaqueAddress > m_address
AddressProvider.
Definition: TransientAddress.h:177
CxxUtils::CachedValue::isValid
bool isValid() const
Test to see if the value is valid.
skel.it
it
Definition: skel.GENtoEVGEN.py:407
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:312
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:168
SG::TransientAddress::m_transientID
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias
Definition: TransientAddress.h:186
SG::TransientAddress::m_sgkey
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
Definition: TransientAddress.h:165
SG::TransientAddress::provider
IAddressProvider * provider()
Definition: TransientAddress.h:326
master.flag
bool flag
Definition: master.py:29
SG::TransientAddress::sgkey_t
IStringPool::sgkey_t sgkey_t
Default Constructor.
Definition: TransientAddress.h:43
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:189
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:171
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::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:318
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:174
StoreID::UNKNOWN
@ UNKNOWN
Definition: StoreID.h:32
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
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:180
SG::TransientAddress::s_emptyString
static const std::string s_emptyString
Definition: TransientAddress.h:191
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37