Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide

RWTPtrHashSet<T,H,EQ,A>

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


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/tphset.h> 
RWTPtrHashSet<T,H,EQ,A>   s;

Description

This class maintains a pointer-based collection of values, which are stored according to a hash object of type H. Class T is the type pointed to by the items in the collection. H must provide a const hash function on elements of type T via public member

Objects 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, FALSE otherwise.

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

RWTPtrHashSet<T,H,EQ,A> will not accept an item that is equivalent to an item already in the collection. (RWTPtrHashMultiSet<T,H,EQ,A> may contain multiple items that are equivalent to each other.) Equality is based on the equality object and not on the == operator.

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

Persistence

Isomorphic

Example

Related Classes

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

Class rw_hashset<T*,rw_deref_hash<H,T>,rw_deref_compare<EQ,T>,A> is the C++-standard collection that serves as the underlying implementation for RWTPtrHashSet<T,H,EQ,A> .

Public Typedefs

typedef rw_deref_compare<EQ,T> container_eq;
typedef rw_deref_hash<H,T> container_hash; 
typedef rw_hashset<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 T* value_type; 
typedef T* const& reference; 
typedef T* const& const_reference; 

Public Constructors

RWTPtrHashSet<T,H,EQ,A>(size_type sz=1024,
     const H& h = H(),const EQ& eq = EQ());
RWTPtrHashSet<T,H,EQ,A>(const RWTPtrHashSet<T,H,EQ,A>& rws);
RWTPtrHashSet<T,H,EQ,A>  
  (const H& h,size_type sz = RWDEFAULT_CAPACITY);
RWTPtrHashSet<T,H,EQ,A>  
  (const rw_hashset<T*,container_hash,container_eq,A>& s);
RWTPtrHashSet<T,H,EQ,A>  (T*const* first,T*const* last,
   size_type sz=1024,const H& h = H(),const EQ& eq = EQ());

Public Member Operators

RWTPtrHashSet<T,H,EQ,A>  &
operator=(const RWTPtrHashSet<T,H,EQ,A>  & s); 
bool
operator==(const RWTPtrHashSet<T,H,EQ,A>  & s) const; 

Public Member Functions

void
apply(void (*fn)(const T*,void*), void* d) const; 
iterator
begin();
const_iterator
begin() const;
size_type
capacity() const; 
void
clear();
void
clearAndDestroy();
bool
contains(const T* a) const; 
bool
contains(bool (*fn)(const T*,void*), void* d) const;
void
difference(const RWTPtrHashSet<T,H,EQ,A>  & s); 
iterator
end();
const_iterator
end() const;
size_type
entries() const; 
float
fillRatio() const; 
const T*
find(const T* a) const; 
const T*
find(bool (*fn)(const T*,void*), void* d) const;
bool
insert(T* a); 
void
intersection(const RWTPtrHashSet<T,H,EQ,A>  & s); 
bool
isEmpty() const; 
bool
isEquivalent(const RWTPtrHashSet<T,H,EQ,A>  & s) const; 
bool
isProperSubsetOf(const RWTPtrHashSet<T,H,EQ,A>  & s) const; 
bool
isSubsetOf(const RWTPtrHashSet<T,H,EQ,A>  & s) const; 
size_type
occurrencesOf(const T* a) const; 
size_type
occurrencesOf(bool (*fn)(const T*,void*), void* d) const;
T*
remove(const T* a); 
T*
remove(bool (*fn)(const T*,void*), void* d);
size_type
removeAll(const T* a); 
size_type
removeAll(bool (*fn)(const T*,void*), void* d); 
void
resize(size_type sz); 
rw_hashset<T*,container_hash, container_eq,A>&
std();
const rw_hashset<T*,container_hash, container_eq,A>&
std() const;
void
symmetricDifference(const RWTPtrHashSet<T,H,EQ,A>  & s); 
void
Union(const RWTPtrHashSet<T,H,EQ,A>  & s); 

Related Global Operators

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


Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, 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.