ATLAS Offline Software
View.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef ATHVIEWS_VIEW_H
8 #define ATHVIEWS_VIEW_H
9 
11 #include "AthViews/SimpleView.h"
12 #include "AthViews/DebugView.h"
13 #include "AthLinks/ElementLink.h"
15 
16 // DECLARATIONS
17 namespace SG {
18  class DataProxy;
19 }
20 class DataObject;
21 
22 // rewire implementations in the constructor
23 // this is PIMPL for now
24 namespace SG {
25 class View : public IProxyDict {
26 public:
27  View () = delete;
28  View (const std::string& name, const int index, const bool AllowFallThrough = true, std::string const& storeName = "StoreGateSvc");
29  virtual ~View ();
30  View (const View&) = delete;
31  View& operator= (const View&) = delete;
32 
37  std::string viewKey (const std::string& key) const
38  {
39  return m_implementation->viewKey (key);
40  }
41 
42 
43 #ifdef ATHVIEWS_DEBUG
44  void impl ( DebugView* impl ) { m_implementation = impl; }
45  DebugView* impl (void ) { return m_implementation; }
46  const DebugView* impl ( void ) const { return m_implementation; }
47 #else
49  SimpleView* impl (void ) { return m_implementation; }
50  const SimpleView* impl ( void ) const { return m_implementation; }
51 #endif
52  size_t viewID() const{ return m_index; }
53 
58  std::string dump( const std::string& indent = "" ) const {
59  return m_implementation->dump( indent );
60  }
61 
62  /*virtual SG::DataProxy* proxy(const CLID& id) const {
63  return m_implementation->proxy(id);
64  }*/
65 
66  void linkParent( const IProxyDict* parent) {
68  }
69 
70  const std::set< const View* >& getParentLinks() const {
72  }
73 
74  void setFilter( std::vector< std::string > const& inputFilter ) {
75  m_implementation->setFilter( inputFilter );
76  }
77 
78  virtual SG::DataProxy* deep_proxy(const void* const pTransient) const {
79  return m_implementation->proxy (pTransient);
80  }
81 
84  }
85 
86  virtual SG::DataProxy* proxy(const CLID& id, const std::string& key) const {
87  return m_implementation->proxy(id, key);
88  }
89 
90  virtual SG::DataProxy* proxy(const void* const pTransient) const {
91  return m_implementation->proxy(pTransient);
92  }
93 
94 
95  virtual std::vector<const SG::DataProxy*> proxies() const {
96  return m_implementation->proxies();
97  }
98 
99 
101  return m_implementation->addToStore(id, proxy);
102  }
103 
104 
105  /*virtual SG::DataProxy* recordObject (std::unique_ptr<DataObject> obj,
106  const std::string& key,
107  bool allowMods) {
108  return m_implementation->recordObject( std::move( obj ), key, allowMods );
109  }*/
111  const std::string& key,
112  bool allowMods,
113  bool returnExisting) {
114  return m_implementation->recordObject( obj, key, allowMods, returnExisting );
115  }
116 
117 
118 
119  virtual void boundHandle (IResetable* handle) {
120  return m_implementation->boundHandle(handle);
121  }
122 
123  virtual void unboundHandle (IResetable* handle) {
124  return m_implementation->unboundHandle(handle);
125  }
126 
127  virtual bool tryELRemap (sgkey_t sgkey_in, size_t index_in,
128  sgkey_t& sgkey_out, size_t& index_out) {
129  return m_implementation->tryELRemap(sgkey_in, index_in, sgkey_out, index_out);
130  }
131 
132  virtual unsigned long addRef(){ return m_implementation->addRef(); }
133  virtual unsigned long release(){ return m_implementation->release(); }
134  virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){ return m_implementation->queryInterface(ti, pp); };
135  virtual const std::string& name() const { return m_implementation->name(); }
136 
137  //IStringPool
138  virtual IStringPool::sgkey_t stringToKey( const std::string& str, CLID clid ){ return m_implementation->stringToKey( str, clid ); }
139  virtual const std::string* keyToString( IStringPool::sgkey_t key ) const{ return m_implementation->keyToString( key ); }
140  virtual const std::string* keyToString( IStringPool::sgkey_t key, CLID& clid ) const{ return m_implementation->keyToString( key, clid ); }
141  virtual void registerKey( IStringPool::sgkey_t key, const std::string& str, CLID clid ){ m_implementation->registerKey( key, str, clid ); }
142 
145 
146 private:
147 
148 #ifdef ATHVIEWS_DEBUG
150 #else
152 #endif
153  size_t m_index;
154 };
155 } // EOF SG namespace
156 
157 
158 #include "AthenaKernel/CLASS_DEF.h"
159 
160 // Do we need to do this?
162  typedef std::vector<SG::View*> T;
164 public:
165 
166  typedef T::const_iterator const_iterator;
168  typedef T::reverse_iterator reverse_iterator;
169  typedef T::const_reference const_reference;
171  typedef T::value_type value_type;
172 
173 
175  std::for_each(m_data.begin(), m_data.end(), [](SG::View* v){ delete v; } );
176  }
177  void push_back( SG::View* ptr ) { m_data.push_back( ptr ); }
178  size_t size() const { return m_data.size(); }
179  bool empty() const { return m_data.empty(); }
180  void clear() {
181  std::for_each(m_data.begin(), m_data.end(), [](SG::View* v){ delete v; } ); m_data.clear();
182  }
183  const_iterator begin() const { return m_data.begin(); }
184  const_iterator end() const { return m_data.end(); }
185  iterator begin() { return m_data.begin(); }
186  iterator end() { return m_data.end(); }
187  reverse_iterator rbegin() { return m_data.rbegin(); }
188  reverse_iterator rend() { return m_data.rend(); }
189 
190  const_reference at(size_t pos) const { return m_data.at(pos); }
191  reference at(size_t pos) { return m_data.at(pos); }
192  const_reference back() const { return m_data.back(); }
193  reference back() { return m_data.back(); }
194 };
195 
198 
199 CLASS_DEF( ViewContainer , 1160627009 , 1 )
200 
201 #endif
SimpleView::release
virtual unsigned long release()
Definition: SimpleView.cxx:209
ViewContainer::value_type
T::value_type value_type
Definition: View.h:171
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SG::View::getParentLinks
const std::set< const View * > & getParentLinks() const
Definition: View.h:70
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG::View::operator=
View & operator=(const View &)=delete
ViewContainer::at
reference at(size_t pos)
Definition: View.h:191
SG::View::unboundHandle
virtual void unboundHandle(IResetable *handle)
Tell the store that a handle has been unbound from a proxy.
Definition: View.h:123
SG::View::addRef
virtual unsigned long addRef()
Definition: View.h:132
SimpleView.h
ViewContainer::rbegin
reverse_iterator rbegin()
Definition: View.h:187
SG::View::proxy_exact
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const
Get proxy given a hashed key+clid.
Definition: View.h:82
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
index
Definition: index.py:1
SG::View::impl
const SimpleView * impl(void) const
Definition: View.h:50
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
SG::View::View
View(const View &)=delete
SG::View::~View
virtual ~View()
Definition: View.cxx:28
SG::View::release
virtual unsigned long release()
Definition: View.h:133
SG::View::recordObject
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)
Record an object in the store.
Definition: View.h:110
SG::View::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const
Get a proxy referencing a given transient object.
Definition: View.h:90
ViewContainer::at
const_reference at(size_t pos) const
Definition: View.h:190
DeclareIndexingPolicy.h
declare to which family the container belongs as far as its indexing policy is concerned
ViewContainer::rend
reverse_iterator rend()
Definition: View.h:188
SG::View::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: View.h:144
ViewContainer::end
iterator end()
Definition: View.h:186
SG::View::keyToString
virtual const std::string * keyToString(IStringPool::sgkey_t key) const
Find the string corresponding to a given key.
Definition: View.h:139
SG::View::impl
void impl(SimpleView *impl)
Definition: View.h:48
reference
Definition: hcg.cxx:437
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
SG::View::addToStore
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy)
Add a new proxy to the store.
Definition: View.h:100
ViewContainer::reference
T::reference reference
Definition: View.h:170
SG::View::impl
SimpleView * impl(void)
Definition: View.h:49
SimpleView::dump
std::string dump(const std::string &indent="") const
Definition: SimpleView.cxx:252
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:51
ViewContainer::m_data
T m_data
Definition: View.h:163
ViewContainer::const_iterator
T::const_iterator const_iterator
Definition: View.h:166
ViewContainer::~ViewContainer
~ViewContainer()
Definition: View.h:174
ViewContainer::clear
void clear()
Definition: View.h:180
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
SG::View::linkParent
void linkParent(const IProxyDict *parent)
Definition: View.h:66
SG::View::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: View.h:127
IResetable
a resetable object (e.g. a SG DataHandle)
Definition: IResetable.h:15
ViewContainer::push_back
void push_back(SG::View *ptr)
Definition: View.h:177
SG::View::View
View()=delete
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
ViewContainer::reverse_iterator
T::reverse_iterator reverse_iterator
Definition: View.h:168
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
SG::View::viewID
size_t viewID() const
Definition: View.h:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::View::stringToKey
virtual IStringPool::sgkey_t stringToKey(const std::string &str, CLID clid)
Find the key for a string/CLID pair.
Definition: View.h:138
SimpleView::getParentLinks
virtual const std::set< const SG::View * > & getParentLinks() const
returns the links to the previously used views
Definition: SimpleView.h:58
ViewContainer::begin
const_iterator begin() const
Definition: View.h:183
SimpleView
Very simple pass-through implementation of IProxyDict.
Definition: SimpleView.h:35
SG::View::registerKey
virtual void registerKey(IStringPool::sgkey_t key, const std::string &str, CLID clid)
Remember an additional mapping from key to string/CLID.
Definition: View.h:141
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:31
SG::View::deep_proxy
virtual SG::DataProxy * deep_proxy(const void *const pTransient) const
Definition: View.h:78
ViewContainer::back
reference back()
Definition: View.h:193
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SG::View::setFilter
void setFilter(std::vector< std::string > const &inputFilter)
Definition: View.h:74
SG::View::proxy
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const
Get proxy with given id and key.
Definition: View.h:86
ViewContainer::back
const_reference back() const
Definition: View.h:192
SimpleView::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: SimpleView.cxx:248
DebugView
Very simple pass-through implementation of IProxyDict.
Definition: DebugView.h:29
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
ViewContainer::iterator
T::iterator iterator
Definition: View.h:167
IProxyDict.h
SG::View::queryInterface
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Definition: View.h:134
ViewContainer::end
const_iterator end() const
Definition: View.h:184
SG::View::dump
std::string dump(const std::string &indent="") const
for printing the content of the view
Definition: View.h:58
ViewContainer::size
size_t size() const
Definition: View.h:178
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
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SimpleView::queryInterface
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Definition: SimpleView.cxx:214
ViewContainer::const_reference
T::const_reference const_reference
Definition: View.h:169
DebugView.h
python.PyAthena.v
v
Definition: PyAthena.py:157
impl
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:46
CONTAINER_IS_SEQUENCE
#define CONTAINER_IS_SEQUENCE(CONTAINER)
Definition: DeclareIndexingPolicy.h:39
SG::View::name
virtual const std::string & name() const
Definition: View.h:135
SimpleView::setFilter
void setFilter(std::vector< std::string > const &inputFilter)
Set a filtering rule for anything loaded via fallthrough.
Definition: SimpleView.h:64
SG::View::viewKey
std::string viewKey(const std::string &key) const
Construct a key as used in the parent store.
Definition: View.h:37
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
SimpleView::setROI
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Definition: SimpleView.cxx:244
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
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
SG::View::m_implementation
SimpleView * m_implementation
Definition: View.h:144
ViewContainer::begin
iterator begin()
Definition: View.h:185
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:46
ViewContainer::empty
bool empty() const
Definition: View.h:179
SG::View::proxies
virtual std::vector< const SG::DataProxy * > proxies() const
Return the list of all current proxies in store.
Definition: View.h:95
SG::View::setROI
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Definition: View.h:143
SG::View
Definition: View.h:25
python.PyAthena.obj
obj
Definition: PyAthena.py:135
SG::DataProxy
Definition: DataProxy.h:44
ViewContainer::T
std::vector< SG::View * > T
Definition: View.h:162
SG::View::keyToString
virtual const std::string * keyToString(IStringPool::sgkey_t key, CLID &clid) const
Find the string and CLID corresponding to a given key.
Definition: View.h:140
CLASS_DEF.h
macros to associate a CLID to a type
TrigRoiDescriptorCollection.h
SG::View::m_index
size_t m_index
Definition: View.h:153
SG::View::boundHandle
virtual void boundHandle(IResetable *handle)
Tell the store that a handle has been bound to a proxy.
Definition: View.h:119
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
ViewContainer
Definition: View.h:161