ATLAS Offline Software
A/AthLinks/ElementLinkVector.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4  */
5 #ifndef ATHLINKS_ELEMENTLINKVECTOR_H
6 #define ATHLINKS_ELEMENTLINKVECTOR_H
7 
8 // System include(s):
9 #include <vector>
10 #include <RootMetaSelection.h>
11 
12 // Local include(s):
13 #include "AthLinks/ElementLink.h"
14 #include "AthLinks/ElementLinkVectorBase.h"
15 
16 // Forward declaration(s):
17 namespace ROOT { namespace Meta { namespace Selection {
18  template< class CONTAINER >
19  class ElementLinkVector;
20 }}}
21 
33 template< class CONTAINER >
35 
36 public:
41 
44 
48  typedef ElemLink& reference;
50  typedef const ElemLink& const_reference;
54  typedef typename std::vector< ElemLink >::const_iterator const_iterator;
56  typedef typename std::vector< ElemLink >::reverse_iterator reverse_iterator;
58  typedef typename std::vector< ElemLink >::const_reverse_iterator
61  typedef typename std::vector< ElemLink >::size_type size_type;
62 
64 
67 
74 
76 
79 
81  bool operator==( const ElementLinkVector& rhs ) const;
83  bool operator!=( const ElementLinkVector& rhs ) const;
84 
87 
89  iterator begin() { return m_elVec.begin(); }
91  const_iterator begin() const { return m_elVec.begin(); }
92 
94  iterator end() { return m_elVec.end(); }
96  const_iterator end() const { return m_elVec.end(); }
97 
99  reverse_iterator rbegin() { return m_elVec.rbegin(); }
101  const_reverse_iterator rbegin() const { return m_elVec.rbegin(); }
102 
104  reverse_iterator rend() { return m_elVec.rend(); }
106  const_reverse_iterator rend() const { return m_elVec.rend(); }
107 
109 
112 
114  size_type size() const { return m_elVec.size(); }
116  size_type max_size() const { return m_elVec.max_size(); }
118  size_type capacity() const { return m_elVec.capacity(); }
120  void resize( size_type sz, const ElemLink& link = ElemLink() );
122  void reserve( size_type sz ) { m_elVec.reserve( sz ); }
124  bool empty() const { return ( size() == 0 ); }
125 
127 
130 
132  const_reference operator[]( size_type n ) const { return m_elVec[ n ]; }
134  const_reference at( size_type n ) const { return m_elVec.at( n ); }
136  const_reference front() const { return m_elVec.front(); }
138  const_reference back() const { return m_elVec.back(); }
139 
141 
144 
146  void push_back( const ElemLink& el );
148  void pop_back();
149 
151  iterator erase( iterator position );
154 
156  void swap( ElemLinkVec& vec );
157 
159  template< class InputIterator >
160  void assign( InputIterator first, InputIterator last );
162  void assign( size_type n, const ElemLink& link );
163 
165  iterator insert( iterator position, const ElemLink& link );
167  void insert( iterator position, size_type n, const ElemLink& link );
168 
170  void clear();
171 
173 
175  virtual bool toTransient();
177  bool toPersistent();
178 
179 private:
181  std::vector< ElemLink > m_elVec;
182 
184  typedef typename
186 
187 }; // class ElementLinkVector
188 
189 /*
190  * This code declares that the variables of ElementLinkVector
191  * are supposed to be transient in all instantiations.
192  */
193 namespace ROOT { namespace Meta { namespace Selection {
194 template< class CONTAINER >
195 class ElementLinkVector : public SelectNoInstance
196 {
197 
198 public:
201 
203  ROOT::Meta::Selection::MemberAttributes< kTransient > m_elVec;
204 
205 };
206 }}} // ROOT namespace
207 
208 // Include the implementation:
209 #ifndef __GCCXML__
210 # include "AthLinks/ElementLinkVector.icc"
211 #endif // not __GCCXML__
212 
213 #endif // ATHLINKS_ELEMENTLINKVECTOR_H
ROOT::Meta::Selection::ElementLinkVector::m_elVec
ROOT::Meta::Selection::MemberAttributes< kTransient > m_elVec
Mark all transient members:
Definition: A/AthLinks/ElementLinkVector.h:203
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ElementLinkVector::const_reference
const ElemLink & const_reference
Type of the constant reference pointing to one element link.
Definition: A/AthLinks/ElementLinkVector.h:50
ElementLinkVector< AthExIParticles >::iterator
ELVIterator< typename RefVector::iterator > iterator
Definition: AthLinks/ElementLinkVector.h:128
fitman.sz
sz
Definition: fitman.py:527
ElementLinkVector::capacity
size_type capacity() const
Get the capacity of the currently allocated object.
Definition: A/AthLinks/ElementLinkVector.h:118
ElementLinkVector< AthExIParticles >::reverse_iterator
ELVIterator< typename RefVector::reverse_iterator > reverse_iterator
Definition: AthLinks/ElementLinkVector.h:138
ElementLinkVector::ElemLink
ElementLink< CONTAINER > ElemLink
Type of the EL that we have a vector of.
Definition: A/AthLinks/ElementLinkVector.h:40
ElementLinkVector::rbegin
reverse_iterator rbegin()
Get a reverse iterator pointing at the last element.
Definition: A/AthLinks/ElementLinkVector.h:99
ElementLinkVector< AthExIParticles >::const_iterator
ELVIterator< typename RefVector::const_iterator > const_iterator
Definition: AthLinks/ElementLinkVector.h:129
ElementLinkVector::rend
reverse_iterator rend()
Get a reverse iterator pointing at the beginning of the container.
Definition: A/AthLinks/ElementLinkVector.h:104
ElementLinkVector::const_iterator
std::vector< ElemLink >::const_iterator const_iterator
Type of the constant iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:54
ElementLinkVector::assign
void assign(InputIterator first, InputIterator last)
Fill the vector with the contents of another container.
ElementLinkVector::ElemLink
ElementLink< DOBJ > ElemLink
Definition: AthLinks/ElementLinkVector.h:73
ElementLinkVector::value_type
ElemLink value_type
Standard typedef for the type of the held objects.
Definition: A/AthLinks/ElementLinkVector.h:46
ElementLinkVector::operator[]
const_reference operator[](size_type n) const
Get the element at a given index.
Definition: A/AthLinks/ElementLinkVector.h:132
ElementLinkVector::m_elVec
std::vector< ElemLink > m_elVec
Transient vector of element links.
Definition: A/AthLinks/ElementLinkVector.h:181
ElementLinkVector::ElemLinkVec
ElementLinkVector< CONTAINER > ElemLinkVec
Definition of the current type.
Definition: A/AthLinks/ElementLinkVector.h:38
ElementLinkVector
ElementLinkVector implementation for standalone ROOT.
Definition: AthLinks/ElementLinkVector.h:65
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
ElementLinkVector::erase
iterator erase(iterator position)
Erase one element from the vector.
ElementLinkVector::max_size
size_type max_size() const
Get the maximal size of the object.
Definition: A/AthLinks/ElementLinkVector.h:116
ElementLinkVector::swap
void swap(ElemLinkVec &vec)
Swap the container's contents with another object's.
ElementLinkVectorBase
Base class holding the container independent part of ElementLinkVector.
Definition: AthLinks/ElementLinkVectorBase.h:28
ElementLinkVector::erase
iterator erase(iterator first, iterator last)
Erase a set of elements from the vector.
ElementLinkVector::at
const_reference at(size_type n) const
Get the element at a given index (with size check)
Definition: A/AthLinks/ElementLinkVector.h:134
ElementLinkVector::operator!=
bool operator!=(const ElementLinkVector &rhs) const
Comparison operator.
ElementLinkVector::const_reverse_iterator
std::vector< ElemLink >::const_reverse_iterator const_reverse_iterator
Type of the constant reverse iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:59
ElementLinkVector::DictSel
ROOT::Meta::Selection::ElementLinkVector< CONTAINER >::self DictSel
Needed to take the Reflex/Cling specifications into account.
Definition: A/AthLinks/ElementLinkVector.h:185
ElementLinkVector< AthExIParticles >::size_type
RefVector::size_type size_type
Definition: AthLinks/ElementLinkVector.h:132
ElementLinkVector::ElementLinkVector
ElementLinkVector(const ElemLinkVec &parent)
Copy constructor.
beamspotman.n
n
Definition: beamspotman.py:731
test_pyathena.parent
parent
Definition: test_pyathena.py:15
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ElementLinkVector::toTransient
virtual bool toTransient()
Reset the object's internal cache.
ElementLinkVector::assign
void assign(size_type n, const ElemLink &link)
Fill the vector with N identical links.
ElementLinkVector::clear
void clear()
Clear the object.
ElementLinkVector::push_back
void push_back(const ElemLink &el)
Add a new element link at the end of the vector.
ElementLinkVector::toPersistent
bool toPersistent()
Function copying the transient data into the persistent variables.
ROOT::Meta::Selection::ElementLinkVector
Definition: AthLinks/ElementLinkVector.h:29
ElementLinkVector::iterator
std::vector< ElemLink >::iterator iterator
Type of the iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:52
ElementLinkVector::reserve
void reserve(size_type sz)
Reserve some slots in the vector.
Definition: A/AthLinks/ElementLinkVector.h:122
ElementLinkVector::front
const_reference front() const
Get the first element.
Definition: A/AthLinks/ElementLinkVector.h:136
ElementLinkVector::pop_back
void pop_back()
Remove the last element from the vector.
ElementLinkVector::empty
bool empty() const
Function checking if the vector is empty.
Definition: A/AthLinks/ElementLinkVector.h:124
ElementLinkVector::begin
const_iterator begin() const
Get a constant iterator pointing at the first element.
Definition: A/AthLinks/ElementLinkVector.h:91
ElementLinkVector::rbegin
const_reverse_iterator rbegin() const
Get a constant reverse iterator pointing at the last element.
Definition: A/AthLinks/ElementLinkVector.h:101
ElementLinkVector::reference
ElemLink & reference
Type of the reference pointing to one element link.
Definition: A/AthLinks/ElementLinkVector.h:48
ElementLinkVector::ElementLinkVector
ElementLinkVector()
Default constructor.
ElementLinkVector::back
const_reference back() const
Get the last element.
Definition: A/AthLinks/ElementLinkVector.h:138
ElementLinkVector::ElementLinkVector
ElementLinkVector(size_type n, const ElemLink &link=ElemLink())
Constructor creating a vector of a given size.
ElementLinkVector::rend
const_reverse_iterator rend() const
Get a constant reverse iterator pointing at the beginning of the container.
Definition: A/AthLinks/ElementLinkVector.h:106
ElementLinkVector::reverse_iterator
std::vector< ElemLink >::reverse_iterator reverse_iterator
Type of the reverse iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:56
ElementLinkVector::resize
void resize(size_type sz, const ElemLink &link=ElemLink())
Resize the vector to the specified size.
ElementLinkVector::operator==
bool operator==(const ElementLinkVector &rhs) const
Comparison operator.
DeMoScan.first
bool first
Definition: DeMoScan.py:536
ElementLinkVector::begin
iterator begin()
Get an iterator pointing at the first element.
Definition: A/AthLinks/ElementLinkVector.h:89
ElementLinkVector::size
size_type size() const
Get the size of the vector.
Definition: A/AthLinks/ElementLinkVector.h:114
ElementLinkVector::insert
void insert(iterator position, size_type n, const ElemLink &link)
Insert a number of identical links in a certain position.
ElementLinkVector::insert
iterator insert(iterator position, const ElemLink &link)
Insert a link in a certain position.
ElementLinkVector::size_type
std::vector< ElemLink >::size_type size_type
Type of the size of the vector.
Definition: A/AthLinks/ElementLinkVector.h:61
ElementLinkVector::end
iterator end()
Get an iterator pointing at the end of the container.
Definition: A/AthLinks/ElementLinkVector.h:94
ElementLinkVector< AthExIParticles >::const_reverse_iterator
ELVIterator< typename RefVector::const_reverse_iterator > const_reverse_iterator
Definition: AthLinks/ElementLinkVector.h:139
ROOT
Selection rules: declare transient members.
Definition: DataVector.h:580
ElementLinkVector::end
const_iterator end() const
Get a constant iterator pointing at the end of the container.
Definition: A/AthLinks/ElementLinkVector.h:96
ElementLinkVector::operator=
ElemLinkVec & operator=(const ElemLinkVec &rhs)
Assignment operator.