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

range based lookup table More...

#include <range_lut.h>

Classes

struct  lut_entry
 the lut entry More...

Public Types

enum  entry_type { BEGIN_RANGE = 1 , END_RANGE = 2 , SINGLE_BYTE_RANGE = 3 }
 the type of lut entry More...
using const_iterator = typename std::map<uint64_t, lut_entry>::const_iterator

Public Member Functions

 range_lut (T const &null_entry)
void addEntry (T const &i, uint64_t base_addr, uint64_t size)
bool removeEntry (T i)
size_t size () const
void clear ()
getEntry (uint64_t addr) const
void validate () const
std::string toString () const
const_iterator begin () const
const_iterator end () const
const_iterator lower_bound (uint64_t base) const

Public Attributes

const T null_entry
 the null entry

Protected Attributes

std::map< uint64_t, lut_entrym_lut {}
size_t m_size {0}

Detailed Description

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

range based lookup table

Definition at line 37 of file range_lut.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
using util::range_lut< T >::const_iterator = typename std::map<uint64_t, lut_entry>::const_iterator

Definition at line 109 of file range_lut.h.

Member Enumeration Documentation

◆ entry_type

template<typename T>
enum util::range_lut::entry_type

the type of lut entry

Definition at line 40 of file range_lut.h.

Constructor & Destructor Documentation

◆ range_lut()

template<typename T>
util::range_lut< T >::range_lut ( T const & null_entry)
inline

constructor or the lookup table

Parameters
null_entrythe entry to be used for empty slots

Definition at line 52 of file range_lut.h.

Member Function Documentation

◆ addEntry()

template<typename T>
void util::range_lut< T >::addEntry ( T const & i,
uint64_t base_addr,
uint64_t size )
inline

add an T to the lut covering the range starting at base_addr until base_addr+size-1

Parameters
ithe entry
base_addrthe base address
sizethe size of the occupied range

Definition at line 135 of file range_lut.h.

◆ begin()

template<typename T>
const_iterator util::range_lut< T >::begin ( ) const
inline

Definition at line 111 of file range_lut.h.

◆ clear()

template<typename T>
void util::range_lut< T >::clear ( )
inline

remove all entries from the lut

Definition at line 79 of file range_lut.h.

◆ end()

template<typename T>
const_iterator util::range_lut< T >::end ( ) const
inline

Definition at line 113 of file range_lut.h.

◆ getEntry()

template<typename T>
T util::range_lut< T >::getEntry ( uint64_t addr) const
inline

get the entry T associated with a given address

Parameters
addrthe address
Returns
the entry belonging to the address

Definition at line 89 of file range_lut.h.

◆ lower_bound()

template<typename T>
const_iterator util::range_lut< T >::lower_bound ( uint64_t base) const
inline

Definition at line 115 of file range_lut.h.

◆ removeEntry()

template<typename T>
bool util::range_lut< T >::removeEntry ( T i)
inline

remove an entry with value i of type T

Parameters
ithe entry to be found
Returns
true if the entry is found and removed, false otherwise

Definition at line 150 of file range_lut.h.

◆ size()

template<typename T>
size_t util::range_lut< T >::size ( ) const
inline

get number of entries in the lookup table

Returns
the size of the underlying container

Definition at line 75 of file range_lut.h.

◆ toString()

template<typename T>
std::string util::range_lut< T >::toString ( ) const
inline

create a textual representation of the address map (address range->entry association)

Returns

Definition at line 196 of file range_lut.h.

◆ validate()

template<typename T>
void util::range_lut< T >::validate ( ) const
inline

validate the lookup table wrt. overlaps

Definition at line 169 of file range_lut.h.

Member Data Documentation

◆ m_lut

template<typename T>
std::map<uint64_t, lut_entry> util::range_lut< T >::m_lut {}
protected

Definition at line 119 of file range_lut.h.

◆ m_size

template<typename T>
size_t util::range_lut< T >::m_size {0}
protected

Definition at line 120 of file range_lut.h.

◆ null_entry

template<typename T>
const T util::range_lut< T >::null_entry

the null entry

Definition at line 107 of file range_lut.h.


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