ATLAS Offline Software
View.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_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 implements<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 const std::string& name() const { return m_implementation->name(); }
133 
134  //IStringPool
135  virtual IStringPool::sgkey_t stringToKey( const std::string& str, CLID clid ){ return m_implementation->stringToKey( str, clid ); }
136  virtual const std::string* keyToString( IStringPool::sgkey_t key ) const{ return m_implementation->keyToString( key ); }
137  virtual const std::string* keyToString( IStringPool::sgkey_t key, CLID& clid ) const{ return m_implementation->keyToString( key, clid ); }
138  virtual void registerKey( IStringPool::sgkey_t key, const std::string& str, CLID clid ){ m_implementation->registerKey( key, str, clid ); }
139 
142 
143 private:
144 
145 #ifdef ATHVIEWS_DEBUG
147 #else
149 #endif
150  size_t m_index;
151 };
152 } // EOF SG namespace
153 
154 
155 #include "AthenaKernel/CLASS_DEF.h"
156 
157 // Do we need to do this?
159  typedef std::vector<SG::View*> T;
161 public:
162 
163  typedef T::const_iterator const_iterator;
165  typedef T::reverse_iterator reverse_iterator;
166  typedef T::const_reference const_reference;
168  typedef T::value_type value_type;
169 
170 
172  std::for_each(m_data.begin(), m_data.end(), [](SG::View* v){ delete v; } );
173  }
174  void push_back( SG::View* ptr ) { m_data.push_back( ptr ); }
175  size_t size() const { return m_data.size(); }
176  bool empty() const { return m_data.empty(); }
177  void clear() {
178  std::for_each(m_data.begin(), m_data.end(), [](SG::View* v){ delete v; } ); m_data.clear();
179  }
180  const_iterator begin() const { return m_data.begin(); }
181  const_iterator end() const { return m_data.end(); }
182  iterator begin() { return m_data.begin(); }
183  iterator end() { return m_data.end(); }
184  reverse_iterator rbegin() { return m_data.rbegin(); }
185  reverse_iterator rend() { return m_data.rend(); }
186 
187  const_reference at(size_t pos) const { return m_data.at(pos); }
188  reference at(size_t pos) { return m_data.at(pos); }
189  const_reference back() const { return m_data.back(); }
190  reference back() { return m_data.back(); }
191 };
192 
195 
196 CLASS_DEF( ViewContainer , 1160627009 , 1 )
197 
198 #endif
ViewContainer::value_type
T::value_type value_type
Definition: View.h:168
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:188
SG::View::unboundHandle
virtual void unboundHandle(IResetable *handle)
Definition: View.h:123
SimpleView.h
ViewContainer::rbegin
reverse_iterator rbegin()
Definition: View.h:184
SG::View::proxy_exact
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const
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)
Definition: SimpleView.cxx:210
SG::View::View
View(const View &)=delete
SG::View::~View
virtual ~View()
Definition: View.cxx:28
SG::View::recordObject
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)
Definition: View.h:110
SG::View::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const
Definition: View.h:90
ViewContainer::at
const_reference at(size_t pos) const
Definition: View.h:187
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:185
SG::View::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: View.h:141
ViewContainer::end
iterator end()
Definition: View.h:183
SG::View::keyToString
virtual const std::string * keyToString(IStringPool::sgkey_t key) const
Definition: View.h:136
SG::View::impl
void impl(SimpleView *impl)
Definition: View.h:48
reference
Definition: hcg.cxx:437
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
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)
Definition: View.h:100
ViewContainer::reference
T::reference reference
Definition: View.h:167
SG::View::impl
SimpleView * impl(void)
Definition: View.h:49
SimpleView::dump
std::string dump(const std::string &indent="") const
Definition: SimpleView.cxx:237
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
ViewContainer::m_data
T m_data
Definition: View.h:160
ViewContainer::const_iterator
T::const_iterator const_iterator
Definition: View.h:163
ViewContainer::~ViewContainer
~ViewContainer()
Definition: View.h:171
ViewContainer::clear
void clear()
Definition: View.h:177
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)
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:174
SG::View::View
View()=delete
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
ViewContainer::reverse_iterator
T::reverse_iterator reverse_iterator
Definition: View.h:165
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
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)
Definition: View.h:135
SimpleView::getParentLinks
virtual const std::set< const SG::View * > & getParentLinks() const
returns the links to the previously used views
Definition: SimpleView.h:57
ViewContainer::begin
const_iterator begin() const
Definition: View.h:180
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)
Definition: View.h:138
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
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:190
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
Definition: View.h:86
ViewContainer::back
const_reference back() const
Definition: View.h:189
SimpleView::getROI
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Definition: SimpleView.cxx:233
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:164
IProxyDict.h
ViewContainer::end
const_iterator end() const
Definition: View.h:181
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:175
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
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ViewContainer::const_reference
T::const_reference const_reference
Definition: View.h:166
DebugView.h
python.PyAthena.v
v
Definition: PyAthena.py:154
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:132
SimpleView::setFilter
void setFilter(std::vector< std::string > const &inputFilter)
Set a filtering rule for anything loaded via fallthrough.
Definition: SimpleView.h:63
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:229
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:141
ViewContainer::begin
iterator begin()
Definition: View.h:182
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:45
ViewContainer::empty
bool empty() const
Definition: View.h:176
SG::View::proxies
virtual std::vector< const SG::DataProxy * > proxies() const
Definition: View.h:95
SG::View::setROI
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Definition: View.h:140
SG::View
Definition: View.h:25
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::DataProxy
Definition: DataProxy.h:45
ViewContainer::T
std::vector< SG::View * > T
Definition: View.h:159
SG::View::keyToString
virtual const std::string * keyToString(IStringPool::sgkey_t key, CLID &clid) const
Definition: View.h:137
CLASS_DEF.h
macros to associate a CLID to a type
TrigRoiDescriptorCollection.h
SG::View::m_index
size_t m_index
Definition: View.h:150
SG::View::boundHandle
virtual void boundHandle(IResetable *handle)
Definition: View.h:119
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
ViewContainer
Definition: View.h:158