ATLAS Offline Software
Loading...
Searching...
No Matches
View.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHVIEWS_VIEW_H
6#define ATHVIEWS_VIEW_H
7
8#include "GaudiKernel/ServiceHandle.h"
9
13#include "AthLinks/ElementLink.h"
14#include "SGCore/sgkey_t.h"
19
20#include <set>
21#include <vector>
22
23// Forward declarations
24namespace SG {
25 class DataProxy;
26}
27class DataObject;
28
29
30namespace SG {
31
46 class View final : public implements<IProxyDict> {
47 public:
55 View( const std::string& name, int index, bool allowFallThrough = true,
56 const std::string& storeName = "StoreGateSvc" );
57
58 View() = delete;
59 virtual ~View() = default;
60 View (const View&) = delete;
61 View& operator= (const View&) = delete;
62
66 size_t viewID() const {
67 return m_index;
68 }
69
73 void linkParent( const IProxyDict* parent );
74
78 const std::set< const SG::View* >& getParentLinks() const {
79 return m_parents;
80 }
81
86 void setFilter( std::vector< std::string > const& inputFilter ) {
87 m_fallFilter = inputFilter;
88 }
89
94 m_roi = roi;
95 }
96
101 return m_roi;
102 }
103
107 std::string dump( const std::string& indent = "" ) const;
108
109
113
117 virtual const std::string& name() const override {
118 return m_name;
119 }
120
128 virtual SG::DataProxy* proxy_exact(SG::sgkey_t sgkey) const override;
129
143 virtual SG::DataProxy* proxy(const CLID& id, const std::string& key) const override;
144
151 virtual SG::DataProxy* proxy(const void* const pTransient) const override {
152 return m_store->proxy( pTransient );
153 }
154
158 virtual std::vector<const SG::DataProxy*> proxies() const override {
159 return m_store->proxies();
160 }
161
172 virtual StatusCode addToStore(CLID id, SG::DataProxy* proxy) override {
173 return m_store->addToStore( id, proxy );
174 }
175
188 const std::string& key,
189 bool allowMods,
190 bool returnExisting) override;
191
196 virtual void boundHandle (IResetable* handle) override {
197 return m_store->boundHandle( handle );
198 }
199
204 virtual void unboundHandle (IResetable* handle) override {
205 return m_store->unboundHandle( handle );
206 }
207
218 virtual bool tryELRemap ( sgkey_t sgkey_in, size_t index_in,
219 sgkey_t& sgkey_out, size_t& index_out) override;
221
222
226
232 virtual const std::string* keyToString( IStringPool::sgkey_t key ) const override;
233
239 virtual const std::string* keyToString( IStringPool::sgkey_t key, CLID& clid ) const override;
240
244 virtual IStringPool::sgkey_t stringToKey( const std::string& str, CLID clid ) override {
245 return m_store->stringToKey( viewKey(str), clid );
246 }
247
251 virtual void registerKey( IStringPool::sgkey_t key, const std::string& str, CLID clid ) override {
252 m_store->registerKey( key, viewKey(str), clid );
253 }
254
255
256
257 private:
261 SG::DataProxy* findProxy( const CLID& id, const std::string& key, bool allowFallThrough ) const;
262
267 std::string viewKey (const std::string& key) const {
268 return SG::transientKey (m_name + "_" + key);
269 }
270
273
276
277 std::set< const SG::View* > m_parents;
278 std::vector< std::string > m_fallFilter;
279
280 std::string m_name;
281 size_t m_index{0};
283 };
284} // namespace SG
285
286
291
292CLASS_DEF( ViewContainer , 1160627009 , 1 )
293
294#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
An STL vector of pointers that by default owns its pointed-to elements.
uint32_t CLID
The Class ID type.
DataVector< SG::View > ViewContainer
View container for recording in StoreGate.
Definition View.h:290
Derived DataVector<T>.
Definition DataVector.h:795
a resetable object (e.g.
Definition IResetable.h:15
SG::sgkey_t sgkey_t
Type of the keys.
Definition IStringPool.h:34
const ElementLink< TrigRoiDescriptorCollection > & getROI() const
Return associated RoI.
Definition View.h:100
size_t m_index
Definition View.h:281
std::string m_name
Definition View.h:280
View(const std::string &name, int index, bool allowFallThrough=true, const std::string &storeName="StoreGateSvc")
Create a new View instance.
Definition View.cxx:18
virtual void unboundHandle(IResetable *handle) override
Tell the store that a handle has been unbound from a proxy.
Definition View.h:204
virtual bool tryELRemap(sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out) override
Test to see if the target of an ElementLink has moved.
Definition View.cxx:193
size_t viewID() const
Return view index.
Definition View.h:66
void setFilter(std::vector< std::string > const &inputFilter)
Set a filtering rule for anything loaded via fall-through.
Definition View.h:86
virtual const std::string * keyToString(IStringPool::sgkey_t key) const override
Find the string and CLID corresponding to a given key.
Definition View.cxx:203
void setROI(const ElementLink< TrigRoiDescriptorCollection > &roi)
Associated RoI with this view.
Definition View.h:93
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const override
Get proxy with given id and key.
Definition View.cxx:112
KeyMap_t m_keyMap
Definition View.h:275
virtual SG::DataProxy * proxy(const void *const pTransient) const override
Get a proxy referencing a given transient object.
Definition View.h:151
SG::DataProxy * findProxy(const CLID &id, const std::string &key, bool allowFallThrough) const
Internal implementation of proxy()
Definition View.cxx:121
View & operator=(const View &)=delete
const std::set< const SG::View * > & getParentLinks() const
Returns the links to the previously used views.
Definition View.h:78
virtual void boundHandle(IResetable *handle) override
Tell the store that a handle has been bound to a proxy.
Definition View.h:196
void linkParent(const IProxyDict *parent)
Link to the previously used views.
Definition View.cxx:35
virtual const std::string & name() const override
Name of the view.
Definition View.h:117
ServiceHandle< StoreGateSvc > m_store
Definition View.h:271
std::vector< std::string > m_fallFilter
Definition View.h:278
virtual ~View()=default
virtual StatusCode addToStore(CLID id, SG::DataProxy *proxy) override
Add a new proxy to the store.
Definition View.h:172
View()=delete
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
Record an object in the store.
Definition View.cxx:57
std::set< const SG::View * > m_parents
Definition View.h:277
virtual std::vector< const SG::DataProxy * > proxies() const override
Return the list of all current proxies in store.
Definition View.h:158
View(const View &)=delete
std::string viewKey(const std::string &key) const
Construct a key as used in the parent store.
Definition View.h:267
bool m_allowFallThrough
Definition View.h:282
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
Definition View.cxx:90
virtual IStringPool::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the key for a string/CLID pair.
Definition View.h:244
ElementLink< TrigRoiDescriptorCollection > m_roi
Definition View.h:272
SG::ConcurrentSGKeyMap< sgkey_t > KeyMap_t
Definition View.h:274
virtual void registerKey(IStringPool::sgkey_t key, const std::string &str, CLID clid) override
Remember an additional mapping from key to string/CLID.
Definition View.h:251
Forward declaration.
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
CxxUtils::ConcurrentMap< sgkey_t, T, CxxUtils::SimpleUpdater, SGKeyHash, SGKeyEqual, 0, s_sgkey_nullval > ConcurrentSGKeyMap
A concurrent map using sgkey_t as key.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
std::string transientKey(const std::string &key)
Make a key transient.
-event-from-file
Definition index.py:1
Additional utilities and types related to sgkey_t.