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

#include <ordered_table_map.h>

Inheritance diagram for dsac::map::OrderedTableMap< Key, Value, Compare >:
Inheritance graph
Collaboration diagram for dsac::map::OrderedTableMap< Key, Value, Compare >:
Collaboration graph

Data Structures

class  iter_rep
 

Public Member Functions

 OrderedTableMap ()
 Creates an empty map.
 
int size () const
 Returns the number of entries in the map.
 
const_iterator begin () const
 Returns a const_iterator to first entry.
 
const_iterator end () const
 Returns a const_iterator representing the end.
 
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 put (const Key &k, const Value &v)
 
const_iterator erase (const_iterator loc)
 Removes the entry indicated by the given iterator, and returns const_iterator to next entry in iteration order.
 
const_iterator lower_bound (const Key &k) const
 Returns a const_iterator to the first entry with key greater than or equal to k, or end() if no such entry exists.
 
const_iterator upper_bound (const Key &k) const
 Returns a const_iterator to the first entry with key strictly greater than k, or end() if no such entry exists.
 
bool erase (const Key &k)
 
virtual const_iterator erase (const_iterator loc)=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 lower_bound_index (const Key &target) const
 
abstract_iter_repget_rep (const_iterator iter) const
 
- 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

std::vector< Entrytable
 
Compare less_than
 

Member Typedef Documentation

◆ Base

template<typename Key , typename Value , typename Compare = std::less<Key>>
typedef AbstractMap<Key,Value> dsac::map::OrderedTableMap< Key, Value, Compare >::Base
protected

Constructor & Destructor Documentation

◆ OrderedTableMap()

template<typename Key , typename Value , typename Compare = std::less<Key>>
dsac::map::OrderedTableMap< Key, Value, Compare >::OrderedTableMap ( )
inline

Creates an empty map.

Member Function Documentation

◆ begin()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::begin ( ) const
inlinevirtual

Returns a const_iterator to first entry.

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

◆ end()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::end ( ) const
inlinevirtual

Returns a const_iterator representing the end.

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

◆ erase() [1/3]

template<typename Key , typename Value , typename Compare = std::less<Key>>
bool dsac::map::AbstractMap< Key, Value >::erase ( const Key &  k)
inline

Erases entry with given key (if one exists) Returns true if an entry was removed, false otherwise

◆ erase() [2/3]

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::erase ( const_iterator  loc)
inlinevirtual

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

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

Here is the call graph for this function:

◆ erase() [3/3]

template<typename Key , typename Value , typename Compare = std::less<Key>>
virtual const_iterator dsac::map::AbstractMap< Key, Value >::erase ( const_iterator  loc)
virtual

◆ find()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::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_rep()

template<typename Key , typename Value , typename Compare = std::less<Key>>
abstract_iter_rep * dsac::map::AbstractMap< Key, Value >::get_rep ( const_iterator  iter) const
inlineprotected

◆ lower_bound()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::lower_bound ( const Key &  k) const
inline

Returns a const_iterator to the first entry with key greater than or equal to k, or end() if no such entry exists.

Here is the call graph for this function:

◆ lower_bound_index()

template<typename Key , typename Value , typename Compare = std::less<Key>>
int dsac::map::OrderedTableMap< Key, Value, Compare >::lower_bound_index ( const Key &  target) const
inlineprotected

◆ put()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::put ( const Key &  k,
const Value &  v 
)
inlinevirtual

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

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

Here is the call graph for this function:

◆ size()

template<typename Key , typename Value , typename Compare = std::less<Key>>
int dsac::map::OrderedTableMap< Key, Value, Compare >::size ( ) const
inlinevirtual

Returns the number of entries in the map.

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

◆ upper_bound()

template<typename Key , typename Value , typename Compare = std::less<Key>>
const_iterator dsac::map::OrderedTableMap< Key, Value, Compare >::upper_bound ( const Key &  k) const
inline

Returns a const_iterator to the first entry with key strictly greater than k, or end() if no such entry exists.

Here is the call graph for this function:

Field Documentation

◆ less_than

template<typename Key , typename Value , typename Compare = std::less<Key>>
Compare dsac::map::OrderedTableMap< Key, Value, Compare >::less_than
protected

◆ table

template<typename Key , typename Value , typename Compare = std::less<Key>>
std::vector<Entry> dsac::map::OrderedTableMap< Key, Value, Compare >::table
protected

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