ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AthenaHitsVector< T > Class Template Reference

#include <AthenaHitsVector.h>

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 = boost::transform_iterator< make_const, typename CONT::const_iterator >
 

Public Member Functions

 AthenaHitsVector (const std::string &collectionName="DefaultCollectionName", AthHitVec::OwnershipPolicy ownPolicy=AthHitVec::OWN_ELEMENTS)
 
 ~AthenaHitsVector ()
 
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 More...
 
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 More...
 
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 39 of file AthenaHitsVector.h.

Member Typedef Documentation

◆ base_value_type

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

Definition at line 43 of file AthenaHitsVector.h.

◆ const_iterator

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

Definition at line 57 of file AthenaHitsVector.h.

◆ const_pointer

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

Definition at line 51 of file AthenaHitsVector.h.

◆ const_reference

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

Definition at line 52 of file AthenaHitsVector.h.

◆ CONT

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

Definition at line 44 of file AthenaHitsVector.h.

◆ difference_type

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

Definition at line 50 of file AthenaHitsVector.h.

◆ iterator

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

Definition at line 48 of file AthenaHitsVector.h.

◆ pointer

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

Definition at line 46 of file AthenaHitsVector.h.

◆ reference

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

Definition at line 47 of file AthenaHitsVector.h.

◆ size_type

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

Definition at line 49 of file AthenaHitsVector.h.

◆ value_type

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

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

66  : m_name (collectionName),
67  m_ownPolicy (ownPolicy)
68  {
69  IMessageSvc* msgSvc(Athena::getMessageSvc());
70  MsgStream log(msgSvc, "AthenaHitsVector");
71  log << MSG::DEBUG << " initialized " << collectionName
72  << " with ownership policy " << m_ownPolicy << endmsg;
73  }

◆ ~AthenaHitsVector()

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

Definition at line 74 of file AthenaHitsVector.h.

74 { 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 101 of file AthenaHitsVector.h.

101  {
102  m_hitvector.reserve(rhs.m_hitvector.size());
103  const_iterator i(rhs.begin()), e(rhs.end());
104  while (i != e) {
105  m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
106  ++i;
107  }
108  }

Member Function Documentation

◆ At()

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

Definition at line 156 of file AthenaHitsVector.h.

156 { return m_hitvector.at(pos); }

◆ begin() [1/2]

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

Definition at line 147 of file AthenaHitsVector.h.

147 { return m_hitvector.begin(); }

◆ begin() [2/2]

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

Definition at line 139 of file AthenaHitsVector.h.

139  {
140  return const_iterator(m_hitvector.begin(), make_const());
141  }

◆ Clear() [1/2]

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

Definition at line 76 of file AthenaHitsVector.h.

76  {
77  // delete pointers if we own the elements
79  for (unsigned int i = 0; i < m_hitvector.size(); i++)
80  delete m_hitvector[i];
81  }
82  m_hitvector.clear();
83  }

◆ clear()

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

Definition at line 174 of file AthenaHitsVector.h.

174  {
176  for (unsigned int i = 0; i < m_hitvector.size(); i++)
177  delete m_hitvector[i];
178  }
179  m_hitvector.clear();
180  }

◆ Clear() [2/2]

template<typename T >
void AthenaHitsVector< T >::Clear ( AthHitVec::OwnershipPolicy  ownPolicy)
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  m_ownPolicy = ownPolicy;
93  }

◆ empty()

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

Definition at line 137 of file AthenaHitsVector.h.

137 { return m_hitvector.empty(); }

◆ end() [1/2]

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

Definition at line 149 of file AthenaHitsVector.h.

149 { return m_hitvector.end(); }

◆ end() [2/2]

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

Definition at line 143 of file AthenaHitsVector.h.

143  {
144  return const_iterator(m_hitvector.end(), make_const());
145  }

◆ getVector()

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

Definition at line 135 of file AthenaHitsVector.h.

135 { return m_hitvector; }

◆ initHelper()

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

Definition at line 192 of file AthenaHitsVector.h.

◆ Insert()

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

Definition at line 95 of file AthenaHitsVector.h.

95 { m_hitvector.push_back(h); }

◆ Name()

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

Definition at line 130 of file AthenaHitsVector.h.

130 { 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 113 of file AthenaHitsVector.h.

113  {
114  if (this != &rhs) {
115  this->Clear();
116  if (this->m_ownPolicy == AthHitVec::OWN_ELEMENTS) {
117  m_hitvector.reserve(rhs.m_hitvector.size());
118  const_iterator i(rhs.begin()), e(rhs.end());
119  while (i != e) {
120  m_hitvector.push_back((nullptr != *i) ? new T(**i) : nullptr);
121  ++i;
122  }
123  } else {
124  this->m_hitvector = rhs.m_hitvector;
125  }
126  }
127  return *this;
128  }

◆ operator[]()

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

Definition at line 158 of file AthenaHitsVector.h.

158 { 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 154 of file AthenaHitsVector.h.

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

◆ push_back() [2/2]

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

Definition at line 153 of file AthenaHitsVector.h.

153 { m_hitvector.push_back(t); }

◆ reserve()

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

Definition at line 182 of file AthenaHitsVector.h.

182 { m_hitvector.reserve(n); }

◆ resize()

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

Definition at line 160 of file AthenaHitsVector.h.

160  {
161  if (sz < size()) {
163  iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
164  while (i != e) {
165  delete *i++;
166  }
167  }
168  m_hitvector.resize(sz);
169  } else {
170  m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
171  }
172  }

◆ setName()

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

Definition at line 132 of file AthenaHitsVector.h.

132 { m_name = name; }

◆ Size()

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

Definition at line 96 of file AthenaHitsVector.h.

96 { return size(); }

◆ size()

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

Definition at line 151 of file AthenaHitsVector.h.

151 { return m_hitvector.size(); }

Member Data Documentation

◆ m_hitvector

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

Definition at line 186 of file AthenaHitsVector.h.

◆ m_name

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

Definition at line 185 of file AthenaHitsVector.h.

◆ m_ownPolicy

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

Definition at line 187 of file AthenaHitsVector.h.

◆ s_info

template<class T >
const std::type_info *const AthenaHitsVector< T >::s_info
static
Initial value:

Definition at line 195 of file AthenaHitsVector.h.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
fitman.sz
sz
Definition: fitman.py:527
AthenaHitsVector::Clear
void Clear()
Definition: AthenaHitsVector.h:76
AthHitVec::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: AthenaHitsVector.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaHitsVector::m_hitvector
std::vector< T * > m_hitvector
Definition: AthenaHitsVector.h:186
AthenaHitsVector::const_iterator
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
Definition: AthenaHitsVector.h:58
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AthenaHitsVector::initHelper
static const std::type_info * initHelper()
Definition: AthenaHitsVector.h:192
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthenaHitsVector::iterator
typename CONT::iterator iterator
Definition: AthenaHitsVector.h:48
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
h
AthenaHitsVector::m_name
std::string m_name
Definition: AthenaHitsVector.h:185
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AthenaHitsVector::size
size_type size() const
Definition: AthenaHitsVector.h:151
AthenaHitsVector::end
const_iterator end() const
Definition: AthenaHitsVector.h:143
DataModel_detail::DVLInfo
Definition: DVLInfo.h:237
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
AthenaHitsVector::begin
const_iterator begin() const
Definition: AthenaHitsVector.h:139
AthenaHitsVector::m_ownPolicy
AthHitVec::OwnershipPolicy m_ownPolicy
Definition: AthenaHitsVector.h:187