ATLAS Offline Software
Loading...
Searching...
No Matches
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):
17namespace ROOT { namespace Meta { namespace Selection {
18 template< class CONTAINER >
20}}}
21
33template< class CONTAINER >
35
36public:
41
44
50 typedef const ElemLink& const_reference;
52 typedef typename std::vector< ElemLink >::iterator iterator;
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
154
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();
178
179private:
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 */
193namespace ROOT { namespace Meta { namespace Selection {
194template< class CONTAINER >
195class ElementLinkVector : public SelectNoInstance
196{
197
198public:
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
std::vector< size_t > vec
static Double_t sz
Base class holding the container independent part of ElementLinkVector.
ElementLinkVector implementation for standalone ROOT.
const_iterator begin() const
Get a constant iterator pointing at the first element.
void clear()
Clear the object.
const_iterator end() const
Get a constant iterator pointing at the end of the container.
ElementLink< asso_container_type > ElemLink
ELVIterator< typename RefVector::reverse_iterator > reverse_iterator
virtual bool toTransient()
Reset the object's internal cache.
ElementLinkVector(const ElemLinkVec &parent)
Copy constructor.
void insert(iterator position, size_type n, const ElemLink &link)
Insert a number of identical links in a certain position.
size_type max_size() const
Get the maximal size of the object.
iterator erase(iterator position)
Erase one element from the vector.
bool operator==(const ElementLinkVector &rhs) const
Comparison operator.
const_reference operator[](size_type n) const
Get the element at a given index.
void resize(size_type sz, const ElemLink &link=ElemLink())
Resize the vector to the specified size.
void push_back(const ElemLink &el)
Add a new element link at the end of the vector.
reverse_iterator rbegin()
Get a reverse iterator pointing at the last element.
const_reference front() const
Get the first element.
const_reverse_iterator rend() const
Get a constant reverse iterator pointing at the beginning of the container.
iterator insert(iterator position, const ElemLink &link)
Insert a link in a certain position.
ElementLinkVector(size_type n, const ElemLink &link=ElemLink())
Constructor creating a vector of a given size.
const_reference at(size_type n) const
Get the element at a given index (with size check)
ElemLinkVec & operator=(const ElemLinkVec &rhs)
Assignment operator.
size_type size() const
Get the size of the vector.
ELVIterator< typename RefVector::iterator > iterator
reverse_iterator rend()
Get a reverse iterator pointing at the beginning of the container.
bool empty() const
Function checking if the vector is empty.
void assign(size_type n, const ElemLink &link)
Fill the vector with N identical links.
const_reverse_iterator rbegin() const
Get a constant reverse iterator pointing at the last element.
bool toPersistent()
Function copying the transient data into the persistent variables.
size_type capacity() const
Get the capacity of the currently allocated object.
ROOT::Meta::Selection::ElementLinkVector< asso_container_type >::self DictSel
void pop_back()
Remove the last element from the vector.
iterator begin()
Get an iterator pointing at the first element.
iterator end()
Get an iterator pointing at the end of the container.
void swap(ElemLinkVec &vec)
Swap the container's contents with another object's.
void reserve(size_type sz)
Reserve some slots in the vector.
ElementLinkVector()
Default constructor.
ElementLinkVector< asso_container_type > ElemLinkVec
bool operator!=(const ElementLinkVector &rhs) const
Comparison operator.
iterator erase(iterator first, iterator last)
Erase a set of elements from the vector.
ELVIterator< typename RefVector::const_iterator > const_iterator
ELVIterator< typename RefVector::const_reverse_iterator > const_reverse_iterator
const_reference back() const
Get the last element.
void assign(InputIterator first, InputIterator last)
Fill the vector with the contents of another container.
Selection rules: declare transient members.
Definition DataVector.h:581
ROOT::Meta::Selection::MemberAttributes< kTransient > m_elVec