ATLAS Offline Software
SimpleView.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef ATHVIEWS_SIMPLEVIEW_H
8 #define ATHVIEWS_SIMPLEVIEW_H 1
9 
10 #include "GaudiKernel/ServiceHandle.h"
12 #include "StoreGate/StoreGateSvc.h"
13 #include "AthLinks/ElementLink.h"
15 
16 #include <string>
17 #include <set>
18 #include "tbb/concurrent_unordered_set.h"
19 #include <vector>
20 
21 namespace SG {
22  class DataProxy;
23  class View;
24 }
25 class DataObject;
26 
34 class SimpleView : public implements<IProxyDict>
35 {
36  public:
37 
38  SimpleView() = delete;
39  SimpleView( std::string const& Name, bool AllowFallThrough = true, std::string const& storeName = "StoreGateSvc" );
40  virtual ~SimpleView();
41 
46  std::string viewKey (const std::string& key) const;
47 
52  virtual void linkParent( const IProxyDict* parent );
53 
57  virtual const std::set< const SG::View* >& getParentLinks() const
58  { return m_parents; }
59 
63  void setFilter( std::vector< std::string > const& inputFilter )
64  { m_fallFilter = inputFilter; }
65 
71  virtual SG::DataProxy* deep_proxy(const void* const pTransient) const
72  { return proxy (pTransient); }
73 
81  virtual SG::DataProxy* proxy_exact (SG::sgkey_t sgkey) const;
82 
83 
97  virtual SG::DataProxy* proxy(const CLID& id, const std::string& key) const;
98 
99  // The real implementation of proxy(), with control for whole-event store access
100  virtual SG::DataProxy* findProxy( const CLID& id, const std::string& key, const bool allowFallThrough ) const;
101 
108  virtual SG::DataProxy* proxy(const void* const pTransient) const;
109 
110 
114  virtual std::vector<const SG::DataProxy*> proxies() const;
115 
116 
128 
129 
142  const std::string& key,
143  bool allowMods,
144  bool returnExisting);
145 
146 
152  virtual void boundHandle (IResetable* handle);
153 
159  virtual void unboundHandle (IResetable* handle);
160 
171  virtual bool tryELRemap ( sgkey_t sgkey_in, size_t index_in,
172  sgkey_t& sgkey_out, size_t& index_out);
173 
174  virtual const std::string& name() const;
175 
176  //IStringPool
177  virtual IStringPool::sgkey_t stringToKey( const std::string& str, CLID clid );
178  virtual const std::string* keyToString( IStringPool::sgkey_t key ) const;
179  virtual const std::string* keyToString( IStringPool::sgkey_t key, CLID& clid ) const;
180  virtual void registerKey( IStringPool::sgkey_t key, const std::string& str, CLID clid );
181 
182  // prints content of the view
183  std::string dump( const std::string& indent = "" ) const;
184 
187 
188  protected:
189  // Connection to the whole event store
191 
192  // View properties
194  std::string m_name;
195  std::set< const SG::View* > m_parents;
196  std::vector< std::string > m_fallFilter;
198 };
199 
200 #endif // ATHVIEW_SIMPLEVIEW_H
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SimpleView::m_fallFilter
std::vector< std::string > m_fallFilter
Definition: SimpleView.h:196
SimpleView::addToStore
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy)
Add a new proxy to the store.
Definition: SimpleView.cxx:146
SimpleView::tryELRemap
virtual bool tryELRemap(sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out)
Test to see if the target of an ElementLink has moved.
Definition: SimpleView.cxx:162
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SimpleView::deep_proxy
virtual SG::DataProxy * deep_proxy(const void *const pTransient) const
get proxy for a given data object address in memory, but performs a deep search among all possible 's...
Definition: SimpleView.h:71
SimpleView::stringToKey
virtual IStringPool::sgkey_t stringToKey(const std::string &str, CLID clid)
Definition: SimpleView.cxx:210
SimpleView::m_allowFallThrough
bool m_allowFallThrough
Definition: SimpleView.h:197
SimpleView::m_name
std::string m_name
Definition: SimpleView.h:194
SimpleView::unboundHandle
virtual void unboundHandle(IResetable *handle)
Tell the store that a handle has been unbound from a proxy.
Definition: SimpleView.cxx:199
IStringPool::sgkey_t
SG::sgkey_t sgkey_t
Type of the keys.
Definition: IStringPool.h:34
SimpleView::dump
std::string dump(const std::string &indent="") const
Definition: SimpleView.cxx:237
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
SimpleView::boundHandle
virtual void boundHandle(IResetable *handle)
Tell the store that a handle has been bound to a proxy.
Definition: SimpleView.cxx:189
SimpleView::m_parents
std::set< const SG::View * > m_parents
Definition: SimpleView.h:195
IResetable
a resetable object (e.g. a SG DataHandle)
Definition: IResetable.h:15
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:36
SimpleView::proxies
virtual std::vector< const SG::DataProxy * > proxies() const
Return the list of all current proxies in store.
Definition: SimpleView.cxx:130
SimpleView::registerKey
virtual void registerKey(IStringPool::sgkey_t key, const std::string &str, CLID clid)
Definition: SimpleView.cxx:224
SimpleView::proxy
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const
Get proxy with given id and key.
Definition: SimpleView.cxx:70
SimpleView::~SimpleView
virtual ~SimpleView()
Definition: SimpleView.cxx:18
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SimpleView::getParentLinks
virtual const std::set< const SG::View * > & getParentLinks() const
returns the links to the previously used views
Definition: SimpleView.h:57
SimpleView
Very simple pass-through implementation of IProxyDict.
Definition: SimpleView.h:35
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SimpleView::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: SimpleView.cxx:233
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
SimpleView::proxy_exact
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const
Get proxy given a hashed key+clid.
Definition: SimpleView.cxx:51
IProxyDict.h
SimpleView::viewKey
std::string viewKey(const std::string &key) const
Construct a key as used in the parent store.
Definition: SimpleView.cxx:27
SimpleView::recordObject
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)
Record an object in the store.
Definition: SimpleView.cxx:179
SimpleView::keyToString
virtual const std::string * keyToString(IStringPool::sgkey_t key) const
Definition: SimpleView.cxx:214
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
SimpleView::name
virtual const std::string & name() const
Definition: SimpleView.cxx:204
Name
JetDumper::Name Name
Definition: JetDumper.cxx:19
SimpleView::setFilter
void setFilter(std::vector< std::string > const &inputFilter)
Set a filtering rule for anything loaded via fallthrough.
Definition: SimpleView.h:63
SimpleView::setROI
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Definition: SimpleView.cxx:229
SimpleView::SimpleView
SimpleView()=delete
SimpleView::linkParent
virtual void linkParent(const IProxyDict *parent)
links to the previously used views through these parent views additional data objects become availabl...
Definition: SimpleView.cxx:33
str
Definition: BTagTrackIpAccessor.cxx:11
SimpleView::m_roi
ElementLink< TrigRoiDescriptorCollection > m_roi
Definition: SimpleView.h:193
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:45
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::DataProxy
Definition: DataProxy.h:45
StoreGateSvc.h
TrigRoiDescriptorCollection.h
SimpleView::m_store
ServiceHandle< StoreGateSvc > m_store
Definition: SimpleView.h:190
ServiceHandle< StoreGateSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SimpleView::findProxy
virtual SG::DataProxy * findProxy(const CLID &id, const std::string &key, const bool allowFallThrough) const
Definition: SimpleView.cxx:75