Agora  1.2.0
Agora project
PtrGrid< ROWS, COLS, T > Class Template Reference

#include <memory_manage.h>

Public Member Functions

 PtrGrid ()
 
 PtrGrid (size_t num_entries)
 
 PtrGrid (size_t n_rows, size_t n_cols, size_t n_entries)
 
 ~PtrGrid ()
 
void Alloc (size_t n_rows, size_t n_cols, size_t n_entries)
 Allocate [n_entries] entries per pointer cell. More...
 
void RandAllocCxFloat (size_t n_entries)
 
std::array< T *, COLS > & operator[] (size_t row_idx)
 
 PtrGrid (PtrGrid const &)=delete
 
PtrGridoperator= (PtrGrid const &)=delete
 

Private Attributes

std::array< std::array< T *, COLS >, ROWS > mat_
 
Tbacking_buf_
 The pointer cells. More...
 

Constructor & Destructor Documentation

◆ PtrGrid() [1/4]

template<size_t ROWS, size_t COLS, class T >
PtrGrid< ROWS, COLS, T >::PtrGrid ( )
inline

◆ PtrGrid() [2/4]

template<size_t ROWS, size_t COLS, class T >
PtrGrid< ROWS, COLS, T >::PtrGrid ( size_t  num_entries)
inlineexplicit

Create a grid of pointers where each grid cell points to an array of [n_entries]

◆ PtrGrid() [3/4]

template<size_t ROWS, size_t COLS, class T >
PtrGrid< ROWS, COLS, T >::PtrGrid ( size_t  n_rows,
size_t  n_cols,
size_t  n_entries 
)
inline

Create a grid of pointers with dimensions [ROWS, COLS], where only the grid with dimensions [n_rows, n_cols] has cells pointing to an array of [n_entries]. This can use less memory than a fully-allocated grid.

◆ ~PtrGrid()

template<size_t ROWS, size_t COLS, class T >
PtrGrid< ROWS, COLS, T >::~PtrGrid ( )
inline

◆ PtrGrid() [4/4]

template<size_t ROWS, size_t COLS, class T >
PtrGrid< ROWS, COLS, T >::PtrGrid ( PtrGrid< ROWS, COLS, T > const &  )
delete

Member Function Documentation

◆ Alloc()

template<size_t ROWS, size_t COLS, class T >
void PtrGrid< ROWS, COLS, T >::Alloc ( size_t  n_rows,
size_t  n_cols,
size_t  n_entries 
)
inline

Allocate [n_entries] entries per pointer cell.

Here is the caller graph for this function:

◆ operator=()

template<size_t ROWS, size_t COLS, class T >
PtrGrid& PtrGrid< ROWS, COLS, T >::operator= ( PtrGrid< ROWS, COLS, T > const &  )
delete

◆ operator[]()

template<size_t ROWS, size_t COLS, class T >
std::array<T*, COLS>& PtrGrid< ROWS, COLS, T >::operator[] ( size_t  row_idx)
inline

◆ RandAllocCxFloat()

template<size_t ROWS, size_t COLS, class T >
void PtrGrid< ROWS, COLS, T >::RandAllocCxFloat ( size_t  n_entries)
inline

Allocate [n_entries] entries per pointer cell. Each entry is a random float between -1.0 and 1.0.

Here is the caller graph for this function:

Member Data Documentation

◆ backing_buf_

template<size_t ROWS, size_t COLS, class T >
T* PtrGrid< ROWS, COLS, T >::backing_buf_
private

The pointer cells.

The backing buffer for the per-cell arrays. Having a common buffer reduces the number of memory allocations.

◆ mat_

template<size_t ROWS, size_t COLS, class T >
std::array<std::array<T*, COLS>, ROWS> PtrGrid< ROWS, COLS, T >::mat_
private

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