Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
dsac::map::AbstractHashMap< Key, Value, Hash > Class Template Referenceabstract

#include <abstract_hash_map.h>

Inheritance diagram for dsac::map::AbstractHashMap< Key, Value, Hash >:
Inheritance graph
Collaboration diagram for dsac::map::AbstractHashMap< Key, Value, Hash >:
Collaboration graph

Public Member Functions

int size () const
 Returns the number of entries in the map.
 
const_iterator find (const Key &k) const
 Returns a const_iterator to the entry with a given key, or end() if no such entry exists.
 
const_iterator erase (const_iterator loc)
 Removes the entry indicated by the given iterator, and returns iterator to next entry in iteration order.
 
const_iterator put (const Key &k, const Value &v)
 
virtual const_iterator begin () const=0
 
virtual const_iterator end () const=0
 
- Public Member Functions inherited from dsac::map::AbstractMap< Key, Value >
bool empty () const
 Returns true if the map is empty, false otherwise.
 
bool contains (const Key &k) const
 Returns true if the map contains an entry with the given key.
 
const Value & at (const Key &k) const
 
bool erase (const Key &k)
 
virtual ~AbstractMap ()
 
virtual int size () const =0
 
virtual const_iterator begin () const =0
 
virtual const_iterator end () const =0
 
virtual const_iterator find (const Key &k) const =0
 
virtual const_iterator put (const Key &k, const Value &v)=0
 
virtual const_iterator erase (const_iterator loc)=0
 

Protected Types

typedef AbstractMap< Key, Value > Base
 

Protected Member Functions

int get_hash (const Key &k) const
 
void resize (int new_table_size)
 
virtual void create_table ()=0
 
virtual const_iterator bucket_find (int h, const Key &k) const =0
 
virtual const_iterator bucket_put (int h, const Key &k, const Value &v)=0
 
virtual const_iterator bucket_erase (int h, const_iterator loc)=0
 
- Protected Member Functions inherited from dsac::map::AbstractMap< Key, Value >
abstract_iter_repget_rep (const_iterator iter) const
 
void update_value (const Entry &e, const Value &v)
 

Protected Attributes

Hash hash
 
int sz {0}
 
int table_sz {17}
 

Member Typedef Documentation

◆ Base

template<typename Key , typename Value , typename Hash >
typedef AbstractMap<Key,Value> dsac::map::AbstractHashMap< Key, Value, Hash >::Base
protected

Member Function Documentation

◆ begin()

template<typename Key , typename Value , typename Hash >
virtual const_iterator dsac::map::AbstractMap< Key, Value >::begin ( ) const
virtual

◆ bucket_erase()

template<typename Key , typename Value , typename Hash >
virtual const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::bucket_erase ( int  h,
const_iterator  loc 
)
protectedpure virtual

◆ bucket_find()

template<typename Key , typename Value , typename Hash >
virtual const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::bucket_find ( int  h,
const Key &  k 
) const
protectedpure virtual

◆ bucket_put()

template<typename Key , typename Value , typename Hash >
virtual const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::bucket_put ( int  h,
const Key &  k,
const Value &  v 
)
protectedpure virtual

◆ create_table()

template<typename Key , typename Value , typename Hash >
virtual void dsac::map::AbstractHashMap< Key, Value, Hash >::create_table ( )
protectedpure virtual

◆ end()

template<typename Key , typename Value , typename Hash >
virtual const_iterator dsac::map::AbstractMap< Key, Value >::end ( ) const
virtual

◆ erase()

template<typename Key , typename Value , typename Hash >
const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::erase ( const_iterator  loc)
inlinevirtual

Removes the entry indicated by the given iterator, and returns iterator to next entry in iteration order.

Implements dsac::map::AbstractMap< Key, Value >.

Here is the call graph for this function:

◆ find()

template<typename Key , typename Value , typename Hash >
const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::find ( const Key &  k) const
inlinevirtual

Returns a const_iterator to the entry with a given key, or end() if no such entry exists.

Implements dsac::map::AbstractMap< Key, Value >.

Here is the call graph for this function:

◆ get_hash()

template<typename Key , typename Value , typename Hash >
int dsac::map::AbstractHashMap< Key, Value, Hash >::get_hash ( const Key &  k) const
inlineprotected

◆ put()

template<typename Key , typename Value , typename Hash >
const_iterator dsac::map::AbstractHashMap< Key, Value, Hash >::put ( const Key &  k,
const Value &  v 
)
inlinevirtual

Associates given key with given value. If key already exists previous value is overwritten. Returns an iterator to the entry associated with the key

Implements dsac::map::AbstractMap< Key, Value >.

Here is the call graph for this function:

◆ resize()

template<typename Key , typename Value , typename Hash >
void dsac::map::AbstractHashMap< Key, Value, Hash >::resize ( int  new_table_size)
inlineprotected
Here is the call graph for this function:

◆ size()

template<typename Key , typename Value , typename Hash >
int dsac::map::AbstractHashMap< Key, Value, Hash >::size ( ) const
inlinevirtual

Returns the number of entries in the map.

Implements dsac::map::AbstractMap< Key, Value >.

Field Documentation

◆ hash

template<typename Key , typename Value , typename Hash >
Hash dsac::map::AbstractHashMap< Key, Value, Hash >::hash
protected

◆ sz

template<typename Key , typename Value , typename Hash >
int dsac::map::AbstractHashMap< Key, Value, Hash >::sz {0}
protected

◆ table_sz

template<typename Key , typename Value , typename Hash >
int dsac::map::AbstractHashMap< Key, Value, Hash >::table_sz {17}
protected

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