ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
HLTNavDetails::TypeProxy< T > Class Template Reference

Type specific implementation of ITypeProxy. More...

#include <TypeProxy.h>

Inheritance diagram for HLTNavDetails::TypeProxy< T >:
Collaboration diagram for HLTNavDetails::TypeProxy< T >:

Public Types

typedef T value_type
 Convenience type declaration. More...
 
typedef T * pointer_type
 Convenience type declaration. More...
 

Public Member Functions

 TypeProxy ()
 Default constructor. More...
 
 TypeProxy (pointer_type t)
 Constructor pointing to an existing object. More...
 
virtual StatusCode create () override
 Make a new object. More...
 
virtual StatusCode reg (StoreGateSvc *sg, const std::string &key) override
 Save proxied object in DG (record) More...
 
virtual StatusCode sync (StoreGateSvc *sg, const std::string &key) override
 SG retrieve, and fill the proxy. More...
 
virtual StatusCode clear (StoreGateSvc *sg) override
 Remove the object from SG and make the pointer null. More...
 
virtual void syncTypeless () override
 
virtual ITypeProxyclone () const override
 This is how typed proxy is obtained. More...
 
pointer_type data ()
 Pointer to the exact object type. More...
 
const pointer_typedata () const
 Constant pointer to the exact object type. More...
 
pointer_typedata_ref ()
 Reference to the exact object type pointer. More...
 
bool contains (StoreGateSvc *sg, const std::string &key) const
 Check whether StoreGate contains an object of this type and with the specified key. More...
 
bool transientContains (StoreGateSvc *sg, const std::string &key) const
 Check whether StoreGate contains a modifyable object of this type and with the specified key. More...
 
bool empty () const
 True if proxy has not yet made object or not synced to any yet (0 pointer) More...
 
CLID clid () const
 The CLID of the object being proxied. More...
 
const std::string & typeName () const
 The type name of the object being proxied. More...
 
const void * cptr () const
 

Protected Attributes

CLID m_clid {0}
 The CLID of the type being proxied. More...
 
std::string m_typeName
 The type name of the object being proxied. More...
 
std::string m_key
 StoreGate key of the proxied object. More...
 
SG::DataProxym_proxy {nullptr}
 StoreGate proxy for the object. More...
 
void * m_ncPointer {nullptr}
 Non-const pointer to the proxied object. More...
 
const void * m_pointer {nullptr}
 Const pointer to the proxied object. More...
 
bool m_isAuxVectorBase {false}
 Does the proxied type inherit from SG::AuxVectorBase? More...
 

Private Attributes

pointer_type m_data {nullptr}
 Non-const pointer to the proxied object. More...
 

Detailed Description

template<class T>
class HLTNavDetails::TypeProxy< T >

Type specific implementation of ITypeProxy.

Author
Tomasz Bold Tomas.nosp@m.z.Bo.nosp@m.ld@ce.nosp@m.rn.c.nosp@m.h
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
783046
Date
2016-11-08 18:17:33 +0100 (Tue, 08 Nov 2016)

Definition at line 170 of file TypeProxy.h.

Member Typedef Documentation

◆ pointer_type

template<class T >
typedef T* HLTNavDetails::TypeProxy< T >::pointer_type

Convenience type declaration.

Definition at line 176 of file TypeProxy.h.

◆ value_type

template<class T >
typedef T HLTNavDetails::TypeProxy< T >::value_type

Convenience type declaration.

Definition at line 174 of file TypeProxy.h.

Constructor & Destructor Documentation

◆ TypeProxy() [1/2]

template<class T >
HLTNavDetails::TypeProxy< T >::TypeProxy

Default constructor.

Definition at line 214 of file TypeProxy.h.

215  : ITypeProxy() {
216 
217  // Set the properties of the base class:
221  }

◆ TypeProxy() [2/2]

template<class T >
HLTNavDetails::TypeProxy< T >::TypeProxy ( pointer_type  t)

Constructor pointing to an existing object.

Notice that this constructor delegates much of the work to the default constructor. (C++11 magic...)

Definition at line 229 of file TypeProxy.h.

230  : TypeProxy() {
231 
232  // Set the properties of this class:
233  m_data = t;
234 
235  // Set the properties of the base class:
237  m_pointer = m_data;
238  }

Member Function Documentation

◆ castAuxVectorBase()

SG::AuxVectorBase * HLTNavDetails::ITypeProxy::castAuxVectorBase ( )
inherited

Return a pointer to the SG::AuxVectorBase base class of the object if possible.

Definition at line 35 of file TypeProxy.cxx.

35  {
36 
37  if( m_isAuxVectorBase ) {
38  return static_cast< SG::AuxVectorBase* >( m_ncPointer );
39  } else {
40  return 0;
41  }
42  }

◆ castIAuxStore()

SG::IAuxStore * HLTNavDetails::ITypeProxy::castIAuxStore ( )
inherited

Return a pointer to the SG::IAuxStore base class of the object if possible.

This cast can be done based on StoreGate, since SG::IAuxStore has a CLID, as should the type that we're proxying.

Definition at line 47 of file TypeProxy.cxx.

47  {
48 
49  return static_cast< SG::IAuxStore* >( m_ncPointer );
50  }

◆ clear()

template<class T >
StatusCode HLTNavDetails::TypeProxy< T >::clear ( StoreGateSvc sg)
overridevirtual

Remove the object from SG and make the pointer null.

Unfortunately the typeless removeProxy functions of StoreGateSvc are all private.

Although I would've loved to implement this function in a non-template way as well... :-/

Implements HLTNavDetails::ITypeProxy.

Definition at line 281 of file TypeProxy.h.

281  {
282 
283  // Do the deed:
284  CHECK( sg->remove( m_data ) );
285 
286  // Clear the object:
287  m_data = nullptr;
288  m_proxy = nullptr;
289  m_ncPointer = nullptr;
290  m_pointer = nullptr;
291 
292  // Return gracefully:
293  return StatusCode::SUCCESS;
294  }

◆ clid()

CLID HLTNavDetails::ITypeProxy::clid ( ) const
inherited

The CLID of the object being proxied.

Definition at line 68 of file TypeProxy.cxx.

68  {
69 
70  return m_clid;
71  }

◆ clone()

template<class T >
virtual ITypeProxy* HLTNavDetails::TypeProxy< T >::clone ( ) const
inlineoverridevirtual

This is how typed proxy is obtained.

Implements HLTNavDetails::ITypeProxy.

Definition at line 198 of file TypeProxy.h.

198 { return new TypeProxy<T>(); }

◆ contains()

bool HLTNavDetails::ITypeProxy::contains ( StoreGateSvc sg,
const std::string &  key 
) const
inherited

Check whether StoreGate contains an object of this type and with the specified key.

Definition at line 52 of file TypeProxy.cxx.

52  {
53 
54  return sg->contains( m_clid, key );
55  }

◆ cptr()

const void* HLTNavDetails::ITypeProxy::cptr ( ) const
inlineinherited

Definition at line 92 of file TypeProxy.h.

92 { return m_pointer; }

◆ create()

template<class T >
StatusCode HLTNavDetails::TypeProxy< T >::create
overridevirtual

Make a new object.

Implements HLTNavDetails::ITypeProxy.

Definition at line 241 of file TypeProxy.h.

241  {
242 
243  // Check if we already proxy some object. Then this should not be called
244  // again...
245  if( m_data ) {
246  REPORT_MESSAGE( MSG::ERROR )
247  << "Object is already being proxied";
248  return StatusCode::FAILURE;
249  }
250 
251  // Create the new object:
252  m_data = new T();
253 
254  // Fill the base class's variables:
256  m_pointer = m_data;
257 
258  // Return gracefully:
259  return StatusCode::SUCCESS;
260  }

◆ data() [1/2]

template<class T >
pointer_type HLTNavDetails::TypeProxy< T >::data ( )
inline

Pointer to the exact object type.

Definition at line 201 of file TypeProxy.h.

201 { return m_data; }

◆ data() [2/2]

template<class T >
const pointer_type& HLTNavDetails::TypeProxy< T >::data ( ) const
inline

Constant pointer to the exact object type.

Definition at line 203 of file TypeProxy.h.

203 { return m_data; }

◆ data_ref()

template<class T >
pointer_type& HLTNavDetails::TypeProxy< T >::data_ref ( )
inline

Reference to the exact object type pointer.

Definition at line 205 of file TypeProxy.h.

205 { return m_data; }

◆ empty()

bool HLTNavDetails::ITypeProxy::empty ( ) const
inherited

True if proxy has not yet made object or not synced to any yet (0 pointer)

Definition at line 63 of file TypeProxy.cxx.

63  {
64 
65  return ( ( m_proxy == 0 ) && ( m_ncPointer == 0 ) );
66  }

◆ reg()

template<class T >
StatusCode HLTNavDetails::TypeProxy< T >::reg ( StoreGateSvc sg,
const std::string &  key 
)
overridevirtual

Save proxied object in DG (record)

Implements HLTNavDetails::ITypeProxy.

Definition at line 263 of file TypeProxy.h.

263  {
264 
265  // Record the object:
266  CHECK( sg->record( m_data, key ) );
267 
268  // Fill some variables in the base class:
269  m_key = key;
270  m_proxy = sg->proxy( m_clid, m_key );
271 
272  return StatusCode::SUCCESS;
273  }

◆ sync()

template<class T >
StatusCode HLTNavDetails::TypeProxy< T >::sync ( StoreGateSvc sg,
const std::string &  key 
)
overridevirtual

SG retrieve, and fill the proxy.

Reimplemented from HLTNavDetails::ITypeProxy.

Definition at line 297 of file TypeProxy.h.

297  {
298 
299  // First let the base class do its own thing:
300  CHECK( ITypeProxy::sync( sg, key ) );
301 
302  // Get the object out of the proxy:
303  m_data = SG::DataProxy_cast< T >( m_proxy );
304 
305  // Return gracefully:
306  return StatusCode::SUCCESS;
307  }

◆ syncTypeless()

template<class T >
virtual void HLTNavDetails::TypeProxy< T >::syncTypeless ( )
inlineoverridevirtual

Implements HLTNavDetails::ITypeProxy.

Definition at line 192 of file TypeProxy.h.

192  {
194  m_pointer = m_data;
195  }

◆ transientContains()

bool HLTNavDetails::ITypeProxy::transientContains ( StoreGateSvc sg,
const std::string &  key 
) const
inherited

Check whether StoreGate contains a modifyable object of this type and with the specified key.

Definition at line 57 of file TypeProxy.cxx.

58  {
59 
60  return sg->transientContains( m_clid, key );
61  }

◆ typeName()

const std::string & HLTNavDetails::ITypeProxy::typeName ( ) const
inherited

The type name of the object being proxied.

Definition at line 73 of file TypeProxy.cxx.

73  {
74 
75  return m_typeName;
76  }

Member Data Documentation

◆ m_clid

CLID HLTNavDetails::ITypeProxy::m_clid {0}
protectedinherited

The CLID of the type being proxied.

Definition at line 95 of file TypeProxy.h.

◆ m_data

template<class T >
pointer_type HLTNavDetails::TypeProxy< T >::m_data {nullptr}
private

Non-const pointer to the proxied object.

Definition at line 208 of file TypeProxy.h.

◆ m_isAuxVectorBase

bool HLTNavDetails::ITypeProxy::m_isAuxVectorBase {false}
protectedinherited

Does the proxied type inherit from SG::AuxVectorBase?

Definition at line 102 of file TypeProxy.h.

◆ m_key

std::string HLTNavDetails::ITypeProxy::m_key
protectedinherited

StoreGate key of the proxied object.

Definition at line 97 of file TypeProxy.h.

◆ m_ncPointer

void* HLTNavDetails::ITypeProxy::m_ncPointer {nullptr}
protectedinherited

Non-const pointer to the proxied object.

Definition at line 99 of file TypeProxy.h.

◆ m_pointer

const void* HLTNavDetails::ITypeProxy::m_pointer {nullptr}
protectedinherited

Const pointer to the proxied object.

Definition at line 100 of file TypeProxy.h.

◆ m_proxy

SG::DataProxy* HLTNavDetails::ITypeProxy::m_proxy {nullptr}
protectedinherited

StoreGate proxy for the object.

Definition at line 98 of file TypeProxy.h.

◆ m_typeName

std::string HLTNavDetails::ITypeProxy::m_typeName
protectedinherited

The type name of the object being proxied.

Definition at line 96 of file TypeProxy.h.


The documentation for this class was generated from the following file:
HLTNavDetails::ITypeProxy::m_ncPointer
void * m_ncPointer
Non-const pointer to the proxied object.
Definition: TypeProxy.h:99
StoreGateSvc::record
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
StoreGateSvc::contains
bool contains(const TKEY &key) const
Look up a keyed object in TDS (compare also tryRetrieve) returns false if object not available in TDS...
HLTNavDetails::ITypeProxy::m_isAuxVectorBase
bool m_isAuxVectorBase
Does the proxied type inherit from SG::AuxVectorBase?
Definition: TypeProxy.h:102
athena.value
value
Definition: athena.py:122
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
HLTNavDetails::ITypeProxy::m_key
std::string m_key
StoreGate key of the proxied object.
Definition: TypeProxy.h:97
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
ClassID_traits::typeName
static const std::string & typeName()
the demangled type name of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:56
HLTNavDetails::ITypeProxy::m_proxy
SG::DataProxy * m_proxy
StoreGate proxy for the object.
Definition: TypeProxy.h:98
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
StoreGateSvc::transientContains
bool transientContains(const TKEY &key) const
Look up a transient data object in TDS only (no Proxy lookup) returns false if object not available i...
HLTNavDetails::TypeProxy::m_data
pointer_type m_data
Non-const pointer to the proxied object.
Definition: TypeProxy.h:208
HLTNavDetails::ITypeProxy::m_clid
CLID m_clid
The CLID of the type being proxied.
Definition: TypeProxy.h:95
StoreGateSvc::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
HLTNavDetails::ITypeProxy::m_pointer
const void * m_pointer
Const pointer to the proxied object.
Definition: TypeProxy.h:100
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
HLTNavDetails::ITypeProxy::ITypeProxy
ITypeProxy()=default
Default constructor.
StoreGateSvc::remove
StatusCode remove(const T *pObject)
Remove pObject, will remove its proxy if not reset only.
HLTNavDetails::ITypeProxy::sync
virtual StatusCode sync(StoreGateSvc *sg, const std::string &key)
SG retrieve, and fill the proxy.
Definition: TypeProxy.cxx:14
HLTNavDetails::ITypeProxy::m_typeName
std::string m_typeName
The type name of the object being proxied.
Definition: TypeProxy.h:96
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
HLTNavDetails::TypeProxy::TypeProxy
TypeProxy()
Default constructor.
Definition: TypeProxy.h:214
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37