ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaHitsVector< T > Class Template Reference

#include <AthenaHitsVector.h>

Inheritance diagram for AthenaHitsVector< T >:
Collaboration diagram for AthenaHitsVector< T >:

Classes

struct  make_const

Public Types

using base_value_type = T
using CONT = std::vector<T*>
using value_type = typename CONT::value_type
using pointer = typename CONT::pointer
using reference = typename CONT::reference
using iterator = typename CONT::iterator
using size_type = typename CONT::size_type
using difference_type = typename CONT::difference_type
using const_pointer = const T* const*
using const_reference = const T* const&
using const_iterator

Public Member Functions

 AthenaHitsVector (const std::string &collectionName="DefaultCollectionName", AthHitVec::OwnershipPolicy ownPolicy=AthHitVec::OWN_ELEMENTS)
 ~AthenaHitsVector () override
void Clear ()
void Clear (AthHitVec::OwnershipPolicy ownPolicy)
void Insert (T *h)
int Size () const
 AthenaHitsVector (const AthenaHitsVector< T > &rhs)
 copy constructor makes deep copy of elements, as by default the container is AthHitVec::OWN_ELEMENTS
AthenaHitsVector< T > & operator= (const AthenaHitsVector< T > &rhs)
 assignment deletes old elements and copies the new ones deep copy if AthHitVec::OWN_ELEMENTS shallow copy if VIEW_ELEMENTS
const std::string & Name () const
void setName (const std::string &name)
const std::vector< T * > & getVector ()
bool empty () const
const_iterator begin () const
const_iterator end () const
iterator begin ()
iterator end ()
size_type size () const
void push_back (T *t)
void push_back (std::unique_ptr< T > t)
const T * At (unsigned int pos) const
const T * operator[] (size_type n) const
void resize (size_type sz)
void clear ()
void reserve (size_type n)

Static Public Member Functions

static const std::type_info * initHelper ()

Static Public Attributes

static const std::type_info *const s_info

Protected Attributes

std::string m_name
std::vector< T * > m_hitvector
AthHitVec::OwnershipPolicy m_ownPolicy = AthHitVec::OWN_ELEMENTS

Detailed Description

template<typename T>
class AthenaHitsVector< T >

Definition at line 87 of file AthenaHitsVector.h.

Member Typedef Documentation

◆ base_value_type

template<typename T>
using AthenaHitsVector< T >::base_value_type = T

Definition at line 91 of file AthenaHitsVector.h.

◆ const_iterator

template<typename T>
using AthenaHitsVector< T >::const_iterator
Initial value:
boost::transform_iterator<make_const, typename CONT::const_iterator>

Definition at line 105 of file AthenaHitsVector.h.

◆ const_pointer

template<typename T>
using AthenaHitsVector< T >::const_pointer = const T* const*

Definition at line 99 of file AthenaHitsVector.h.

◆ const_reference

template<typename T>
using AthenaHitsVector< T >::const_reference = const T* const&

Definition at line 100 of file AthenaHitsVector.h.

◆ CONT

template<typename T>
using AthenaHitsVector< T >::CONT = std::vector<T*>

Definition at line 92 of file AthenaHitsVector.h.

◆ difference_type

template<typename T>
using AthenaHitsVector< T >::difference_type = typename CONT::difference_type

Definition at line 98 of file AthenaHitsVector.h.

◆ iterator

template<typename T>
using AthenaHitsVector< T >::iterator = typename CONT::iterator

Definition at line 96 of file AthenaHitsVector.h.

◆ pointer

template<typename T>
using AthenaHitsVector< T >::pointer = typename CONT::pointer

Definition at line 94 of file AthenaHitsVector.h.

◆ reference

template<typename T>
using AthenaHitsVector< T >::reference = typename CONT::reference

Definition at line 95 of file AthenaHitsVector.h.

◆ size_type

template<typename T>
using AthenaHitsVector< T >::size_type = typename CONT::size_type

Definition at line 97 of file AthenaHitsVector.h.

◆ value_type

template<typename T>
using AthenaHitsVector< T >::value_type = typename CONT::value_type

Definition at line 93 of file AthenaHitsVector.h.

Constructor & Destructor Documentation

◆ AthenaHitsVector() [1/2]

template<typename T>
AthenaHitsVector< T >::AthenaHitsVector ( const std::string & collectionName = "DefaultCollectionName",
AthHitVec::OwnershipPolicy ownPolicy = AthHitVec::OWN_ELEMENTS )
inline

Definition at line 112 of file AthenaHitsVector.h.

116 {
118 MsgStream log(msgSvc, "AthenaHitsVector");
119 log << MSG::DEBUG << " initialized " << collectionName
120 << " with ownership policy " << m_ownPolicy << endmsg;
121 }
AthHitVec::OwnershipPolicy m_ownPolicy

◆ ~AthenaHitsVector()

template<typename T>
AthenaHitsVector< T >::~AthenaHitsVector ( )
inlineoverride

Definition at line 122 of file AthenaHitsVector.h.

122{ Clear(); }

◆ AthenaHitsVector() [2/2]

template<typename T>
AthenaHitsVector< T >::AthenaHitsVector ( const AthenaHitsVector< T > & rhs)
inlineexplicit

copy constructor makes deep copy of elements, as by default the container is AthHitVec::OWN_ELEMENTS

Definition at line 149 of file AthenaHitsVector.h.

149 {
150 m_hitvector.reserve(rhs.m_hitvector.size());
152 while (i != e) {
153 m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
154 ++i;
155 }
156 }
std::vector< T * > m_hitvector
const_iterator end() const
const_iterator begin() const
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator

Member Function Documentation

◆ At()

template<typename T>
const T * AthenaHitsVector< T >::At ( unsigned int pos) const
inline

Definition at line 204 of file AthenaHitsVector.h.

204{ return m_hitvector.at(pos); }

◆ begin() [1/2]

template<typename T>
iterator AthenaHitsVector< T >::begin ( )
inline

Definition at line 195 of file AthenaHitsVector.h.

195{ return m_hitvector.begin(); }

◆ begin() [2/2]

template<typename T>
const_iterator AthenaHitsVector< T >::begin ( ) const
inline

Definition at line 187 of file AthenaHitsVector.h.

◆ Clear() [1/2]

template<typename T>
void AthenaHitsVector< T >::Clear ( )
inline

Definition at line 124 of file AthenaHitsVector.h.

124 {
125 // delete pointers if we own the elements
127 for (unsigned int i = 0; i < m_hitvector.size(); i++)
128 delete m_hitvector[i];
129 }
130 m_hitvector.clear();
131 }

◆ Clear() [2/2]

template<typename T>
void AthenaHitsVector< T >::Clear ( AthHitVec::OwnershipPolicy ownPolicy)
inline

Definition at line 133 of file AthenaHitsVector.h.

133 {
134 // delete pointers if we own the elements
136 for (unsigned int i = 0; i < m_hitvector.size(); i++)
137 delete m_hitvector[i];
138 }
139 m_hitvector.clear();
141 }

◆ clear()

template<typename T>
void AthenaHitsVector< T >::clear ( )
inline

Definition at line 222 of file AthenaHitsVector.h.

222 {
224 for (unsigned int i = 0; i < m_hitvector.size(); i++)
225 delete m_hitvector[i];
226 }
227 m_hitvector.clear();
228 }

◆ empty()

template<typename T>
bool AthenaHitsVector< T >::empty ( ) const
inline

Definition at line 185 of file AthenaHitsVector.h.

185{ return m_hitvector.empty(); }

◆ end() [1/2]

template<typename T>
iterator AthenaHitsVector< T >::end ( )
inline

Definition at line 197 of file AthenaHitsVector.h.

197{ return m_hitvector.end(); }

◆ end() [2/2]

template<typename T>
const_iterator AthenaHitsVector< T >::end ( ) const
inline

Definition at line 191 of file AthenaHitsVector.h.

191 {
192 return const_iterator(m_hitvector.end(), make_const());
193 }

◆ getVector()

template<typename T>
const std::vector< T * > & AthenaHitsVector< T >::getVector ( )
inline

Definition at line 183 of file AthenaHitsVector.h.

183{ return m_hitvector; }

◆ initHelper()

template<typename T>
const std::type_info * AthenaHitsVector< T >::initHelper ( )
inlinestatic

Definition at line 240 of file AthenaHitsVector.h.

240 {
242 };
static const std::type_info * initHelper()

◆ Insert()

template<typename T>
void AthenaHitsVector< T >::Insert ( T * h)
inline

Definition at line 143 of file AthenaHitsVector.h.

143{ m_hitvector.push_back(h); }

◆ Name()

template<typename T>
const std::string & AthenaHitsVector< T >::Name ( ) const
inline

Definition at line 178 of file AthenaHitsVector.h.

178{ return m_name; }

◆ operator=()

template<typename T>
AthenaHitsVector< T > & AthenaHitsVector< T >::operator= ( const AthenaHitsVector< T > & rhs)
inline

assignment deletes old elements and copies the new ones deep copy if AthHitVec::OWN_ELEMENTS shallow copy if VIEW_ELEMENTS

Definition at line 161 of file AthenaHitsVector.h.

161 {
162 if (this != &rhs) {
163 this->Clear();
165 m_hitvector.reserve(rhs.m_hitvector.size());
167 while (i != e) {
168 m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
169 ++i;
170 }
171 } else {
173 }
174 }
175 return *this;
176 }

◆ operator[]()

template<typename T>
const T * AthenaHitsVector< T >::operator[] ( size_type n) const
inline

Definition at line 206 of file AthenaHitsVector.h.

206{ return m_hitvector[n]; }

◆ push_back() [1/2]

template<typename T>
void AthenaHitsVector< T >::push_back ( std::unique_ptr< T > t)
inline

Definition at line 202 of file AthenaHitsVector.h.

202{ m_hitvector.push_back(t.release()); }

◆ push_back() [2/2]

template<typename T>
void AthenaHitsVector< T >::push_back ( T * t)
inline

Definition at line 201 of file AthenaHitsVector.h.

201{ m_hitvector.push_back(t); }

◆ reserve()

template<typename T>
void AthenaHitsVector< T >::reserve ( size_type n)
inline

Definition at line 230 of file AthenaHitsVector.h.

230{ m_hitvector.reserve(n); }

◆ resize()

template<typename T>
void AthenaHitsVector< T >::resize ( size_type sz)
inline

Definition at line 208 of file AthenaHitsVector.h.

208 {
209 if (sz < size()) {
211 iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
212 while (i != e) {
213 delete *i++;
214 }
215 }
216 m_hitvector.resize(sz);
217 } else {
218 m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
219 }
220 }
typename CONT::iterator iterator
size_type size() const

◆ setName()

template<typename T>
void AthenaHitsVector< T >::setName ( const std::string & name)
inline

Definition at line 180 of file AthenaHitsVector.h.

180{ m_name = name; }

◆ Size()

template<typename T>
int AthenaHitsVector< T >::Size ( ) const
inline

Definition at line 144 of file AthenaHitsVector.h.

144{ return size(); }

◆ size()

template<typename T>
size_type AthenaHitsVector< T >::size ( ) const
inline

Definition at line 199 of file AthenaHitsVector.h.

199{ return m_hitvector.size(); }

Member Data Documentation

◆ m_hitvector

template<typename T>
std::vector<T*> AthenaHitsVector< T >::m_hitvector
protected

Definition at line 234 of file AthenaHitsVector.h.

◆ m_name

template<typename T>
std::string AthenaHitsVector< T >::m_name
protected

Definition at line 233 of file AthenaHitsVector.h.

◆ m_ownPolicy

template<typename T>
AthHitVec::OwnershipPolicy AthenaHitsVector< T >::m_ownPolicy = AthHitVec::OWN_ELEMENTS
protected

Definition at line 235 of file AthenaHitsVector.h.

◆ s_info

template<typename T>
const std::type_info* const AthenaHitsVector< T >::s_info
static

Definition at line 243 of file AthenaHitsVector.h.


The documentation for this class was generated from the following file: