ATLAS Offline Software
SimpleView.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 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 IProxyDict
35 {
36  public:
38 
39  SimpleView() = delete;
40  SimpleView( std::string const& Name, bool AllowFallThrough = true, std::string const& storeName = "StoreGateSvc" );
41  virtual ~SimpleView();
42 
47  std::string viewKey (const std::string& key) const;
48 
53  virtual void linkParent( const IProxyDict* parent );
54 
58  virtual const std::set< const SG::View* >& getParentLinks() const
59  { return m_parents; }
60 
64  void setFilter( std::vector< std::string > const& inputFilter )
65  { m_fallFilter = inputFilter; }
66 
72  virtual SG::DataProxy* deep_proxy(const void* const pTransient) const
73  { return proxy (pTransient); }
74 
82  virtual SG::DataProxy* proxy_exact (SG::sgkey_t sgkey) const;
83 
84 
98  virtual SG::DataProxy* proxy(const CLID& id, const std::string& key) const;
99 
100  // The real implementation of proxy(), with control for whole-event store access
101  virtual SG::DataProxy* findProxy( const CLID& id, const std::string& key, const bool allowFallThrough ) const;
102 
109  virtual SG::DataProxy* proxy(const void* const pTransient) const;
110 
111 
115  virtual std::vector<const SG::DataProxy*> proxies() const;
116 
117 
129 
130 
143  const std::string& key,
144  bool allowMods,
145  bool returnExisting);
146 
147 
153  virtual void boundHandle (IResetable* handle);
154 
160  virtual void unboundHandle (IResetable* handle);
161 
172  virtual bool tryELRemap ( sgkey_t sgkey_in, size_t index_in,
173  sgkey_t& sgkey_out, size_t& index_out);
174 
175  virtual unsigned long addRef();
176  virtual unsigned long release();
177  virtual StatusCode queryInterface( const InterfaceID &ti, void** pp );
178  virtual const std::string& name() const;
179 
180  //IStringPool
181  virtual IStringPool::sgkey_t stringToKey( const std::string& str, CLID clid );
182  virtual const std::string* keyToString( IStringPool::sgkey_t key ) const;
183  virtual const std::string* keyToString( IStringPool::sgkey_t key, CLID& clid ) const;
184  virtual void registerKey( IStringPool::sgkey_t key, const std::string& str, CLID clid );
185 
186  // prints content of the view
187  std::string dump( const std::string& indent = "" ) const;
188 
191 
192  protected:
193  // Connection to the whole event store
195 
196  // View properties
198  std::string m_name;
199  std::set< const SG::View* > m_parents;
200  std::vector< std::string > m_fallFilter;
202 };
203 
204 #endif // ATHVIEW_SIMPLEVIEW_H
SimpleView::release
virtual unsigned long release()
Definition: SimpleView.cxx:209
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SimpleView::m_fallFilter
std::vector< std::string > m_fallFilter
Definition: SimpleView.h:200
SimpleView::addToStore
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy)
Add a new proxy to the store.
Definition: SimpleView.cxx:146
SimpleView::DeclareInterfaceID
DeclareInterfaceID(SimpleView, 2, 0)
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:72
SimpleView::stringToKey
virtual IStringPool::sgkey_t stringToKey(const std::string &str, CLID clid)
Find the key for a string/CLID pair.
Definition: SimpleView.cxx:225
SimpleView::m_allowFallThrough
bool m_allowFallThrough
Definition: SimpleView.h:201
SimpleView::m_name
std::string m_name
Definition: SimpleView.h:198
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:252
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:51
SimpleView::addRef
virtual unsigned long addRef()
Definition: SimpleView.cxx:204
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:199
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:18
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)
Remember an additional mapping from key to string/CLID.
Definition: SimpleView.cxx:239
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:58
SimpleView
Very simple pass-through implementation of IProxyDict.
Definition: SimpleView.h:35
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:31
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SimpleView::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: SimpleView.cxx:248
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
Find the string corresponding to a given key.
Definition: SimpleView.cxx:229
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:219
SimpleView::queryInterface
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Definition: SimpleView.cxx:214
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:64
SimpleView::setROI
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Definition: SimpleView.cxx:244
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:197
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:46
python.PyAthena.obj
obj
Definition: PyAthena.py:135
SG::DataProxy
Definition: DataProxy.h:44
StoreGateSvc.h
TrigRoiDescriptorCollection.h
SimpleView::m_store
ServiceHandle< StoreGateSvc > m_store
Definition: SimpleView.h:194
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