CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
tmtt::Array2D< T > Class Template Reference

#include <Array2D.h>

Public Member Functions

 Array2D (unsigned int m, unsigned int n)
 
Toperator() (unsigned int i, unsigned int j)
 
const Toperator() (unsigned int i, unsigned int j) const
 

Private Attributes

std::vector< Tarray2D_
 
unsigned int m_
 
unsigned int n_
 

Detailed Description

template<typename T>
class tmtt::Array2D< T >

Definition at line 19 of file Array2D.h.

Constructor & Destructor Documentation

◆ Array2D()

template<typename T>
tmtt::Array2D< T >::Array2D ( unsigned int  m,
unsigned int  n 
)
inline

Definition at line 22 of file Array2D.h.

22 : array2D_(m * n), m_{m}, n_{n} {}

Member Function Documentation

◆ operator()() [1/2]

template<typename T>
T& tmtt::Array2D< T >::operator() ( unsigned int  i,
unsigned int  j 
)
inline

Definition at line 31 of file Array2D.h.

31  {
32  // Non-const version of operator, without needing to duplicate code.
33  // (Scott Meyers trick).
34  return const_cast<T&>(std::as_const(*this)(i, j));
35  }

◆ operator()() [2/2]

template<typename T>
const T& tmtt::Array2D< T >::operator() ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 24 of file Array2D.h.

24  {
25  if (i >= m_ || j >= n_)
26  throw cms::Exception("LogicError")
27  << "Array2D: indices out of range " << i << " " << j << " " << m_ << " " << n_;
28  return array2D_[i * n_ + j];
29  }

Member Data Documentation

◆ array2D_

template<typename T>
std::vector<T> tmtt::Array2D< T >::array2D_
private

◆ m_

template<typename T>
unsigned int tmtt::Array2D< T >::m_
private

◆ n_

template<typename T>
unsigned int tmtt::Array2D< T >::n_
private
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
tmtt::Array2D::n_
unsigned int n_
Definition: Array2D.h:39
tmtt::Array2D::m_
unsigned int m_
Definition: Array2D.h:39
Exception
Definition: hltDiff.cc:245
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
tmtt::Array2D::array2D_
std::vector< T > array2D_
Definition: Array2D.h:38