Belle II Software development
WrapArray2D< T > Class Template Reference

class to replace POD 2D array to save stack usage since it just allocates memory dynamically. More...

#include <WrapArray2D.h>

Public Member Functions

 WrapArray2D (int rows, int cols)
 replace POD 2D array

 
 WrapArray2D (const WrapArray2D &)=delete
 no copy
 
WrapArray2Doperator= (const WrapArray2D &)=delete
 no assignment
 
 ~WrapArray2D ()
 destructor
 
T * operator[] (int irow)
 return row
 
 operator T* ()
 return
 

Private Attributes

T * m_data
 content of the 2d array
 
int m_ncols
 number of columns
 

Detailed Description

template<typename T>
class Belle2::ECL::WrapArray2D< T >

class to replace POD 2D array to save stack usage since it just allocates memory dynamically.

Definition at line 23 of file WrapArray2D.h.

Constructor & Destructor Documentation

◆ WrapArray2D()

WrapArray2D ( int  rows,
int  cols 
)
inline

replace POD 2D array

Definition at line 26 of file WrapArray2D.h.

26 :
27 m_data(new T[rows * cols]), m_ncols(cols)
28 {}
T * m_data
content of the 2d array
Definition: WrapArray2D.h:50
int m_ncols
number of columns
Definition: WrapArray2D.h:51

◆ ~WrapArray2D()

~WrapArray2D ( )
inline

destructor

Definition at line 37 of file WrapArray2D.h.

38 { delete [] m_data; }

Member Function Documentation

◆ operator T*()

operator T* ( )
inline

return

Definition at line 47 of file WrapArray2D.h.

47{ return m_data; }

◆ operator[]()

T * operator[] ( int  irow)
inline

return row

Definition at line 41 of file WrapArray2D.h.

42 {
43 return m_data + irow * m_ncols;
44 }

Member Data Documentation

◆ m_data

T* m_data
private

content of the 2d array

Definition at line 50 of file WrapArray2D.h.

◆ m_ncols

int m_ncols
private

number of columns

Definition at line 51 of file WrapArray2D.h.


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