Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTPtrHashMap<K,T,H,EQ,A>

Module:  Essential Tools Module   Group:  STL Extension-based Collection Classes


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/tphdict.h> 
RWTPtrHashMap<K,T,H,EQ,A> m;

Description

This class maintains a pointer-based collection of associations of type pair<K* const, T*>. These pairs are stored according to a hash object of type H. H must provide a const hash function on elements of type K via public member

Equivalent keys within the collection will be grouped together based on an equality object of type EQ. EQ must ensure this grouping via public member

which should return true if x and y are equivalent.

Note: Any two keys that are equivalent must hash to the same value.

RWTPtrHashMap<K,T,H,EQ,A> will not accept a key that is equivalent to any key already in the collection. (RWTPtrHashMultiMap<K,T,H,EQ,A> may contain multiple keys that are equivalent to each other.) Equality is based on the comparison object and not on the == operator.

The value type must have operator==() defined. This requirement is imposed by the C++ Standard Library.

Persistence

Isomorphic

Example

Program Output:

Related Classes

Class RWTPtrHashMultiMap<K,T,H,EQ,A> offers the same interface to a pointer-based collection that accepts multiple keys that compare equal to each other.

Classrw_hashmap<K*,T*,rw_deref_hash<H,K>,rw_deref_compare<C,K>,A> is the C++ Standard Library-style collection that serves as the underlying implementation for this collection.

Public Typedefs

typedef rw_deref_hash<H,K> container_hash;
typedef rw_deref_compare<EQ,K> container_eq; 
typedef rw_hashmap<K*,T*,container_hash,container_eq,A>
                   container_type; 
typedef container_type::size_type size_type; 
typedef container_type::difference_type difference_type; 
typedef container_type::iterator iterator; 
typedef container_type::const_iterator const_iterator; 
typedef pair <K* const, T*> value_type; 
typedef pair <K* const, T*>& reference; 
typedef const pair <K* const, T*>& const_reference; 
typedef K* value_type_key; 
typedef T* value_type_data; 
typedef K*& reference_key; 
typedef T*& reference_data; 
typedef const K*const& const_reference_key;
typedef const T*const& const_reference_data; 

Public Constructors

RWTPtrHashMap<K,T,H,EQ,A>();
RWTPtrHashMap<K,T,H,EQ,A>
  (const RWTPtrHashMap<K,T,H,EQ,A>& rwm);
RWTPtrHashMap<K,T,H,EQ,A>(const container_type & m);
RWTPtrHashMap<K,T,H,EQ,A>(const H& h, 
                          size_type sz = RW_DEFAULT_CAPACITY);
RWTPtrHashMap<K,T,H,EQ,A>(const value_type* first,
                          value_type* last);

Public Member Operators

RWTPtrHashMap<K,T,H,EQ,A>&
operator=(const container_type& m); 
RWTPtrHashMap<K,T,H,EQ,A>&
operator=(const RWTPtrHashMap<K,T,H,EQ,A>& m);
bool
operator==(const RWTPtrHashMap<K,T,H,EQ,A>& m) const; 
T*&
operator[](K* key); 

Public Member Functions

void
apply(void (*fn)(const K*, T*&,void*),void* d); 
void
apply(void (*fn)(const K*,const T*,void*),void* d) const;
void
applyToKeyAndValue(void (*fn)(const K*, T*&,void*),
                   void* d); 
void
applyToKeyAndValue
  (void (*fn)(const K*, const T*, void*), void* d) const;
iterator
begin();
const_iterator
begin() const;
size_type
capacity() const; 
void
clear();
void
clearAndDestroy();
bool
contains(const K* key) const; 
bool
contains(bool (*fn)(value_type,void*),void* d) const; 
iterator
end();
const_iterator
end() const;
size_type
entries() const; 
float
fillRatio() const; 
const K*
std::find(const K* key) const; 
value_type
find(bool (*fn)(value_type,void*), void* d) const;
T*
findValue(const K* key); 
const T*
findValue(const K* key) const;
const K*
findKeyAndValue(const K* key, T*& tr); 
const K*
findKeyAndValue(const K* key, const T*& tr) const;
bool
insert(K* key, T* a); 
bool
insertKeyAndValue(K* key,T* a); 
bool
isEmpty() const; 
const K*
minElement() const;
const K*
maxElement() const;
size_type
occurrencesOf(const K* key) const; 
size_type
occurrencesOf
(bool (*fn)(value_type,void*),void* d) const;
K*
remove(const K* key); 
K*
remove(bool (*fn)(value_type,void*), void* d);
size_type
removeAll(const K* key); 
size_type
removeAll(bool (*fn)(value_type,void*), void* d);
Key*
removeKeyAndValue(const KP* k VP*& retVal);
void
resize(size_type sz); 
rw_hashmap<K*,T*,rw_deref_hash<H,K>,deref_compare<EQ,K>,A>&
std();
const rw_hashmap<K*,T*,rw_deref_hash<H,K>,deref_compare<EQ,K>,A>&
std() const;

Related Global Operators

RWvostream&
operator<<(RWvostream& strm, 
           const RWTPtrHashMap<K,T,H,EQ,A>& coll);
RWFile&
operator<<(RWFile& strm, 
  const RWTPtrHashMap<K,T,H,EQ,A>& coll);
RWvistream&
operator>>(RWvistream& strm, RWTPtrHashMap<K,T,H,EQ,A>& coll); 
RWFile&
operator>>(RWFile& strm, RWTPtrHashMap<K,T,H,EQ,A>& coll);
RWvistream&
operator>>(RWvistream& strm, RWTPtrHashMap<K,T,H,EQ,A>*& p);
RWFile&
operator>>(RWFile& strm, RWTPtrHashMap<K,T,H,EQ,A>*& p);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.