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-2017 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 
11 // Local include(s):
12 #include "AthLinks/ElementLink.h"
13 #include "AthLinks/ElementLinkVectorBase.h"
14 #include "AthLinks/tools/selection_ns.h"
15 
16 // Forward declaration(s):
18 template< class CONTAINER >
19 class ElementLinkVector;
21 
35 template< class CONTAINER >
37 
38 public:
43 
46 
50  typedef ElemLink& reference;
52  typedef const ElemLink& const_reference;
56  typedef typename std::vector< ElemLink >::const_iterator const_iterator;
58  typedef typename std::vector< ElemLink >::reverse_iterator reverse_iterator;
60  typedef typename std::vector< ElemLink >::const_reverse_iterator
63  typedef typename std::vector< ElemLink >::size_type size_type;
64 
66 
69 
76 
78 
81 
83  bool operator==( const ElementLinkVector& rhs ) const;
85  bool operator!=( const ElementLinkVector& rhs ) const;
86 
89 
91  iterator begin() { return m_elVec.begin(); }
93  const_iterator begin() const { return m_elVec.begin(); }
94 
96  iterator end() { return m_elVec.end(); }
98  const_iterator end() const { return m_elVec.end(); }
99 
101  reverse_iterator rbegin() { return m_elVec.rbegin(); }
103  const_reverse_iterator rbegin() const { return m_elVec.rbegin(); }
104 
106  reverse_iterator rend() { return m_elVec.rend(); }
108  const_reverse_iterator rend() const { return m_elVec.rend(); }
109 
111 
114 
116  size_type size() const { return m_elVec.size(); }
118  size_type max_size() const { return m_elVec.max_size(); }
120  size_type capacity() const { return m_elVec.capacity(); }
122  void resize( size_type sz, const ElemLink& link = ElemLink() );
124  void reserve( size_type sz ) { m_elVec.reserve( sz ); }
126  bool empty() const { return ( size() == 0 ); }
127 
129 
132 
134  const_reference operator[]( size_type n ) const { return m_elVec[ n ]; }
136  const_reference at( size_type n ) const { return m_elVec.at( n ); }
138  const_reference front() const { return m_elVec.front(); }
140  const_reference back() const { return m_elVec.back(); }
141 
143 
146 
148  void push_back( const ElemLink& el );
150  void pop_back();
151 
153  iterator erase( iterator position );
156 
158  void swap( ElemLinkVec& vec );
159 
161  template< class InputIterator >
162  void assign( InputIterator first, InputIterator last );
164  void assign( size_type n, const ElemLink& link );
165 
167  iterator insert( iterator position, const ElemLink& link );
169  void insert( iterator position, size_type n, const ElemLink& link );
170 
172  void clear();
173 
175 
177  virtual bool toTransient();
179  bool toPersistent();
180 
181 private:
183  std::vector< ElemLink > m_elVec;
184 
186  typedef typename
187  ROOT_SELECTION_NS::ElementLinkVector< CONTAINER >::self DictSel;
188 
189 }; // class ElementLinkVector
190 
191 /*
192  * This code declares that the variables of ElementLinkVector
193  * are supposed to be transient in all instantiations.
194  */
196 template< class CONTAINER >
197 class ElementLinkVector : public SelectNoInstance
198 {
199 
200 public:
203 
205  ROOT_SELECTION_NS::MemberAttributes< kTransient > m_elVec;
206 
207 };
209 
210 // Include the implementation:
211 #ifndef __GCCXML__
212 # include "AthLinks/ElementLinkVector.icc"
213 #endif // not __GCCXML__
214 
215 #endif // ATHLINKS_ELEMENTLINKVECTOR_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ElementLinkVector::toPersistent
bool toPersistent()
Function copying the transient data into the persistent variables.
ElementLinkVector::front
const_reference front() const
Get the first element.
Definition: A/AthLinks/ElementLinkVector.h:138
ElementLinkVector::m_elVec
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_elVec
Mark all transient members:
Definition: A/AthLinks/ElementLinkVector.h:205
fitman.sz
sz
Definition: fitman.py:527
ElementLinkVector::begin
iterator begin()
Get an iterator pointing at the first element.
Definition: A/AthLinks/ElementLinkVector.h:91
ElementLinkVector::pop_back
void pop_back()
Remove the last element from the vector.
ElementLinkVector::const_reference
const ElemLink & const_reference
Type of the constant reference pointing to one element link.
Definition: A/AthLinks/ElementLinkVector.h:52
ElementLinkVector::m_elVec
std::vector< ElemLink > m_elVec
Transient vector of element links.
Definition: A/AthLinks/ElementLinkVector.h:183
ElementLinkVector::DictSel
ROOT_SELECTION_NS::ElementLinkVector< CONTAINER >::self DictSel
Needed to take the Reflex/Cling specifications into account.
Definition: A/AthLinks/ElementLinkVector.h:187
ElementLinkVector::operator[]
const_reference operator[](size_type n) const
Get the element at a given index.
Definition: A/AthLinks/ElementLinkVector.h:134
ElementLinkVector::end
iterator end()
Get an iterator pointing at the end of the container.
Definition: A/AthLinks/ElementLinkVector.h:96
ElementLinkVector::rbegin
const_reverse_iterator rbegin() const
Get a constant reverse iterator pointing at the last element.
Definition: A/AthLinks/ElementLinkVector.h:103
ElementLinkVector::const_iterator
std::vector< ElemLink >::const_iterator const_iterator
Type of the constant iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:56
ElementLinkVector< AthExIParticles >::reverse_iterator
ELVIterator< typename RefVector::reverse_iterator > reverse_iterator
Definition: AthLinks/ElementLinkVector.h:136
ElementLinkVector< AthExIParticles >::const_reverse_iterator
ELVIterator< typename RefVector::const_reverse_iterator > const_reverse_iterator
Definition: AthLinks/ElementLinkVector.h:137
ElementLinkVector< AthExIParticles >::iterator
ELVIterator< typename RefVector::iterator > iterator
Definition: AthLinks/ElementLinkVector.h:126
ElementLinkVector::insert
void insert(iterator position, size_type n, const ElemLink &link)
Insert a number of identical links in a certain position.
ElementLinkVector::ElemLink
ElementLink< DOBJ > ElemLink
Definition: AthLinks/ElementLinkVector.h:71
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
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::ElementLinkVector
ElementLinkVector(const ElemLinkVec &parent)
Copy constructor.
ElementLinkVector::toTransient
virtual bool toTransient()
Reset the object's internal cache.
ElementLinkVector::resize
void resize(size_type sz, const ElemLink &link=ElemLink())
Resize the vector to the specified size.
ElementLinkVector::begin
const_iterator begin() const
Get a constant iterator pointing at the first element.
Definition: A/AthLinks/ElementLinkVector.h:93
ElementLinkVector::capacity
size_type capacity() const
Get the capacity of the currently allocated object.
Definition: A/AthLinks/ElementLinkVector.h:120
ElementLinkVector::rend
const_reverse_iterator rend() const
Get a constant reverse iterator pointing at the beginning of the container.
Definition: A/AthLinks/ElementLinkVector.h:108
ElementLinkVector::reserve
void reserve(size_type sz)
Reserve some slots in the vector.
Definition: A/AthLinks/ElementLinkVector.h:124
ElementLinkVector::ElemLinkVec
ElementLinkVector< CONTAINER > ElemLinkVec
Definition of the current type.
Definition: A/AthLinks/ElementLinkVector.h:40
ElementLinkVector::reverse_iterator
std::vector< ElemLink >::reverse_iterator reverse_iterator
Type of the reverse iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:58
ElementLinkVector::size_type
std::vector< ElemLink >::size_type size_type
Type of the size of the vector.
Definition: A/AthLinks/ElementLinkVector.h:63
ElementLinkVector::push_back
void push_back(const ElemLink &el)
Add a new element link at the end of the vector.
ElementLinkVector::clear
void clear()
Clear the object.
beamspotman.n
n
Definition: beamspotman.py:731
ElementLinkVector::empty
bool empty() const
Function checking if the vector is empty.
Definition: A/AthLinks/ElementLinkVector.h:126
ElementLinkVector::operator!=
bool operator!=(const ElementLinkVector &rhs) const
Comparison operator.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ElementLinkVector::iterator
std::vector< ElemLink >::iterator iterator
Type of the iterator for traversing the vector.
Definition: A/AthLinks/ElementLinkVector.h:54
ElementLinkVector::ElemLink
ElementLink< CONTAINER > ElemLink
Type of the EL that we have a vector of.
Definition: A/AthLinks/ElementLinkVector.h:42
ElementLinkVector< AthExIParticles >::size_type
RefVector::size_type size_type
Definition: AthLinks/ElementLinkVector.h:130
ElementLinkVector::rend
reverse_iterator rend()
Get a reverse iterator pointing at the beginning of the container.
Definition: A/AthLinks/ElementLinkVector.h:106
ElementLinkVector< AthExIParticles >::const_iterator
ELVIterator< typename RefVector::const_iterator > const_iterator
Definition: AthLinks/ElementLinkVector.h:127
ElementLinkVector::ElementLinkVector
ElementLinkVector()
Default constructor.
ElementLinkVector::value_type
ElemLink value_type
Standard typedef for the type of the held objects.
Definition: A/AthLinks/ElementLinkVector.h:48
ElementLinkVector::erase
iterator erase(iterator position)
Erase one element from the vector.
ElementLinkVector
ElementLinkVector implementation for standalone ROOT.
Definition: AthLinks/ElementLinkVector.h:27
ElementLinkVector::at
const_reference at(size_type n) const
Get the element at a given index (with size check)
Definition: A/AthLinks/ElementLinkVector.h:136
ElementLinkVector::erase
iterator erase(iterator first, iterator last)
Erase a set of elements from the vector.
ElementLinkVector::ElementLinkVector
ElementLinkVector(size_type n, const ElemLink &link=ElemLink())
Constructor creating a vector of a given size.
ElementLinkVector::size
size_type size() const
Get the size of the vector.
Definition: A/AthLinks/ElementLinkVector.h:116
ElementLinkVector::assign
void assign(size_type n, const ElemLink &link)
Fill the vector with N identical links.
ElementLinkVector::back
const_reference back() const
Get the last element.
Definition: A/AthLinks/ElementLinkVector.h:140
ElementLinkVector::insert
iterator insert(iterator position, const ElemLink &link)
Insert a link in a certain position.
ElementLinkVector::reference
ElemLink & reference
Type of the reference pointing to one element link.
Definition: A/AthLinks/ElementLinkVector.h:50
DeMoScan.first
bool first
Definition: DeMoScan.py:534
ElementLinkVector::end
const_iterator end() const
Get a constant iterator pointing at the end of the container.
Definition: A/AthLinks/ElementLinkVector.h:98
ElementLinkVector::assign
void assign(InputIterator first, InputIterator last)
Fill the vector with the contents of another container.
ElementLinkVector::operator=
ElemLinkVec & operator=(const ElemLinkVec &rhs)
Assignment operator.
ElementLinkVector::operator==
bool operator==(const ElementLinkVector &rhs) const
Comparison operator.
ElementLinkVector::max_size
size_type max_size() const
Get the maximal size of the object.
Definition: A/AthLinks/ElementLinkVector.h:118
ElementLinkVector::rbegin
reverse_iterator rbegin()
Get a reverse iterator pointing at the last element.
Definition: A/AthLinks/ElementLinkVector.h:101
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:61