00001
00002
00003 #ifndef ATHLINKS_ELEMENTLINKVECTOR_H
00004 #define ATHLINKS_ELEMENTLINKVECTOR_H
00005
00006
00007 #include <vector>
00008
00009
00010 #include "AthLinks/ElementLink.h"
00011 #include "AthLinks/ElementLinkVectorBase.h"
00012 #include "AthLinks/tools/selection_ns.h"
00013
00014
00015 ENTER_ROOT_SELECTION_NS
00016 template< class CONTAINER >
00017 class ElementLinkVector;
00018 EXIT_ROOT_SELECTION_NS
00019
00033 template< class CONTAINER >
00034 class ElementLinkVector : public ElementLinkVectorBase {
00035
00036 public:
00038 typedef ElementLinkVector< CONTAINER > ElemLinkVec;
00040 typedef ElementLink< CONTAINER > ElemLink;
00041
00044
00046 typedef ElemLink value_type;
00048 typedef ElemLink& reference;
00050 typedef const ElemLink& const_reference;
00052 typedef typename std::vector< ElemLink >::iterator iterator;
00054 typedef typename std::vector< ElemLink >::const_iterator const_iterator;
00056 typedef typename std::vector< ElemLink >::reverse_iterator reverse_iterator;
00058 typedef typename std::vector< ElemLink >::const_reverse_iterator
00059 const_reverse_iterator;
00061 typedef typename std::vector< ElemLink >::size_type size_type;
00062
00064
00067
00069 ElementLinkVector();
00071 ElementLinkVector( size_type n, const ElemLink& link = ElemLink() );
00073 ElementLinkVector( const ElemLinkVec& parent );
00074
00076
00078 ElemLinkVec& operator=( const ElemLinkVec& rhs );
00079
00082
00084 iterator begin() { return m_elVec.begin(); }
00086 const_iterator begin() const { return m_elVec.begin(); }
00087
00089 iterator end() { return m_elVec.end(); }
00091 const_iterator end() const { return m_elVec.end(); }
00092
00094 reverse_iterator rbegin() { return m_elVec.rbegin(); }
00096 const_reverse_iterator rbegin() const { return m_elVec.rbegin(); }
00097
00099 reverse_iterator rend() { return m_elVec.rend(); }
00101 const_reverse_iterator rend() const { return m_elVec.rend(); }
00102
00104
00107
00109 size_type size() const { return m_elVec.size(); }
00111 size_type max_size() const { return m_elVec.max_size(); }
00113 size_type capacity() const { return m_elVec.capacity(); }
00115 void resize( size_type sz, const ElemLink& link = ElemLink() );
00117 void reserve( size_type sz ) { m_elVec.reserve( sz ); }
00119 bool empty() const { return ( size() == 0 ); }
00120
00122
00125
00127 const_reference operator[]( size_type n ) const { return m_elVec[ n ]; }
00129 const_reference at( size_type n ) const { return m_elVec.at( n ); }
00131 const_reference front() const { return m_elVec.front(); }
00133 const_reference back() const { return m_elVec.back(); }
00134
00136
00139
00141 void push_back( const ElemLink& el );
00143 void pop_back();
00144
00146 iterator erase( iterator position );
00148 iterator erase( iterator first, iterator last );
00149
00151 void swap( ElemLinkVec& vec );
00152
00154 template< class InputIterator >
00155 void assign( InputIterator first, InputIterator last );
00157 void assign( size_type n, const ElemLink& link );
00158
00160 iterator insert( iterator position, const ElemLink& link );
00162 void insert( iterator position, size_type n, const ElemLink& link );
00163
00165 void clear();
00166
00168
00170 virtual bool toTransient();
00172 bool toPersistent();
00173
00174 private:
00176 std::vector< ElemLink > m_elVec;
00177
00179 typedef typename
00180 ROOT_SELECTION_NS::ElementLinkVector< CONTAINER >::self DictSel;
00181
00182 };
00183
00184
00185
00186
00187
00188 ENTER_ROOT_SELECTION_NS
00189 template< class CONTAINER >
00190 class ElementLinkVector
00191 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 0, 2 )
00192 : public SelectNoInstance
00193 #endif
00194 {
00195
00196 public:
00198 typedef ElementLinkVector< CONTAINER > self;
00199
00200 #if ROOT_VERSION_CODE < ROOT_VERSION( 5, 99, 0 )
00201
00203 ROOT_SELECTION_NS::NO_SELF_AUTOSELECT dummy;
00204
00206 ROOT_SELECTION_NS::TRANSIENT m_elVec;
00207
00208 #else
00209
00211 ROOT_SELECTION_NS::MemberAttributes< kTransient > m_elVec;
00212
00213 #endif // ROOT_VERSION
00214
00215 };
00216 EXIT_ROOT_SELECTION_NS
00217
00218
00219 #ifndef __GCCXML__
00220 # include "AthLinks/ElementLinkVector.icc"
00221 #endif // not __GCCXML__
00222
00223 #endif // ATHLINKS_ELEMENTLINKVECTOR_H