ATLAS Offline Software
A/AthLinks/ElementLink.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4  */
5 #ifndef ATHLINKS_ELEMENTLINK_H
6 #define ATHLINKS_ELEMENTLINK_H
7 
8 // System include(s):
9 extern "C" {
10 # include <stdint.h>
11 }
12 #include <string>
13 
14 // Local include(s):
15 #include "AthLinks/ElementLinkBase.h"
16 #include "AthLinks/tools/selection_ns.h"
18 
19 // Forward declaration(s):
21 template< typename STORABLE >
22 class ElementLink;
24 namespace xAOD {
25  class TVirtualEvent;
26 }
27 
40 template< typename STORABLE >
41 class ElementLink : public ElementLinkBase {
42 
43 public:
46 
48  typedef std::string ID_type;
50  typedef uint32_t sgkey_t;
51 
53  typedef const STORABLE& BaseConstReference;
55  typedef const STORABLE* BaseConstPointer;
56 
58  typedef size_t index_type;
59 
61  typedef typename STORABLE::value_type value_type;
63  typedef typename STORABLE::const_iterator const_iterator;
64 
73 
75 
78 
83 
90 
100  xAOD::TVirtualEvent* event = 0 );
101 
104  xAOD::TVirtualEvent* event = 0 );
107  xAOD::TVirtualEvent* event = 0 );
108 
111 
113 
116 
119 
124 
126  bool setElement( ElementType element );
129 
132  xAOD::TVirtualEvent* event = 0 );
135  xAOD::TVirtualEvent* event = 0 );
137  void reset();
138 
140 
143 
148 
150  index_type index() const { return persIndex(); }
151 
153  const ID_type& dataID() const;
155  sgkey_t key() const { return persKey(); }
156 
158  bool operator==( const ElementLink& rhs ) const;
160  bool operator!=( const ElementLink& rhs ) const;
161 
164 
166  ElementConstPointer operator->() const { return cptr(); }
168  operator ElementConstPointer () const { return cptr(); }
171 
173  bool isValid() const;
175  bool operator!() const { return ! isValid(); }
176 
178  ElementType cachedElement() const { return m_element; }
180  bool hasCachedElement() const { return m_elementCached; }
181 
183 
185  xAOD::TVirtualEvent* source() const { return m_event; }
186 
188  bool toPersistent() { return true; }
189 
190 private:
192  virtual bool toTransient();
196  void findIndex();
197 
203  mutable bool m_elementCached;
206 
208  typedef typename
209  ROOT_SELECTION_NS::ElementLink< STORABLE >::self DictSel;
210 
211 }; // class ElementLink
212 
213 template <typename STORABLE>
215  const ElementLink<STORABLE> &rhs);
216 
217 template <typename STORABLE>
219  const ElementLink<STORABLE> &rhs);
220 
221 /*
222  * The following piece of code declares all members of the ElementLink
223  * class as transient.
224  */
226 template< typename STORABLE >
227 class ElementLink : public SelectNoInstance
228 {
229 
230 public:
233 
235  ROOT_SELECTION_NS::MemberAttributes< kTransient > m_container;
236  ROOT_SELECTION_NS::MemberAttributes< kTransient > m_element;
237  ROOT_SELECTION_NS::MemberAttributes< kTransient > m_elementCached;
238  ROOT_SELECTION_NS::MemberAttributes< kTransient > m_event;
239 
240 };
242 
243 // Include the implementation:
244 #ifndef __GCCXML__
245 # include "ElementLink.icc"
246 #endif // __GCCXML__
247 
248 #endif // ATHLINKS_ELEMENTLINK_H
xAOD::TVirtualEvent
Base interface for getting objects out of the input file.
Definition: TVirtualEvent.h:32
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
SG::GenericElementLinkBase::ID_type
SG::DataProxyHolder::ID_type ID_type
Type of string keys.
Definition: GenericElementLinkBase.h:98
ElementLinkBase
Base class for ElementLinks to vectors of pointers.
Definition: AthLinks/ElementLinkBase.h:59
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
SG::GenericElementLinkBase::index_type
INDEXING_POLICY::index_type index_type
The index type presented to and returned from the link.
Definition: GenericElementLinkBase.h:89
SG::GenericElementLinkBase::sgkey_t
SG::DataProxyHolder::sgkey_t sgkey_t
Type of hashed keys.
Definition: GenericElementLinkBase.h:95
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SG::GenericElementLinkBase::ElementConstPointer
INDEXING_POLICY::ElementConstPointer ElementConstPointer
Definition: GenericElementLinkBase.h:81
TypeTools.h
value_type
Definition: EDM_MasterSearch.h:11
SG::GenericElementLinkBase::ElementType
INDEXING_POLICY::ElementType ElementType
Generic pointer to an element.
Definition: GenericElementLinkBase.h:80