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::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)
 
 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/6]

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/6]

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 }

◆ TransientAddress() [3/6]

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

Definition at line 32 of file TransientAddress.cxx.

35  : TransientAddress (id, key, addr, clearAddress, true)
36 {
37 }

◆ TransientAddress() [4/6]

TransientAddress::TransientAddress ( const TransientAddress other)

Definition at line 63 of file TransientAddress.cxx.

64  : m_clid (static_cast<CLID>(other.m_clid)),
65  m_sgkey (static_cast<sgkey_t>(other.m_sgkey)),
66  m_storeID (other.m_storeID),
67  m_clearAddress (other.m_clearAddress),
68  m_consultProvider (other.m_consultProvider),
69  m_pAddressProvider (other.m_pAddressProvider),
70  m_name (other.m_name),
71  m_transientID (other.m_transientID),
72  m_transientAlias (other.m_transientAlias)
73 {
74  m_address = nullptr;
75  setAddress (other.m_address);
76 }

◆ TransientAddress() [5/6]

TransientAddress::TransientAddress ( TransientAddress &&  other)

Destructor.

Definition at line 79 of file TransientAddress.cxx.

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

◆ ~TransientAddress()

TransientAddress::~TransientAddress ( )

Definition at line 96 of file TransientAddress.cxx.

97 {
98  setAddress(0);
99 }

◆ TransientAddress() [6/6]

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

Definition at line 40 of file TransientAddress.cxx.

44  : m_clid(id),
45  m_sgkey(0),
49  m_address(nullptr),
50  m_pAddressProvider(nullptr)
51 {
52  if (!key.empty()) {
53  m_name.store (key);
54  }
55  if (id != CLID_NULL)
56  m_transientID.push_back(id);
57  if (addr) {
58  setAddress(addr);
59  }
60 }

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

279  {
280  return m_transientAlias;
281  }

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

293  {
294  return m_clearAddress;
295  }

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

286  {
288  }

◆ clID()

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

Retrieve string key:

Retrieve clid.

Definition at line 201 of file TransientAddress.h.

202  {
203  return m_clid;
204  }

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

181 {
182  if (!forceUpdate && 0 != address()) return true;
183 
184  if (ctx && m_consultProvider && 0 != provider()) {
185  if ((provider()->updateAddress(storeID(), this, *ctx)).isSuccess())
186  return true;
187  }
188  return false;
189 }

◆ name()

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

Get the primary (hashed) SG key.

Return StoreGate key.

Definition at line 208 of file TransientAddress.h.

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

◆ operator=() [1/2]

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

Definition at line 102 of file TransientAddress.cxx.

103 {
104  if (this != &other) {
105  m_clid = static_cast<CLID>(other.m_clid);
106  m_name = other.m_name;
107  m_transientID = other.m_transientID;
108  m_transientAlias = other.m_transientAlias;
109  m_clearAddress = other.m_clearAddress;
110  m_consultProvider = other.m_consultProvider;
111  m_pAddressProvider = other.m_pAddressProvider;
112  m_storeID = other.m_storeID;
113  m_sgkey = static_cast<sgkey_t>(other.m_sgkey);
114 
115  setAddress (other.m_address);
116  }
117  return *this;
118 }

◆ operator=() [2/2]

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

Definition at line 121 of file TransientAddress.cxx.

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

◆ provider()

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

Definition at line 306 of file TransientAddress.h.

307  {
308  return m_pAddressProvider;
309  }

◆ removeAlias()

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

remove alias from proxy

remove alias

get transient alias

Definition at line 271 of file TransientAddress.h.

272  {
273  return (m_transientAlias.erase(key) == 1) ? true:false;
274  }

◆ reset()

void SG::TransientAddress::reset ( )
inline

Retrieve IOpaqueAddress.

Definition at line 187 of file TransientAddress.h.

188  {
189  if (m_clearAddress) setAddress(0);
190  }

◆ setAddress()

void TransientAddress::setAddress ( IOpaqueAddress *  pAddress)

Retrieve primary clid.

set IOpaqueAddress

Definition at line 172 of file TransientAddress.cxx.

173 {
174  if (0 != pAddress) pAddress->addRef();
175  if (0 != m_address) m_address->release();
176  m_address = pAddress;
177 }

◆ setAlias() [1/3]

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

set alias'

set transient Alias'

Definition at line 258 of file TransientAddress.h.

259  {
261  }

◆ setAlias() [2/3]

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

set alias'

set transient Alias'

Definition at line 251 of file TransientAddress.h.

252  {
253  m_transientAlias.insert(key);
254  }

◆ setAlias() [3/3]

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

set transient Alias'

Definition at line 265 of file TransientAddress.h.

266  {
267  m_transientAlias = std::move(keys);
268  }

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

162 {
163  assert (m_clid == CLID_NULL && !m_name.isValid() && m_transientID.empty() &&
164  m_transientAlias.empty());
165  m_clid = id;
166  m_name.set (key);
167  if (id != CLID_NULL)
168  m_transientID.push_back(id);
169 }

◆ setProvider()

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

Definition at line 317 of file TransientAddress.h.

319  {
321  m_consultProvider = true;
323  }

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

230  {
231  m_sgkey = sgkey;
232  }

◆ setTransientID()

void TransientAddress::setTransientID ( CLID  id)

get transient CLID's

set transient CLID's

Definition at line 142 of file TransientAddress.cxx.

143 {
144  if (m_transientID.empty()) {
145  m_transientID.push_back (id);
146  }
147  else if (!transientID (id)) {
148  m_transientID.push_back (id);
149  std::sort (m_transientID.begin(), m_transientID.end());
150  }
151 }

◆ sgkey()

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

Set the primary (hashed) SG key.

Get the primary (hashed) SG key.

Definition at line 222 of file TransientAddress.h.

223  {
224  return m_sgkey;
225  }

◆ storeID()

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

Definition at line 311 of file TransientAddress.h.

312  {
313  return m_storeID;
314  }

◆ transientID() [1/2]

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

set alias'

get transient CLID's

Definition at line 244 of file TransientAddress.h.

245  {
246  return m_transientID;
247  }

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

237  {
238  return std::find (m_transientID.begin(), m_transientID.end(), id) !=
239  m_transientID.end();
240  }

Member Data Documentation

◆ m_address

IOpaqueAddress* SG::TransientAddress::m_address
private

AddressProvider.

Definition at line 165 of file TransientAddress.h.

◆ m_clearAddress

bool SG::TransientAddress::m_clearAddress
private

Control whether the Address Provider must be consulted.

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

◆ m_consultProvider

bool SG::TransientAddress::m_consultProvider
private

IOpaqueAddress:

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

◆ m_pAddressProvider

IAddressProvider* SG::TransientAddress::m_pAddressProvider
private

string key of this object

Definition at line 168 of file TransientAddress.h.

◆ m_sgkey

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

Store type, needed by updateAddress.

Definition at line 153 of file TransientAddress.h.

◆ m_storeID

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

Controls if IOpaqueAddress should be deleted:

Definition at line 156 of file TransientAddress.h.

◆ m_transientAlias

TransientAliasSet SG::TransientAddress::m_transientAlias
private

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

◆ s_emptyString

const std::string TransientAddress::s_emptyString
staticprivate

Definition at line 179 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:150
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:311
SG::TransientAddress::m_name
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
Definition: TransientAddress.h:171
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:222
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:292
SG::TransientAddress::m_address
IOpaqueAddress * m_address
AddressProvider.
Definition: TransientAddress.h:165
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:156
SG::TransientAddress::m_transientID
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias
Definition: TransientAddress.h:174
SG::TransientAddress::m_sgkey
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
Definition: TransientAddress.h:153
SG::TransientAddress::provider
IAddressProvider * provider()
Definition: TransientAddress.h:306
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:177
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
SG::TransientAddress::m_clearAddress
bool m_clearAddress
Control whether the Address Provider must be consulted.
Definition: TransientAddress.h:159
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:172
SG::TransientAddress::transientID
const TransientClidSet & transientID() const
set alias'
Definition: TransientAddress.h:244
SG::TransientAddress::consultProvider
void consultProvider(const bool &flag)
Check the validity of the Transient Address.
Definition: TransientAddress.h:298
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:162
StoreID::UNKNOWN
@ UNKNOWN
Definition: StoreID.h:32
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
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:168
SG::TransientAddress::s_emptyString
static const std::string s_emptyString
Definition: TransientAddress.h:179
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37