Skip to content

scram::core::CacheTable ​

A hash table without collision resolution. More...

#include <bdd.h>

Public Types ​

Name
using std::pair< int, int >key_type <br>Public typedefs similar to the standard maps.
using Vmapped_type
using std::pair< key_type, mapped_type >value_type
using std::vector< value_type >container_type
using typename container_type::iteratoriterator

Public Functions ​

Name
CacheTable(int init_capacity =1000)<br>Constructor with average expectations for computations.
intsize() const
voidclear()<br>Removes all entries from the table.
voidreserve(int n)<br>Prepares the table for more entries.
iteratorfind(const key_type & key)<br>Searches for existing entry.
iteratorend()
voidemplace(const key_type & key, const mapped_type & value)<br>Emplaces a new entry.

Detailed Description ​

cpp
template <class V >
class scram::core::CacheTable;

A hash table without collision resolution.

Template Parameters:

  • V The type of the value/result of BDD Apply. The type must provide swap(), reset(), and operator bool().

Note: The API is designed after STL maps as drop-in replacement for BDD. This approach allows performance testing with the baseline. However, only necessary and sufficient functions are provided.

Warning: The behavior is very different from standard maps. References can easily be invalidated upon rehashing or insertion.

Instead of resolving the collision, the existing value is purged and replaced by the new entry.

This hash table is designed to store computation results of BDD Apply. The implementation of the table is very much coupled with the BDD use cases.

Public Types Documentation ​

using key_type ​

cpp
using scram::core::CacheTable< V >::key_type =  std::pair<int, int>;

Public typedefs similar to the standard maps.

using mapped_type ​

cpp
using scram::core::CacheTable< V >::mapped_type =  V;

using value_type ​

cpp
using scram::core::CacheTable< V >::value_type =  std::pair<key_type, mapped_type>;

using container_type ​

cpp
using scram::core::CacheTable< V >::container_type =  std::vector<value_type>;

using iterator ​

cpp
using scram::core::CacheTable< V >::iterator =  typename container_type::iterator;

Public Functions Documentation ​

function CacheTable ​

cpp
inline explicit CacheTable(
    int init_capacity =1000
)

Constructor with average expectations for computations.

Parameters:

  • init_capacity

function size ​

cpp
inline int size() const

Return: The number of entires in the table.

function clear ​

cpp
inline void clear()

Removes all entries from the table.

function reserve ​

cpp
inline void reserve(
    int n
)

Prepares the table for more entries.

Parameters:

  • n The number of expected entries.

Postcondition: If n is 0 and the table is empty, the memory is freed as much as possible. Using after release of memory is undefined.

function find ​

cpp
inline iterator find(
    const key_type & key
)

Searches for existing entry.

Parameters:

  • key Ordered unique ids of BDD Apply argument vertices.

Return:

  • Iterator pointing to the found entry.
  • end() if no entry with the given key is found.

function end ​

cpp
inline iterator end()

Return: Iterator to the end.

function emplace ​

cpp
inline void emplace(
    const key_type & key,
    const mapped_type & value
)

Emplaces a new entry.

Parameters:

  • key Ordered unique ids of BDD Apply argument vertices.
  • value Non-empty result of BDD Apply computations.

Warning: API deviation from STL maps. This function does not return an iterator because it is not needed by computations in BDD.


Updated on 2025-12-19 at 21:56:46 +0000