|  | 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" 
   35     m_noAudSvc(0), m_pSvcLoc(0)
 
   49   if (!
m_pSvcLoc) std::cout<<
"DataStore::setSvcLoc: WARNING svcLocator not found! "<<std::endl;
 
   57       const bool DONOTCREATE(
false);
 
   79   std::unordered_set<DataProxy*> removed;
 
   99   if (!removed.empty()) {
 
  102       auto lock = newMap.lock();
 
  103       auto ctx = KeyMap_t::Updater_t::defaultContext();
 
  105         if (removed.count (
p.second) == 0) {
 
  106           newMap.emplace (
lock, 
p.first, 
p.second, ctx);
 
  121              bool includeAlias, 
bool onlyValid)
 
  124   for (
const ProxyMap::value_type& 
p : 
m_storeMap[
id]) {
 
  125     bool includeProxy(
true);
 
  126     if (onlyValid) includeProxy=
p.second->isValid();
 
  128       if (includeProxy) vkeys.push_back(
p.first);
 
  131       if (
p.first == 
p.second->name() && includeProxy) 
 
  132     vkeys.push_back(
p.first);
 
  144     return StatusCode::FAILURE;
 
  150   if (
dp->store() == 
nullptr) {
 
  155   if (
id == 0 && 
dp->clID() == 0 && 
dp->sgkey() != 0) {
 
  165     if (
id != 
dp->clID()) {
 
  168     if (
dp->sgkey() == 0) {
 
  176       return StatusCode::FAILURE;
 
  179     pmap.insert(ProxyMap::value_type(
dp->name(), 
dp));
 
  189   return StatusCode::SUCCESS;
 
  201     return StatusCode::FAILURE;
 
  207     return StatusCode::SUCCESS;
 
  226     return StatusCode::FAILURE;
 
  246     for (
const std::string& 
alias : alias_set) {
 
  251   return StatusCode::SUCCESS;
 
  281     for (
const std::string& 
alias : alias_set) {
 
  286     if (1 == pmap.erase(
name)) {
 
  296   for (
CLID symclid : clids) 
 
  298     if (clid == symclid) 
continue;
 
  303       if (
it != pmap.end() && 
it->second == 
proxy) {
 
  304         storeIter->second.erase (
it);
 
  308       for (
const std::string& 
alias : alias_set) {
 
  324   return StatusCode::SUCCESS;
 
  337     return StatusCode::SUCCESS;
 
  340     dp->setTransientID(linkid); 
 
  345   if (
exist->isValidObject()) {
 
  348     if (
exist->object() == 
dp->object()) {
 
  349       dp->setTransientID(linkid); 
 
  350       return StatusCode::SUCCESS;
 
  352     return StatusCode::FAILURE;
 
  355     return StatusCode::FAILURE;
 
  357   if (
exist->loader()) {
 
  358     return StatusCode::FAILURE;
 
  366     dp->setTransientID(linkid);
 
  367     exist->setObject (
dp->object(), 
false);
 
  368     return StatusCode::SUCCESS;
 
  373   return StatusCode::FAILURE;
 
  380   for (
CLID clid : 
dp->transientID()) {
 
  389     if (p_iter != pmap.end() && 
dp->clID() == p_iter->second->clID()) {
 
  390       if (
dp->name() == p_iter->second->name()) 
return StatusCode::SUCCESS;
 
  391       p_iter->second->removeAlias(aliasKey);
 
  392       p_iter->second->release();
 
  400   dp->setAlias(aliasKey);
 
  402   return StatusCode::SUCCESS;
 
  410   return (storeIter->second).size();
 
  433     const ProxyMap& pmap = siter->second;
 
  435     if (p_iter != pmap.end()) {
 
  443       for (
const auto& ent : pmap) {
 
  447         else if (
p != ent.second) {
 
  456         for (
const auto& ent : pmap) {
 
  457           if (ent.second->clID() == 
id) {
 
  461             else if (
p != ent.second) {
 
  472       p = nc_store->findDummy (
id, 
key);
 
  478     p = nc_store->findDummy (
id, 
key);
 
  513     if (!pmap.insert(ProxyMap::value_type(
key, 
p)).second) {
 
  545                                             std::recursive_mutex& 
mutex)
 const 
  564                                   const std::string& 
key)
 const 
  584     const ProxyMap& pmap = storeIter->second;
 
  587     if (pmap.size() > 0) 
sc = StatusCode::SUCCESS;
 
  602   return StatusCode::SUCCESS;
 
  617     int i=
name.find(
'/', 0);
 
  623             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
ConcurrentSGKeyMap< DataProxy * > KeyMap_t
Map of hashed sgkey -> DataProxy.
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):
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.
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.