scc 2025.09
SystemC components library
util::sparse_array_b< T > Class Template Reference

a sparse array suitable for large sizes More...

#include <sparse_array.h>

Public Types

using page_type = std::vector<T>

Public Member Functions

 sparse_array_b (uint64_t SIZE, unsigned PAGE_ADDR_BITS=24)
 ~sparse_array_b ()
T & operator[] (uint32_t addr)
page_type & operator() (uint32_t page_nr)
bool is_allocated (uint32_t addr)
uint64_t size ()

Public Attributes

const uint64_t mem_size
const uint64_t page_addr_mask
const uint64_t page_size
const unsigned page_count
const uint64_t page_addr_width

Protected Attributes

std::vector< page_type * > arr

Detailed Description

template<typename T>
class util::sparse_array_b< T >

a sparse array suitable for large sizes

a simple array which allocates memory in configurable chunks (size of 2^PAGE_ADDR_BITS), used for large sparse arrays. Memory is allocated on demand

Definition at line 37 of file sparse_array.h.

Member Typedef Documentation

◆ page_type

template<typename T>
using util::sparse_array_b< T >::page_type = std::vector<T>

Definition at line 49 of file sparse_array.h.

Constructor & Destructor Documentation

◆ sparse_array_b()

template<typename T>
util::sparse_array_b< T >::sparse_array_b ( uint64_t SIZE,
unsigned PAGE_ADDR_BITS = 24 )
inline

the default constructor

Definition at line 53 of file sparse_array.h.

◆ ~sparse_array_b()

template<typename T>
util::sparse_array_b< T >::~sparse_array_b ( )
inline

the destructor

Definition at line 66 of file sparse_array.h.

Member Function Documentation

◆ is_allocated()

template<typename T>
bool util::sparse_array_b< T >::is_allocated ( uint32_t addr)
inline

check if page for address is allocated

Parameters
addrthe address to check
Returns
true if the page is allocated

Definition at line 101 of file sparse_array.h.

◆ operator()()

template<typename T>
page_type & util::sparse_array_b< T >::operator() ( uint32_t page_nr)
inline

page fetch operator

Parameters
page_nrthe page number ot fetch
Returns
reference to page

Definition at line 89 of file sparse_array.h.

◆ operator[]()

template<typename T>
T & util::sparse_array_b< T >::operator[] ( uint32_t addr)
inline

element access operator

Parameters
addraddress to access
Returns
the data type reference

Definition at line 76 of file sparse_array.h.

◆ size()

template<typename T>
uint64_t util::sparse_array_b< T >::size ( )
inline

get the size of the array

Returns
the size

Definition at line 111 of file sparse_array.h.

Member Data Documentation

◆ arr

template<typename T>
std::vector<page_type*> util::sparse_array_b< T >::arr
protected

Definition at line 114 of file sparse_array.h.

◆ mem_size

template<typename T>
const uint64_t util::sparse_array_b< T >::mem_size

Definition at line 39 of file sparse_array.h.

◆ page_addr_mask

template<typename T>
const uint64_t util::sparse_array_b< T >::page_addr_mask

Definition at line 41 of file sparse_array.h.

◆ page_addr_width

template<typename T>
const uint64_t util::sparse_array_b< T >::page_addr_width

Definition at line 47 of file sparse_array.h.

◆ page_count

template<typename T>
const unsigned util::sparse_array_b< T >::page_count

Definition at line 45 of file sparse_array.h.

◆ page_size

template<typename T>
const uint64_t util::sparse_array_b< T >::page_size

Definition at line 43 of file sparse_array.h.


The documentation for this class was generated from the following file:
  • /home/eyck/Projects/MINRES/SystemC-Components/src/common/util/sparse_array.h