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 48 of file AthenaHitsVector.h.

Member Typedef Documentation

◆ base_value_type

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

Definition at line 52 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 66 of file AthenaHitsVector.h.

◆ const_pointer

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

Definition at line 60 of file AthenaHitsVector.h.

◆ const_reference

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

Definition at line 61 of file AthenaHitsVector.h.

◆ CONT

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

Definition at line 53 of file AthenaHitsVector.h.

◆ difference_type

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

Definition at line 59 of file AthenaHitsVector.h.

◆ iterator

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

Definition at line 57 of file AthenaHitsVector.h.

◆ pointer

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

Definition at line 55 of file AthenaHitsVector.h.

◆ reference

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

Definition at line 56 of file AthenaHitsVector.h.

◆ size_type

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

Definition at line 58 of file AthenaHitsVector.h.

◆ value_type

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

Definition at line 54 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 73 of file AthenaHitsVector.h.

77 {
79 MsgStream log(msgSvc, "AthenaHitsVector");
80 log << MSG::DEBUG << " initialized " << collectionName
81 << " with ownership policy " << m_ownPolicy << endmsg;
82 }
AthHitVec::OwnershipPolicy m_ownPolicy

◆ ~AthenaHitsVector()

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

Definition at line 83 of file AthenaHitsVector.h.

83{ 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 110 of file AthenaHitsVector.h.

110 {
111 m_hitvector.reserve(rhs.m_hitvector.size());
113 while (i != e) {
114 m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
115 ++i;
116 }
117 }
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
std::vector< T * > m_hitvector
const_iterator end() const
const_iterator begin() const

Member Function Documentation

◆ At()

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

Definition at line 165 of file AthenaHitsVector.h.

165{ return m_hitvector.at(pos); }

◆ begin() [1/2]

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

Definition at line 156 of file AthenaHitsVector.h.

156{ return m_hitvector.begin(); }

◆ begin() [2/2]

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

Definition at line 148 of file AthenaHitsVector.h.

◆ Clear() [1/2]

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

Definition at line 85 of file AthenaHitsVector.h.

85 {
86 // delete pointers if we own the elements
88 for (unsigned int i = 0; i < m_hitvector.size(); i++)
89 delete m_hitvector[i];
90 }
91 m_hitvector.clear();
92 }

◆ Clear() [2/2]

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

Definition at line 94 of file AthenaHitsVector.h.

94 {
95 // delete pointers if we own the elements
97 for (unsigned int i = 0; i < m_hitvector.size(); i++)
98 delete m_hitvector[i];
99 }
100 m_hitvector.clear();
102 }

◆ clear()

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

Definition at line 183 of file AthenaHitsVector.h.

183 {
185 for (unsigned int i = 0; i < m_hitvector.size(); i++)
186 delete m_hitvector[i];
187 }
188 m_hitvector.clear();
189 }

◆ empty()

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

Definition at line 146 of file AthenaHitsVector.h.

146{ return m_hitvector.empty(); }

◆ end() [1/2]

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

Definition at line 158 of file AthenaHitsVector.h.

158{ return m_hitvector.end(); }

◆ end() [2/2]

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

Definition at line 152 of file AthenaHitsVector.h.

152 {
153 return const_iterator(m_hitvector.end(), make_const());
154 }

◆ getVector()

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

Definition at line 144 of file AthenaHitsVector.h.

144{ return m_hitvector; }

◆ initHelper()

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

Definition at line 201 of file AthenaHitsVector.h.

201 {
203 };
static const std::type_info * initHelper()

◆ Insert()

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

Definition at line 104 of file AthenaHitsVector.h.

104{ m_hitvector.push_back(h); }

◆ Name()

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

Definition at line 139 of file AthenaHitsVector.h.

139{ 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 122 of file AthenaHitsVector.h.

122 {
123 if (this != &rhs) {
124 this->Clear();
126 m_hitvector.reserve(rhs.m_hitvector.size());
128 while (i != e) {
129 m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
130 ++i;
131 }
132 } else {
134 }
135 }
136 return *this;
137 }

◆ operator[]()

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

Definition at line 167 of file AthenaHitsVector.h.

167{ 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 163 of file AthenaHitsVector.h.

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

◆ push_back() [2/2]

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

Definition at line 162 of file AthenaHitsVector.h.

162{ m_hitvector.push_back(t); }

◆ reserve()

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

Definition at line 191 of file AthenaHitsVector.h.

191{ m_hitvector.reserve(n); }

◆ resize()

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

Definition at line 169 of file AthenaHitsVector.h.

169 {
170 if (sz < size()) {
172 iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
173 while (i != e) {
174 delete *i++;
175 }
176 }
177 m_hitvector.resize(sz);
178 } else {
179 m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
180 }
181 }
typename CONT::iterator iterator
size_type size() const

◆ setName()

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

Definition at line 141 of file AthenaHitsVector.h.

141{ m_name = name; }

◆ Size()

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

Definition at line 105 of file AthenaHitsVector.h.

105{ return size(); }

◆ size()

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

Definition at line 160 of file AthenaHitsVector.h.

160{ return m_hitvector.size(); }

Member Data Documentation

◆ m_hitvector

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

Definition at line 195 of file AthenaHitsVector.h.

◆ m_name

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

Definition at line 194 of file AthenaHitsVector.h.

◆ m_ownPolicy

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

Definition at line 196 of file AthenaHitsVector.h.

◆ s_info

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

Definition at line 204 of file AthenaHitsVector.h.


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