SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_core::sc_strhash< C > Class Template Reference

#include <sysc/utils/sc_hash.h>

Inheritance diagram for sc_core::sc_strhash< C >:
Collaboration diagram for sc_core::sc_strhash< C >:

Public Types

typedef sc_strhash_iter< C > iterator
 
typedef unsigned(* hash_fn_t) (const void *)
 
typedef int(* cmpr_fn_t) (const void *, const void *)
 

Public Member Functions

 sc_strhash (C def=(C) 0, int size=PHASH_DEFAULT_INIT_TABLE_SIZE, int density=PHASH_DEFAULT_MAX_DENSITY, double grow=PHASH_DEFAULT_GROW_FACTOR, bool reorder=PHASH_DEFAULT_REORDER_FLAG, unsigned(*hash_fn)(const void *)=default_str_hash_fn, int(*cmpr_fn)(const void *, const void *)=sc_strhash_cmp)
 
 ~sc_strhash ()
 
void erase ()
 
void copy (const sc_strhash< C > *b)
 
void copy (const sc_strhash< C > &b)
 
int insert (char *k, C c)
 
int insert (char *k)
 
int insert_if_not_exists (char *k, C c)
 
int insert_if_not_exists (char *k)
 
int remove (const char *k)
 
int remove (const char *k, char **pk, C *pc)
 
int remove_by_contents (C c)
 
int remove_by_contents (bool(*predicate)(const void *, void *), void *arg)
 
int lookup (const char *k, C *pc) const
 
bool contains (const char *k) const
 
operator[] (const char *k) const
 
void set_cmpr_fn (cmpr_fn_t)
 
void set_hash_fn (hash_fn_t)
 
bool empty () const
 
unsigned count () const
 
void erase (void(*kfree)(void *))
 
void copy (const sc_phash_base *)
 
void copy (const sc_phash_base &b)
 
void copy (const sc_phash_base &b, void *(*kdup)(const void *), void(*kfree)(void *))
 
int insert (void *k, void *c)
 
int insert (void *k)
 
int insert (void *k, void *c, void *(*kdup)(const void *))
 
int insert_if_not_exists (void *k, void *c)
 
int insert_if_not_exists (void *k)
 
int insert_if_not_exists (void *k, void *c, void *(*kdup)(const void *))
 
int remove (const void *k)
 
int remove (const void *k, void **pk, void **pc)
 
int remove (const void *k, void(*kfree)(void *))
 
int remove_by_contents (const void *c)
 
int remove_by_contents (const void *c, void(*kfree)(void *))
 
int remove_by_contents (bool(*predicate)(const void *, void *), void *arg, void(*kfree)(void *))
 
int lookup (const void *k, void **pc) const
 
bool contains (const void *k) const
 
void * operator[] (const void *key) const
 

Protected Member Functions

void rehash ()
 
unsigned do_hash (const void *key) const
 
sc_phash_elem * add_direct (void *key, void *contents, unsigned hash_val)
 
sc_phash_elem * find_entry_c (unsigned hv, const void *k, sc_phash_elem ***plast)
 
sc_phash_elem * find_entry_q (unsigned hv, const void *k, sc_phash_elem ***plast)
 
sc_phash_elem * find_entry (unsigned hv, const void *k, sc_phash_elem ***plast=0) const
 

Protected Attributes

void * default_value
 
int num_bins
 
int num_entries
 
int max_density
 
int reorder_flag
 
double grow_factor
 
sc_phash_elem ** bins
 
hash_fn_t hash
 
cmpr_fn_t cmpr
 

Friends

class sc_strhash_iter< C >
 

Detailed Description

template<class C>
class sc_core::sc_strhash< C >

Definition at line 356 of file sc_hash.h.

Member Typedef Documentation

◆ cmpr_fn_t

typedef int(* sc_core::sc_phash_base::cmpr_fn_t) (const void *, const void *)
inherited

Definition at line 58 of file sc_hash.h.

◆ hash_fn_t

typedef unsigned(* sc_core::sc_phash_base::hash_fn_t) (const void *)
inherited

Definition at line 57 of file sc_hash.h.

◆ iterator

template<class C>
typedef sc_strhash_iter<C> sc_core::sc_strhash< C >::iterator

Definition at line 360 of file sc_hash.h.

Constructor & Destructor Documentation

◆ sc_strhash()

template<class C>
sc_core::sc_strhash< C >::sc_strhash ( def = (C) 0,
int  size = PHASH_DEFAULT_INIT_TABLE_SIZE,
int  density = PHASH_DEFAULT_MAX_DENSITY,
double  grow = PHASH_DEFAULT_GROW_FACTOR,
bool  reorder = PHASH_DEFAULT_REORDER_FLAG,
unsigned(*)(const void *)  hash_fn = default_str_hash_fn,
int(*)(const void *, const void *)  cmpr_fn = sc_strhash_cmp 
)
inline

Definition at line 362 of file sc_hash.h.

◆ ~sc_strhash()

template<class C>
sc_core::sc_strhash< C >::~sc_strhash ( )
inline

Definition at line 373 of file sc_hash.h.

Member Function Documentation

◆ add_direct()

sc_phash_elem* sc_core::sc_phash_base::add_direct ( void *  key,
void *  contents,
unsigned  hash_val 
)
protectedinherited

◆ contains() [1/2]

bool sc_core::sc_phash_base::contains ( const void *  k) const
inlineinherited

Definition at line 124 of file sc_hash.h.

◆ contains() [2/2]

template<class C>
bool sc_core::sc_strhash< C >::contains ( const char *  k) const
inline

Definition at line 409 of file sc_hash.h.

◆ copy() [1/5]

void sc_core::sc_phash_base::copy ( const sc_phash_base )
inherited

◆ copy() [2/5]

void sc_core::sc_phash_base::copy ( const sc_phash_base b)
inlineinherited

Definition at line 108 of file sc_hash.h.

◆ copy() [3/5]

void sc_core::sc_phash_base::copy ( const sc_phash_base b,
void *(*)(const void *)  kdup,
void(*)(void *)  kfree 
)
inherited

◆ copy() [4/5]

template<class C>
void sc_core::sc_strhash< C >::copy ( const sc_strhash< C > *  b)
inline

Definition at line 379 of file sc_hash.h.

◆ copy() [5/5]

template<class C>
void sc_core::sc_strhash< C >::copy ( const sc_strhash< C > &  b)
inline

Definition at line 380 of file sc_hash.h.

◆ count()

unsigned sc_core::sc_phash_base::count ( ) const
inlineinherited

Definition at line 103 of file sc_hash.h.

◆ do_hash()

unsigned sc_core::sc_phash_base::do_hash ( const void *  key) const
inlineprotectedinherited

Definition at line 74 of file sc_hash.h.

◆ empty()

bool sc_core::sc_phash_base::empty ( ) const
inlineinherited

Definition at line 102 of file sc_hash.h.

◆ erase() [1/2]

void sc_core::sc_phash_base::erase ( void(*)(void *)  kfree)
inherited

◆ erase() [2/2]

template<class C>
void sc_core::sc_strhash< C >::erase ( )
inline

Definition at line 378 of file sc_hash.h.

◆ find_entry()

sc_phash_elem* sc_core::sc_phash_base::find_entry ( unsigned  hv,
const void *  k,
sc_phash_elem ***  plast = 0 
) const
inlineprotectedinherited

Definition at line 79 of file sc_hash.h.

◆ find_entry_c()

sc_phash_elem* sc_core::sc_phash_base::find_entry_c ( unsigned  hv,
const void *  k,
sc_phash_elem ***  plast 
)
protectedinherited

◆ find_entry_q()

sc_phash_elem* sc_core::sc_phash_base::find_entry_q ( unsigned  hv,
const void *  k,
sc_phash_elem ***  plast 
)
protectedinherited

◆ insert() [1/5]

int sc_core::sc_phash_base::insert ( void *  k,
void *  c 
)
inherited

◆ insert() [2/5]

int sc_core::sc_phash_base::insert ( void *  k)
inlineinherited

Definition at line 111 of file sc_hash.h.

◆ insert() [3/5]

int sc_core::sc_phash_base::insert ( void *  k,
void *  c,
void *(*)(const void *)  kdup 
)
inherited

◆ insert() [4/5]

template<class C>
int sc_core::sc_strhash< C >::insert ( char *  k,
c 
)
inline

Definition at line 382 of file sc_hash.h.

◆ insert() [5/5]

template<class C>
int sc_core::sc_strhash< C >::insert ( char *  k)
inline

Definition at line 383 of file sc_hash.h.

◆ insert_if_not_exists() [1/5]

int sc_core::sc_phash_base::insert_if_not_exists ( void *  k,
void *  c 
)
inherited

◆ insert_if_not_exists() [2/5]

int sc_core::sc_phash_base::insert_if_not_exists ( void *  k)
inlineinherited

Definition at line 114 of file sc_hash.h.

◆ insert_if_not_exists() [3/5]

int sc_core::sc_phash_base::insert_if_not_exists ( void *  k,
void *  c,
void *(*)(const void *)  kdup 
)
inherited

◆ insert_if_not_exists() [4/5]

template<class C>
int sc_core::sc_strhash< C >::insert_if_not_exists ( char *  k,
c 
)
inline

Definition at line 384 of file sc_hash.h.

◆ insert_if_not_exists() [5/5]

template<class C>
int sc_core::sc_strhash< C >::insert_if_not_exists ( char *  k)
inline

Definition at line 388 of file sc_hash.h.

◆ lookup() [1/2]

int sc_core::sc_phash_base::lookup ( const void *  k,
void **  pc 
) const
inherited

◆ lookup() [2/2]

template<class C>
int sc_core::sc_strhash< C >::lookup ( const char *  k,
C *  pc 
) const
inline

Definition at line 405 of file sc_hash.h.

◆ operator[]() [1/2]

void* sc_core::sc_phash_base::operator[] ( const void *  key) const
inherited

◆ operator[]() [2/2]

template<class C>
C sc_core::sc_strhash< C >::operator[] ( const char *  k) const
inline

Definition at line 413 of file sc_hash.h.

◆ rehash()

void sc_core::sc_phash_base::rehash ( )
protectedinherited

◆ remove() [1/5]

int sc_core::sc_phash_base::remove ( const void *  k)
inherited

◆ remove() [2/5]

int sc_core::sc_phash_base::remove ( const void *  k,
void **  pk,
void **  pc 
)
inherited

◆ remove() [3/5]

int sc_core::sc_phash_base::remove ( const void *  k,
void(*)(void *)  kfree 
)
inherited

◆ remove() [4/5]

template<class C>
int sc_core::sc_strhash< C >::remove ( const char *  k)
inline

Definition at line 392 of file sc_hash.h.

◆ remove() [5/5]

template<class C>
int sc_core::sc_strhash< C >::remove ( const char *  k,
char **  pk,
C *  pc 
)
inline

Definition at line 393 of file sc_hash.h.

◆ remove_by_contents() [1/5]

int sc_core::sc_phash_base::remove_by_contents ( const void *  c)
inherited

◆ remove_by_contents() [2/5]

int sc_core::sc_phash_base::remove_by_contents ( const void *  c,
void(*)(void *)  kfree 
)
inherited

◆ remove_by_contents() [3/5]

int sc_core::sc_phash_base::remove_by_contents ( bool(*)(const void *, void *)  predicate,
void *  arg,
void(*)(void *)  kfree 
)
inherited

◆ remove_by_contents() [4/5]

template<class C>
int sc_core::sc_strhash< C >::remove_by_contents ( c)
inline

Definition at line 397 of file sc_hash.h.

◆ remove_by_contents() [5/5]

template<class C>
int sc_core::sc_strhash< C >::remove_by_contents ( bool(*)(const void *, void *)  predicate,
void *  arg 
)
inline

Definition at line 401 of file sc_hash.h.

◆ set_cmpr_fn()

void sc_core::sc_phash_base::set_cmpr_fn ( cmpr_fn_t  )
inherited

◆ set_hash_fn()

void sc_core::sc_phash_base::set_hash_fn ( hash_fn_t  )
inherited

Friends And Related Function Documentation

◆ sc_strhash_iter< C >

template<class C>
friend class sc_strhash_iter< C >
friend

Definition at line 357 of file sc_hash.h.

Member Data Documentation

◆ bins

sc_phash_elem** sc_core::sc_phash_base::bins
protectedinherited

Definition at line 68 of file sc_hash.h.

◆ cmpr

cmpr_fn_t sc_core::sc_phash_base::cmpr
protectedinherited

Definition at line 71 of file sc_hash.h.

◆ default_value

void* sc_core::sc_phash_base::default_value
protectedinherited

Definition at line 61 of file sc_hash.h.

◆ grow_factor

double sc_core::sc_phash_base::grow_factor
protectedinherited

Definition at line 66 of file sc_hash.h.

◆ hash

hash_fn_t sc_core::sc_phash_base::hash
protectedinherited

Definition at line 70 of file sc_hash.h.

◆ max_density

int sc_core::sc_phash_base::max_density
protectedinherited

Definition at line 64 of file sc_hash.h.

◆ num_bins

int sc_core::sc_phash_base::num_bins
protectedinherited

Definition at line 62 of file sc_hash.h.

◆ num_entries

int sc_core::sc_phash_base::num_entries
protectedinherited

Definition at line 63 of file sc_hash.h.

◆ reorder_flag

int sc_core::sc_phash_base::reorder_flag
protectedinherited

Definition at line 65 of file sc_hash.h.


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