ATLAS Offline Software
Loading...
Searching...
No Matches
TransientAddress Class Reference

#include <TransientAddress.h>

Collaboration diagram for 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.
typedef std::vector< std::string > TransientAliasSet
typedef IStringPool::sgkey_t sgkey_t
 Default Constructor.

Public Member Functions

 TransientAddress ()
 Construct from clid and string key:
 TransientAddress (CLID id, const std::string &key)
 Construct from clid, key and IOpaqueAddress.
 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().
 TransientAddress (CLID id, const std::string &key, CxxUtils::RefCountedPtr< IOpaqueAddress > addr, const std::vector< CLID > &clids)
 TransientAddress (const TransientAddress &)
 TransientAddress (TransientAddress &&)
 Destructor.
 ~TransientAddress ()
TransientAddressoperator= (const TransientAddress &)
TransientAddressoperator= (TransientAddress &&)
void setID (CLID id, const std::string &key)
 Set the CLID / key.
void reset ()
 Retrieve IOpaqueAddress.
IOpaqueAddress *address ATLAS_NOT_CONST_THREAD_SAFE () const
 set IOpaqueAddress
void setAddress (CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress)
 Retrieve primary clid.
CLID clID () const
 Retrieve string key:
const std::string & name () const
 Get the primary (hashed) SG key.
sgkey_t sgkey () const
 Set the primary (hashed) SG key.
void setSGKey (sgkey_t sgkey)
 check if it is a transient ID (primary or symLinked):
bool transientID (CLID id) const
 set transient CLID's
const TransientClidSettransientID () const
 set alias'
void setTransientID (CLID id)
 get transient CLID's
void setAlias (const std::string &key)
 set alias'
void setAlias (const std::vector< std::string > &keys)
 set alias'
void setAlias (std::vector< std::string > &&keys)
 set transient Alias'
bool removeAlias (const std::string &key)
 remove alias from proxy
bool hasAlias (const std::string &key) const
 get transient alias
const TransientAliasSetalias () const
 set the clearAddress flag: IOA will not be deleted in proxy
void clearAddress (const bool &flag)
 Return the clearAddress flag.
bool clearAddress () const
 this sets the flag whether to consult the provider to update this transient address if the IOA is not valid.
void consultProvider (const bool &flag)
 Check the validity of the Transient Address.
bool isValid (const EventContext *ctx, bool forceUpdate=false)
 cache the pointer to the Address provider which can update this transient address
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)
std::atomic< sgkey_tm_sgkey
 Store type, needed by updateAddress.
StoreID::type m_storeID
 Controls if IOpaqueAddress should be deleted:
bool m_clearAddress
 Control whether the Address Provider must be consulted.
bool m_consultProvider
 IOpaqueAddress:
CxxUtils::RefCountedPtr< IOpaqueAddress > m_address
 AddressProvider.
IAddressProviderm_pAddressProvider
 string key of this object
CxxUtils::CachedValue< std::string > m_name
 all transient clids. They come from symlinks
TransientClidSet m_transientID
 all alias names for a DataObject. They come from setAlias
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()
Construct from clid and string key:

◆ 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}
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias

◆ 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}
void clearAddress(const bool &flag)
Return the clearAddress flag.

◆ 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}
uint32_t CLID
The Class ID type.
IAddressProvider * m_pAddressProvider
string key of this object
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
bool m_consultProvider
IOpaqueAddress:
TransientClidSet m_transientID
all alias names for a DataObject. They come from setAlias
StoreID::type m_storeID
Controls if IOpaqueAddress should be deleted:
CxxUtils::RefCountedPtr< IOpaqueAddress > m_address
AddressProvider.
bool m_clearAddress
Control whether the Address Provider must be consulted.
TransientAliasSet m_transientAlias
std::atomic< CLID > m_clid
< clid of the concrete class (persistent clid)
IStringPool::sgkey_t sgkey_t
Default Constructor.

◆ 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() [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}
@ UNKNOWN
Definition StoreID.h:32
CxxUtils::CachedValue< std::string > m_name
all transient clids. They come from symlinks
void consultProvider(const bool &flag)
Check the validity of the Transient Address.

◆ ~TransientAddress()

TransientAddress::~TransientAddress ( )

Definition at line 111 of file TransientAddress.cxx.

112{
113}

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 }
TransientAliasSet m_transientAlias

◆ 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 }
bool m_clearAddress
Control whether the Address Provider must be consulted.

◆ 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 }
bool flag
Definition master.py:29

◆ 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 }
std::atomic< CLID > m_clid
< clid of the concrete class (persistent clid)

◆ 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}
StoreID::type storeID() const
IAddressProvider * provider()
bool m_consultProvider
IOpaqueAddress:

◆ 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 }
static const std::string s_emptyString

◆ 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}
IAddressProvider * m_pAddressProvider
string key of this object
std::atomic< sgkey_t > m_sgkey
Store type, needed by updateAddress.
StoreID::type m_storeID
Controls if IOpaqueAddress should be deleted:
CxxUtils::RefCountedPtr< IOpaqueAddress > m_address
AddressProvider.

◆ 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{
185 if (m_clearAddress) m_address.reset();
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.

◆ 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 }
StoreID::type storeID() const
IAddressProvider * provider()

◆ 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 }
sgkey_t sgkey() const
Set the primary (hashed) SG key.

◆ 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}
bool transientID(CLID id) const
set transient CLID's
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

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