|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "GaudiKernel/ClassID.h"
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/Bootstrap.h"
12 #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);
79 std::unordered_set<DataProxy*> saved;
101 auto lock = newMap.lock();
102 auto ctx = KeyMap_t::Updater_t::defaultContext();
104 if (saved.count (
p.second)) {
105 newMap.emplace (lock,
p.first,
p.second, ctx);
119 bool includeAlias,
bool onlyValid)
122 for (
const ProxyMap::value_type&
p :
m_storeMap[
id]) {
123 bool includeProxy(
true);
124 if (onlyValid) includeProxy=
p.second->isValid();
126 if (includeProxy) vkeys.push_back(
p.first);
129 if (
p.first ==
p.second->name() && includeProxy)
130 vkeys.push_back(
p.first);
142 return StatusCode::FAILURE;
148 if (
dp->store() ==
nullptr) {
153 if (
id == 0 &&
dp->clID() == 0 &&
dp->sgkey() != 0) {
163 if (
id !=
dp->clID()) {
166 if (
dp->sgkey() == 0) {
174 return StatusCode::FAILURE;
177 pmap.insert(ProxyMap::value_type(
dp->name(),
dp));
187 return StatusCode::SUCCESS;
199 return StatusCode::FAILURE;
205 return StatusCode::SUCCESS;
224 return StatusCode::FAILURE;
244 for (
const std::string&
alias : alias_set) {
249 return StatusCode::SUCCESS;
280 for (
const std::string&
alias : alias_set) {
285 if (1 == pmap.erase(
name)) {
295 for (
CLID symclid : clids)
297 if (clid == symclid)
continue;
302 if (
it != pmap.end() &&
it->second ==
proxy) {
303 storeIter->second.erase (
it);
307 for (
const std::string&
alias : alias_set) {
323 return StatusCode::SUCCESS;
336 return StatusCode::SUCCESS;
339 dp->setTransientID(linkid);
344 if (
exist->isValidObject()) {
347 if (
exist->object() ==
dp->object()) {
348 dp->setTransientID(linkid);
349 return StatusCode::SUCCESS;
351 return StatusCode::FAILURE;
354 return StatusCode::FAILURE;
356 if (
exist->loader()) {
357 return StatusCode::FAILURE;
365 dp->setTransientID(linkid);
366 exist->setObject (
dp->object(),
false);
367 return StatusCode::SUCCESS;
372 return StatusCode::FAILURE;
379 for (
CLID clid :
dp->transientID()) {
388 if (p_iter != pmap.end() &&
dp->clID() == p_iter->second->clID()) {
389 if (
dp->name() == p_iter->second->name())
return StatusCode::SUCCESS;
390 p_iter->second->removeAlias(aliasKey);
391 p_iter->second->release();
399 dp->setAlias(aliasKey);
401 return StatusCode::SUCCESS;
409 return (storeIter->second).size();
432 const ProxyMap& pmap = siter->second;
434 if (p_iter != pmap.end()) {
442 for (
const auto& ent : pmap) {
446 else if (
p != ent.second) {
455 for (
const auto& ent : pmap) {
456 if (ent.second->clID() ==
id) {
460 else if (
p != ent.second) {
471 p = nc_store->findDummy (
id,
key);
477 p = nc_store->findDummy (
id,
key);
512 if (!pmap.insert(ProxyMap::value_type(
key,
p)).second) {
544 std::recursive_mutex&
mutex)
const
547 std::unique_lock lock (
mutex);
563 const std::string&
key)
const
583 const ProxyMap& pmap = storeIter->second;
586 if (pmap.size() > 0)
sc = StatusCode::SUCCESS;
601 return StatusCode::SUCCESS;
616 int i=
name.find(
'/', 0);
622 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 sgkey_t stringToKey(const std::string &str, CLID clid)=0
Find the key for a string/CLID pair.
StoreMap m_storeMap
Maps locating proxies by clid/key.
virtual StatusCode addToStore(const CLID &id, DataProxy *proxy)
add proxy to store.
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...
virtual DataProxy * proxy(const TransientAddress *tAddr) const
return proxy for a given type/key pair if key is empty returns the default proxy (currently last regi...
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
StoreMap::iterator StoreIterator
const std::string & name() const
Get the primary (hashed) SG key.
SG::DataProxy * proxy_exact(sgkey_t sgkey) const
get proxy with given 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*):
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.
StatusCode addAlias(const std::string &aliasKey, DataProxy *proxy)
add alias to 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.
TransientAddress::TransientAliasSet AliasCont_t
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.