 |
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/ClassID.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/Bootstrap.h"
13 #include "GaudiKernel/ISvcLocator.h"
36 m_noAudSvc(0), m_pSvcLoc(0)
50 if (!
m_pSvcLoc) std::cout<<
"DataStore::setSvcLoc: WARNING svcLocator not found! "<<std::endl;
58 const bool DONOTCREATE(
false);
80 std::unordered_set<DataProxy*> removed;
100 if (!removed.empty()) {
103 auto lock = newMap.lock();
104 auto ctx = KeyMap_t::Updater_t::defaultContext();
106 if (removed.count (
p.second) == 0) {
107 newMap.emplace (
lock,
p.first,
p.second, ctx);
122 bool includeAlias,
bool onlyValid)
125 for (
const ProxyMap::value_type&
p :
m_storeMap[
id]) {
126 bool includeProxy(
true);
127 if (onlyValid) includeProxy=
p.second->isValid();
129 if (includeProxy) vkeys.push_back(
p.first);
132 if (
p.first ==
p.second->name() && includeProxy)
133 vkeys.push_back(
p.first);
145 return StatusCode::FAILURE;
151 if (
dp->store() ==
nullptr) {
156 if (
id == 0 &&
dp->clID() == 0 &&
dp->sgkey() != 0) {
166 if (
id !=
dp->clID()) {
169 if (
dp->sgkey() == 0) {
177 return StatusCode::FAILURE;
180 pmap.insert(ProxyMap::value_type(
dp->name(),
dp));
190 return StatusCode::SUCCESS;
202 return StatusCode::FAILURE;
208 return StatusCode::SUCCESS;
227 return StatusCode::FAILURE;
247 for (
const std::string&
alias : alias_set) {
252 return StatusCode::SUCCESS;
282 for (
const std::string&
alias : alias_set) {
287 if (1 == pmap.erase(
name)) {
297 for (
CLID symclid : clids)
299 if (clid == symclid)
continue;
304 if (
it != pmap.end() &&
it->second ==
proxy) {
305 storeIter->second.erase (
it);
309 for (
const std::string&
alias : alias_set) {
325 return StatusCode::SUCCESS;
338 return StatusCode::SUCCESS;
341 dp->setTransientID(linkid);
346 if (
exist->isValidObject()) {
349 if (
exist->object() ==
dp->object()) {
350 dp->setTransientID(linkid);
351 return StatusCode::SUCCESS;
353 return StatusCode::FAILURE;
356 return StatusCode::FAILURE;
358 if (
exist->loader()) {
359 return StatusCode::FAILURE;
367 dp->setTransientID(linkid);
368 exist->setObject (
dp->object(),
false);
369 return StatusCode::SUCCESS;
374 return StatusCode::FAILURE;
381 for (
CLID clid :
dp->transientID()) {
390 if (p_iter != pmap.end() &&
dp->clID() == p_iter->second->clID()) {
391 if (
dp->name() == p_iter->second->name())
return StatusCode::SUCCESS;
392 p_iter->second->removeAlias(aliasKey);
393 p_iter->second->release();
401 dp->setAlias(aliasKey);
403 return StatusCode::SUCCESS;
411 return (storeIter->second).size();
434 const ProxyMap& pmap = siter->second;
436 if (p_iter != pmap.end()) {
444 for (
const auto& ent : pmap) {
448 else if (
p != ent.second) {
457 for (
const auto& ent : pmap) {
458 if (ent.second->clID() ==
id) {
462 else if (
p != ent.second) {
473 p = nc_store->findDummy (
id,
key);
479 p = nc_store->findDummy (
id,
key);
514 if (!pmap.insert(ProxyMap::value_type(
key,
p)).second) {
546 std::recursive_mutex&
mutex)
const
565 const std::string&
key)
const
585 const ProxyMap& pmap = storeIter->second;
588 if (pmap.size() > 0)
sc = StatusCode::SUCCESS;
603 return StatusCode::SUCCESS;
618 int i=
name.find(
'/', 0);
624 StatusCode::SUCCESS :
ProxyMap::iterator ProxyIterator
int typeCount(const CLID &id) const
Count number of object of a given type in store.
StatusCode t2pRegister(const void *const pTrans, DataProxy *const pPers)
methods to query the T2PMap:
std::string find(const std::string &s)
return a remapped string
DataProxy * locatePersistent(const void *const pTransient) const
virtual DataProxy * proxy(const TransientAddress *tAddr) const override
return proxy for a given type/key pair if key is empty returns the default proxy (currently last regi...
virtual sgkey_t stringToKey(const std::string &str, CLID clid)=0
Find the key for a string/CLID pair.
virtual StatusCode addAlias(const std::string &aliasKey, DataProxy *proxy) override
add alias to store
StoreMap m_storeMap
Maps locating proxies by clid/key.
StoreMap::const_iterator ConstStoreIterator
void clearStore(bool force, bool hard, MsgStream *pmlog)
If HARD is true, then the bound objects should also clear any data that depends on the identity of th...
TransientAddress::TransientClidSet CLIDCont_t
StatusCode removeFromKeyMap(DataProxy *proxy)
Remove a proxy from m_keyMap.
void setStore(IProxyDict *store)
Set the store of which we're a part.
std::map< std::string, DataProxy * > ProxyMap
std::vector< std::string > AliasCont_t
StoreMap::iterator StoreIterator
const std::string & name() const
Get the primary (hashed) SG key.
Abstract interface for looking up strings/CLIDs in a pool.
std::vector< DataProxy * > m_proxies
All proxies managed by this store.
::StatusCode StatusCode
StatusCode definition for legacy code.
DataProxy * findDummy(CLID id, const std::string &key)
Look for (and convert) a matching dummy proxy.
AliasCont_t alias() const
access set of proxy aliases Returns a COPY of the alias set.
CLID clID() const
Retrieve string key:
IProxyDict & m_pool
The string pool associated with this store.
SmartIF< ISGAudSvc > m_pSGAudSvc
bool t2pRegister(const void *const pTrans, DataProxy *const pPers)
StatusCode addSymLink(const CLID &linkid, DataProxy *proxy)
add symlink to store:
IStringPool::sgkey_t sgkey_t
defines an enum used by address providers to decide what kind of StoreGateSvc they are providing addr...
const std::string DEFAULTKEY
uint32_t CLID
The Class ID type.
CLID clID() const
Retrieve clid.
virtual unsigned long release() override final
release reference to object
StatusCode removeProxyImpl(DataProxy *proxy, int index)
Helper for removing a proxy.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
void keys(const CLID &id, std::vector< std::string > &vkeys, bool includeAlias, bool onlyValid)
virtual const name_type & name() const override final
Retrieve data object key == string.
DataProxy * locatePersistent(const void *const pTransient) const
locate the persistent (proxy) for a given T* (void*):
virtual StatusCode addToStore(const CLID &id, DataProxy *proxy) override
add proxy to store.
virtual SG::DataProxy * proxy_exact(sgkey_t sgkey) const override
get proxy with given key.
void reset(bool hard=false)
Other methods of DataProxy (not in Interface IRegistry):
Simple (non-deleting) Updater implementation.
bool transientID(CLID id) const
return the list of transient IDs (primary or symLinked):
Hold DataProxy instances associated with a store.
const std::vector< DataProxy * > & proxies() const
All proxies managed by this store.
virtual const std::string * keyToString(sgkey_t key) const =0
Find the string corresponding to a given key.
The non-template portion of the BaseInfo implementation.
CxxUtils::ConcurrentMap< sgkey_t, DataProxy *, CxxUtils::SimpleUpdater, SGKeyHash, SGKeyEqual, 0, s_nullval > KeyMap_t
StatusCode pRange(const CLID &id, SG::ConstProxyIterator &f, SG::ConstProxyIterator &e) const
Return an iterator over proxy for a given CLID:
StatusCode removeProxy(DataProxy *proxy, bool forceRemove, bool hard)
remove proxy from store, unless proxy is reset only.
bool isResetOnly() const
Check reset only:
#define ATLAS_THREAD_SAFE
Define macros for attributes used to control the static checker.
StatusCode tRange(ConstStoreIterator &f, ConstStoreIterator &e) const
Return an iterator over the StoreMap:
SG::DataProxy * proxy_exact_unlocked(sgkey_t sgkey, std::recursive_mutex &mutex) const
Like proxy_exact, but intended to be called without holding the store lock.
Exception — Proxy collision for clid/key.
ProxyMap::const_iterator ConstProxyIterator
A set of pointers, alowing concurrent, lockless reads.
bool is_base(CLID clid) const
Return true if clid is the ID of a class that is known to be a base of T.