ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
vector2D< T > Class Template Reference

#include <FPGATrackSimVectors.h>

Collaboration diagram for vector2D< T >:

Public Member Functions

 vector2D ()
 
 vector2D (size_t d1, size_t d2, T const &t=T())
 
size_t size (int dim) const
 
void resize (size_t x1, size_t x2, T const &t=T())
 
T & operator() (size_t i, size_t j)
 
T constoperator() (size_t i, size_t j) const
 
T * operator[] (size_t i)
 
const T * operator[] (size_t i) const
 
T * data ()
 
const T * data () const
 

Private Attributes

size_t m_d1
 
size_t m_d2
 
std::vector< T > m_data
 

Detailed Description

template<typename T>
class vector2D< T >

Definition at line 27 of file FPGATrackSimVectors.h.

Constructor & Destructor Documentation

◆ vector2D() [1/2]

template<typename T >
vector2D< T >::vector2D ( )
inline

Definition at line 36 of file FPGATrackSimVectors.h.

36  :
37  m_d1(0), m_d2(0)
38  {}

◆ vector2D() [2/2]

template<typename T >
vector2D< T >::vector2D ( size_t  d1,
size_t  d2,
T const t = T() 
)
inline

Definition at line 40 of file FPGATrackSimVectors.h.

40  :
41  m_d1(d1), m_d2(d2), m_data(d1*d2, t)
42  {}

Member Function Documentation

◆ data() [1/2]

template<typename T >
T* vector2D< T >::data ( )
inline

Definition at line 110 of file FPGATrackSimVectors.h.

111  {
112  return m_data.data();
113  }

◆ data() [2/2]

template<typename T >
const T* vector2D< T >::data ( ) const
inline

Definition at line 115 of file FPGATrackSimVectors.h.

116  {
117  return m_data.data();
118  }

◆ operator()() [1/2]

template<typename T >
T& vector2D< T >::operator() ( size_t  i,
size_t  j 
)
inline

Definition at line 58 of file FPGATrackSimVectors.h.

59  {
60 #ifdef DEBUG_FPGATrackSimVECTORS
61  if (i >= m_d1 || j >= m_d2)
62  {
63  std::stringstream s;
64  s << "vector2D out of bounds: request (" << i << "," << j << ") size (" << m_d1 << "," << m_d2 << ")";
65  throw std::range_error(s.str());
66  }
67 #endif
68  return m_data[i*m_d2 + j];
69  }

◆ operator()() [2/2]

template<typename T >
T const& vector2D< T >::operator() ( size_t  i,
size_t  j 
) const
inline

Definition at line 71 of file FPGATrackSimVectors.h.

72  {
73 #ifdef DEBUG_FPGATrackSimVECTORS
74  if (i >= m_d1 || j >= m_d2)
75  {
76  std::stringstream s;
77  s << "vector2D out of bounds: request (" << i << "," << j << ") size (" << m_d1 << "," << m_d2 << ")";
78  throw std::range_error(s.str());
79  }
80 #endif
81  return m_data[i*m_d2 + j];
82  }

◆ operator[]() [1/2]

template<typename T >
T* vector2D< T >::operator[] ( size_t  i)
inline

Definition at line 84 of file FPGATrackSimVectors.h.

85  {
86 #ifdef DEBUG_FPGATrackSimVECTORS
87  if (i >= m_d1)
88  {
89  std::stringstream s;
90  s << "vector2D out of bounds: request " << i << " size (" << m_d1 << "," << m_d2 << ")";
91  throw std::range_error(s.str());
92  }
93 #endif
94  return m_data.data() + (i * m_d2);
95  }

◆ operator[]() [2/2]

template<typename T >
const T* vector2D< T >::operator[] ( size_t  i) const
inline

Definition at line 97 of file FPGATrackSimVectors.h.

98  {
99 #ifdef DEBUG_FPGATrackSimVECTORS
100  if (i >= m_d1)
101  {
102  std::stringstream s;
103  s << "vector2D out of bounds: request " << i << " size (" << m_d1 << "," << m_d2 << ")";
104  throw std::range_error(s.str());
105  }
106 #endif
107  return m_data.data() + (i * m_d2);
108  }

◆ resize()

template<typename T >
void vector2D< T >::resize ( size_t  x1,
size_t  x2,
T const t = T() 
)
inline

Definition at line 51 of file FPGATrackSimVectors.h.

52  {
53  m_d1 = x1;
54  m_d2 = x2;
55  m_data.resize(x1*x2, t);
56  }

◆ size()

template<typename T >
size_t vector2D< T >::size ( int  dim) const
inline

Definition at line 44 of file FPGATrackSimVectors.h.

45  {
46  if (dim == 0) return m_d1;
47  if (dim == 1) return m_d2;
48  else throw std::range_error("vector2D: Argument to size() must be 0 or 1");
49  }

Member Data Documentation

◆ m_d1

template<typename T >
size_t vector2D< T >::m_d1
private

Definition at line 31 of file FPGATrackSimVectors.h.

◆ m_d2

template<typename T >
size_t vector2D< T >::m_d2
private

Definition at line 31 of file FPGATrackSimVectors.h.

◆ m_data

template<typename T >
std::vector<T> vector2D< T >::m_data
private

Definition at line 32 of file FPGATrackSimVectors.h.


The documentation for this class was generated from the following file:
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
vector2D::m_data
std::vector< T > m_data
Definition: FPGATrackSimVectors.h:32
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
lumiFormat.i
int i
Definition: lumiFormat.py:85
vector2D::m_d2
size_t m_d2
Definition: FPGATrackSimVectors.h:31
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
vector2D::m_d1
size_t m_d1
Definition: FPGATrackSimVectors.h:31