ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | List of all members
SimpleView Class Reference

Very simple pass-through implementation of IProxyDict. More...

#include <SimpleView.h>

Inheritance diagram for SimpleView:
Collaboration diagram for SimpleView:

Public Types

typedef SG::sgkey_t sgkey_t
 Type of the keys. More...
 

Public Member Functions

 DeclareInterfaceID (SimpleView, 2, 0)
 
 SimpleView ()=delete
 
 SimpleView (std::string const &Name, bool AllowFallThrough=true, std::string const &storeName="StoreGateSvc")
 
virtual ~SimpleView ()
 
std::string viewKey (const std::string &key) const
 Construct a key as used in the parent store. More...
 
virtual void linkParent (const IProxyDict *parent)
 links to the previously used views through these parent views additional data objects become available More...
 
virtual const std::set< const SG::View * > & getParentLinks () const
 returns the links to the previously used views More...
 
void setFilter (std::vector< std::string > const &inputFilter)
 Set a filtering rule for anything loaded via fallthrough. More...
 
virtual SG::DataProxydeep_proxy (const void *const pTransient) const
 get proxy for a given data object address in memory, but performs a deep search among all possible 'symlinked' containers TEMPORARY: This method is going away. More...
 
virtual SG::DataProxyproxy_exact (SG::sgkey_t sgkey) const
 Get proxy given a hashed key+clid. More...
 
virtual SG::DataProxyproxy (const CLID &id, const std::string &key) const
 Get proxy with given id and key. More...
 
virtual SG::DataProxyfindProxy (const CLID &id, const std::string &key, const bool allowFallThrough) const
 
virtual SG::DataProxyproxy (const void *const pTransient) const
 Get a proxy referencing a given transient object. More...
 
virtual std::vector< const SG::DataProxy * > proxies () const
 Return the list of all current proxies in store. More...
 
virtual StatusCode addToStore (CLID id, SG::DataProxy *proxy)
 Add a new proxy to the store. More...
 
virtual SG::DataProxyrecordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting)
 Record an object in the store. More...
 
virtual void boundHandle (IResetable *handle)
 Tell the store that a handle has been bound to a proxy. More...
 
virtual void unboundHandle (IResetable *handle)
 Tell the store that a handle has been unbound from a proxy. More...
 
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. More...
 
virtual unsigned long addRef ()
 
virtual unsigned long release ()
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 
virtual const std::string & name () const
 
virtual IStringPool::sgkey_t stringToKey (const std::string &str, CLID clid)
 Find the key for a string/CLID pair. More...
 
virtual const std::string * keyToString (IStringPool::sgkey_t key) const
 Find the string corresponding to a given key. More...
 
virtual const std::string * keyToString (IStringPool::sgkey_t key, CLID &clid) const
 Find the string and CLID corresponding to a given key. More...
 
virtual void registerKey (IStringPool::sgkey_t key, const std::string &str, CLID clid)
 Remember an additional mapping from key to string/CLID. More...
 
std::string dump (const std::string &indent="") const
 
void setROI (const ElementLink< TrigRoiDescriptorCollection > &roi)
 
const ElementLink< TrigRoiDescriptorCollection > & getROI () const
 
 DeclareInterfaceID (IProxyDict, 2, 0)
 
 DeclareInterfaceID (INamedInterface, 2, 0)
 
virtual StatusCode createObj (IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject)
 Call converter to create an object, possibly with locking. More...
 
virtual IProxyDicthiveProxyDict () override
 Return the current event-slot-specific store. More...
 
virtual SG::SourceID sourceID (const std::string &key="EventSelector") const
 Return the metadata source ID for the current event slot. More...
 

Protected Attributes

ServiceHandle< StoreGateSvcm_store
 
ElementLink< TrigRoiDescriptorCollectionm_roi
 
std::string m_name
 
std::set< const SG::View * > m_parents
 
std::vector< std::string > m_fallFilter
 
bool m_allowFallThrough
 

Detailed Description

Very simple pass-through implementation of IProxyDict.

Most of the methods are copypasta and don't do anything

Author
Ben Wynne - ATLAS

Definition at line 34 of file SimpleView.h.

Member Typedef Documentation

◆ sgkey_t

typedef SG::sgkey_t IStringPool::sgkey_t
inherited

Type of the keys.

Definition at line 34 of file IStringPool.h.

Constructor & Destructor Documentation

◆ SimpleView() [1/2]

SimpleView::SimpleView ( )
delete

◆ SimpleView() [2/2]

SimpleView::SimpleView ( std::string const Name,
bool  AllowFallThrough = true,
std::string const storeName = "StoreGateSvc" 
)

Definition at line 10 of file SimpleView.cxx.

10  :
11  m_store( storeName, Name ),
12  m_roi(),
13  m_name( Name ),
14  m_allowFallThrough( AllowFallThrough )
15 {
16 }

◆ ~SimpleView()

SimpleView::~SimpleView ( )
virtual

Definition at line 18 of file SimpleView.cxx.

19 {
20 }

Member Function Documentation

◆ addRef()

unsigned long SimpleView::addRef ( )
virtual

Definition at line 204 of file SimpleView.cxx.

205 {
206  throw std::runtime_error( "Not implemented: SimpleView::addRef" );
207  return 0;
208 }

◆ addToStore()

StatusCode SimpleView::addToStore ( CLID  id,
SG::DataProxy proxy 
)
virtual

Add a new proxy to the store.

Parameters
idCLID as which the proxy should be added.
proxyThe proxy to add.

Simple addition of a proxy to the store. The key is taken as the primary key of the proxy. Does not handle things like overwrite, history, symlinks, etc. Should return failure if there is already an entry for this clid/key.

Implements IProxyDict.

Definition at line 146 of file SimpleView.cxx.

147 {
148  return m_store->addToStore( id, proxy );
149 }

◆ boundHandle()

void SimpleView::boundHandle ( IResetable handle)
virtual

Tell the store that a handle has been bound to a proxy.

Parameters
handleThe handle that was bound. The default implementation does nothing.

Reimplemented from IProxyDict.

Definition at line 189 of file SimpleView.cxx.

190 {
191  return m_store->boundHandle( handle );
192 }

◆ createObj()

StatusCode IProxyDict::createObj ( IConverter *  cvt,
IOpaqueAddress *  addr,
DataObject *&  refpObject 
)
virtualinherited

Call converter to create an object, possibly with locking.

Parameters
cvtThe converter to call.
addrOpaque address information for the object to create.
refpObjectReference to location of the pointer of the created object.

This calls the createObj method on cvt to create the referenced transient object.

This will also lock the store, if that is required.

The default implementation just forwards the method call, with no locking.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 70 of file IProxyDict.cxx.

73 {
74  return cvt->createObj (addr, refpObject);
75 }

◆ DeclareInterfaceID() [1/3]

IHiveStore::DeclareInterfaceID ( INamedInterface  ,
,
 
)
inherited

◆ DeclareInterfaceID() [2/3]

IProxyDict::DeclareInterfaceID ( IProxyDict  ,
,
 
)
inherited

◆ DeclareInterfaceID() [3/3]

SimpleView::DeclareInterfaceID ( SimpleView  ,
,
 
)

◆ deep_proxy()

virtual SG::DataProxy* SimpleView::deep_proxy ( const void *const  pTransient) const
inlinevirtual

get proxy for a given data object address in memory, but performs a deep search among all possible 'symlinked' containers TEMPORARY: This method is going away.

Definition at line 72 of file SimpleView.h.

73  { return proxy (pTransient); }

◆ dump()

std::string SimpleView::dump ( const std::string &  indent = "") const

Definition at line 252 of file SimpleView.cxx.

252  {
253 
254  // Dump view contents
255  std::string ret = indent + "Dump " + name() + "\n";
256  ret += indent + "[";
257  for ( const SG::DataProxy* dp: proxies() ) {
258  if ( dp->name().find( name() ) == 0 )
259  ret += " " + dp->name();
260  }
261  ret += " ]\n";
262 
263  // Dump parent views
264  if ( m_parents.size() ) ret += indent + "Parents:\n";
265  for ( auto p : m_parents ) {
266  ret += p->dump( indent + " " );
267  }
268 
269  // Fallthrough
270  if ( indent == "" ) {
271  if ( m_allowFallThrough ) {
272  ret += indent + "May access main store: " + m_store->name();
273  } else {
274  ret += indent + "May not access main store";
275  }
276  }
277  return ret;
278 }

◆ findProxy()

SG::DataProxy * SimpleView::findProxy ( const CLID id,
const std::string &  key,
const bool  allowFallThrough 
) const
virtual

Reimplemented in DebugView.

Definition at line 75 of file SimpleView.cxx.

76 {
77  auto isValid = [](const SG::DataProxy* p) { return p != nullptr and p->isValid(); };
78  auto localProxy = m_store->proxy( id, viewKey(key) );
79  if ( isValid( localProxy ) ) {
80  return localProxy;
81  }
82 
83  for ( auto parent: m_parents ) {
84  // Don't allow parents to access whole-event store independently of this view
85  auto inParentProxy = parent->impl()->findProxy( id, key, false );
86  if ( isValid( inParentProxy ) ) {
87  return inParentProxy;
88  }
89  }
90 
91  //Look in the default store if cound not find in any view - for instance for event-wise IDCs
92  if ( (not isValid( localProxy )) and allowFallThrough ) {
93 
94  //Apply filtering
95  if ( m_fallFilter.size() ) {
96  bool filterPass = false;
97 
98  //Filter passes if the key contains one of the possible values
99  for ( auto& entry : m_fallFilter ) {
100  if ( key.find( entry ) != std::string::npos ) {
101  filterPass = true;
102  break;
103  }
104  }
105 
106  if ( !filterPass ) return nullptr;
107  }
108 
109  return m_store->proxy( id, key );
110  }
111  return nullptr;
112 }

◆ getParentLinks()

virtual const std::set< const SG::View* >& SimpleView::getParentLinks ( ) const
inlinevirtual

returns the links to the previously used views

Definition at line 58 of file SimpleView.h.

59  { return m_parents; }

◆ getROI()

const ElementLink< TrigRoiDescriptorCollection > & SimpleView::getROI ( ) const

Definition at line 248 of file SimpleView.cxx.

248  {
249  return m_roi;
250 }

◆ hiveProxyDict()

IProxyDict * IProxyDict::hiveProxyDict ( )
overridevirtualinherited

Return the current event-slot-specific store.

The default version just returns this.

Implements IHiveStore.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 83 of file IProxyDict.cxx.

84 {
85  return this;
86 }

◆ keyToString() [1/2]

const std::string * SimpleView::keyToString ( IStringPool::sgkey_t  key) const
virtual

Find the string corresponding to a given key.

Parameters
keyThe key to look up.
Returns
Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either stringToKey() or registerKey().

Implements IStringPool.

Definition at line 229 of file SimpleView.cxx.

230 {
231  throw std::runtime_error( "Not implemented: SimpleView::keyToString" );
232  return m_store->keyToString( key );
233 }

◆ keyToString() [2/2]

const std::string * SimpleView::keyToString ( IStringPool::sgkey_t  key,
CLID clid 
) const
virtual

Find the string and CLID corresponding to a given key.

Parameters
keyThe key to look up.
clid[out]The found CLID.
Returns
Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either stringToKey() or registerKey().

Implements IStringPool.

Definition at line 234 of file SimpleView.cxx.

235 {
236  throw std::runtime_error( "Not implemented: SimpleView::keyToString" );
237  return m_store->keyToString( key, clid );
238 }

◆ linkParent()

void SimpleView::linkParent ( const IProxyDict parent)
virtual

links to the previously used views through these parent views additional data objects become available

Reimplemented in DebugView.

Definition at line 33 of file SimpleView.cxx.

33  {
34  auto castParent = dynamic_cast< const SG::View* >( parent );
35  if ( castParent ) {
36  m_parents.insert( castParent );
37  }
38  else {
39  throw std::runtime_error( "Unable to link parent view that cannot be cast to SG::View" );
40  }
41 }

◆ name()

const std::string & SimpleView::name ( ) const
virtual

Definition at line 219 of file SimpleView.cxx.

220 {
221  return m_name;
222 }

◆ proxies()

std::vector< const SG::DataProxy * > SimpleView::proxies ( ) const
virtual

Return the list of all current proxies in store.

Implements IProxyDict.

Definition at line 130 of file SimpleView.cxx.

131 {
132  return m_store->proxies();
133 }

◆ proxy() [1/2]

SG::DataProxy * SimpleView::proxy ( const CLID id,
const std::string &  key 
) const
virtual

Get proxy with given id and key.

Parameters
idThe CLID of the desired object.
keyThe key of the desired object.

If the key is a null string, then it is a default key. Finding a proxy via the default key should succeed only if there is exactly one object with the given CLID in the store. Finding a proxy via a default key is considered deprecated for the case of the event store.

Returns 0 to flag failure

Implements IProxyDict.

Reimplemented in DebugView.

Definition at line 70 of file SimpleView.cxx.

71 {
72  return findProxy( id, key, m_allowFallThrough );
73 }

◆ proxy() [2/2]

SG::DataProxy * SimpleView::proxy ( const void *const  pTransient) const
virtual

Get a proxy referencing a given transient object.

Parameters
pTransientThe object to find.

Returns 0 to flag failure

Implements IProxyDict.

Reimplemented in DebugView.

Definition at line 121 of file SimpleView.cxx.

122 {
123  return m_store->proxy( pTransient );
124 }

◆ proxy_exact()

SG::DataProxy * SimpleView::proxy_exact ( SG::sgkey_t  sgkey) const
virtual

Get proxy given a hashed key+clid.

Parameters
sgkeyHashed key to look up.

Find an exact match; no handling of aliases, etc. Returns 0 to flag failure.

Implements IProxyDict.

Definition at line 51 of file SimpleView.cxx.

52 {
53  return nullptr;
54 }

◆ queryInterface()

StatusCode SimpleView::queryInterface ( const InterfaceID &  ti,
void **  pp 
)
virtual

Definition at line 214 of file SimpleView.cxx.

215 {
216  throw std::runtime_error( "Not implemented: SimpleView::queryInterface" );
217  return StatusCode::FAILURE;
218 }

◆ recordObject()

SG::DataProxy * SimpleView::recordObject ( SG::DataObjectSharedPtr< DataObject >  obj,
const std::string &  key,
bool  allowMods,
bool  returnExisting 
)
virtual

Record an object in the store.

Parameters
objThe data object to store.
keyThe key as which it should be stored.
allowModsIf false, the object will be recorded as const.

Full-blown record. obj should usually be something deriving from SG::DataBucket.

Returns the proxy for the recorded object; nullptr on failure.

Implements IProxyDict.

Reimplemented in DebugView.

Definition at line 179 of file SimpleView.cxx.

180 {
181  return m_store->recordObject( obj, viewKey(key), allowMods, returnExisting );
182 }

◆ registerKey()

void SimpleView::registerKey ( IStringPool::sgkey_t  key,
const std::string &  str,
CLID  clid 
)
virtual

Remember an additional mapping from key to string/CLID.

Parameters
keyThe key to enter.
strThe string to enter.
clidThe CLID associated with the string.
Returns
True if successful; false if the key already corresponds to a different string.

This registers an additional mapping from a key to a string; it can be found later through lookup() on the string. Logs an error if key already corresponds to a different string.

Implements IStringPool.

Definition at line 239 of file SimpleView.cxx.

240 {
241  m_store->registerKey( key, viewKey(str), clid );
242 }

◆ release()

unsigned long SimpleView::release ( )
virtual

Definition at line 209 of file SimpleView.cxx.

210 {
211  throw std::runtime_error( "Not implemented: SimpleView::release" );
212  return 0;
213 }

◆ setFilter()

void SimpleView::setFilter ( std::vector< std::string > const inputFilter)
inline

Set a filtering rule for anything loaded via fallthrough.

Definition at line 64 of file SimpleView.h.

65  { m_fallFilter = inputFilter; }

◆ setROI()

void SimpleView::setROI ( const ElementLink< TrigRoiDescriptorCollection > &  roi)

Definition at line 244 of file SimpleView.cxx.

244  {
245  m_roi = roi;
246 }

◆ sourceID()

SG::SourceID IProxyDict::sourceID ( const std::string &  key = "EventSelector") const
virtualinherited

Return the metadata source ID for the current event slot.

Parameters
keySG key of the DataHeader to query. Returns an empty string if no source has been set.

The default version always returns an empty string.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 97 of file IProxyDict.cxx.

98 {
99  return SG::SourceID();
100 }

◆ stringToKey()

IStringPool::sgkey_t SimpleView::stringToKey ( const std::string &  str,
CLID  clid 
)
virtual

Find the key for a string/CLID pair.

Parameters
strThe string to look up.
clidThe CLID associated with the string.
Returns
A key identifying the string. A given string will always return the same key. Will abort in case of a hash collision!

Implements IStringPool.

Definition at line 225 of file SimpleView.cxx.

226 {
227  return m_store->stringToKey( viewKey(str), clid );
228 }

◆ tryELRemap()

bool SimpleView::tryELRemap ( sgkey_t  sgkey_in,
size_t  index_in,
sgkey_t sgkey_out,
size_t &  index_out 
)
virtual

Test to see if the target of an ElementLink has moved.

Parameters
sgkey_inOriginal hashed key of the EL.
index_inOriginal index of the EL.
sgkey_out[out]New hashed key for the EL.
index_out[out]New index for the EL.
Returns
True if there is a remapping; false otherwise.

The default implementation here always returns false.

Reimplemented from IProxyDict.

Definition at line 162 of file SimpleView.cxx.

163 {
164  throw std::runtime_error( "Not implemented: SimpleView::tryELRemap" );
165  return m_store->tryELRemap( sgkey_in, index_in, sgkey_out, index_out );
166 }

◆ unboundHandle()

void SimpleView::unboundHandle ( IResetable handle)
virtual

Tell the store that a handle has been unbound from a proxy.

Parameters
handleThe handle that was unbound. The default implementation does nothing.

Reimplemented from IProxyDict.

Definition at line 199 of file SimpleView.cxx.

200 {
201  return m_store->unboundHandle( handle );
202 }

◆ viewKey()

std::string SimpleView::viewKey ( const std::string &  key) const

Construct a key as used in the parent store.

key The key as used in the view.

Definition at line 27 of file SimpleView.cxx.

28 {
29  return SG::transientKey (m_name + "_" + key);
30 }

Member Data Documentation

◆ m_allowFallThrough

bool SimpleView::m_allowFallThrough
protected

Definition at line 201 of file SimpleView.h.

◆ m_fallFilter

std::vector< std::string > SimpleView::m_fallFilter
protected

Definition at line 200 of file SimpleView.h.

◆ m_name

std::string SimpleView::m_name
protected

Definition at line 198 of file SimpleView.h.

◆ m_parents

std::set< const SG::View* > SimpleView::m_parents
protected

Definition at line 199 of file SimpleView.h.

◆ m_roi

ElementLink<TrigRoiDescriptorCollection> SimpleView::m_roi
protected

Definition at line 197 of file SimpleView.h.

◆ m_store

ServiceHandle< StoreGateSvc > SimpleView::m_store
protected

Definition at line 194 of file SimpleView.h.


The documentation for this class was generated from the following files:
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
SimpleView::m_fallFilter
std::vector< std::string > m_fallFilter
Definition: SimpleView.h:200
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SimpleView::m_allowFallThrough
bool m_allowFallThrough
Definition: SimpleView.h:201
SimpleView::m_name
std::string m_name
Definition: SimpleView.h:198
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
SimpleView::m_parents
std::set< const SG::View * > m_parents
Definition: SimpleView.h:199
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::proxy
virtual SG::DataProxy * proxy(const CLID &id, const std::string &key) const
Get proxy with given id and key.
Definition: SimpleView.cxx:70
ret
T ret(T t)
Definition: rootspy.cxx:260
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
SimpleView::viewKey
std::string viewKey(const std::string &key) const
Construct a key as used in the parent store.
Definition: SimpleView.cxx:27
SimpleView::name
virtual const std::string & name() const
Definition: SimpleView.cxx:219
Name
JetDumper::Name Name
Definition: JetDumper.cxx:19
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:23
SG::transientKey
std::string transientKey(const std::string &key)
Make a key transient.
Definition: transientKey.h:51
str
Definition: BTagTrackIpAccessor.cxx:11
SimpleView::m_roi
ElementLink< TrigRoiDescriptorCollection > m_roi
Definition: SimpleView.h:197
SG::View
Definition: View.h:25
python.PyAthena.obj
obj
Definition: PyAthena.py:135
SG::DataProxy
Definition: DataProxy.h:44
SimpleView::m_store
ServiceHandle< StoreGateSvc > m_store
Definition: SimpleView.h:194
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