#include <hashSet.h>
Public Types | |
typedef Key | ValueType |
typedef Key | KeyType |
typedef Key * | PointerType |
typedef Node * | IteratorPosition |
Type definitions | |
typedef ForwardIterator< HashSet< Key >, ValueType, PointerType, IteratorTraits > | Iterator |
typedef ConstForwardIterator< HashSet< Key >, ValueType, PointerType, IteratorTraits > | ConstIterator |
typedef Iterator | iterator |
typedef ConstIterator | const_iterator |
typedef Key | value_type |
typedef Key | key_type |
typedef Key * | pointer |
typedef const Key * | const_pointer |
typedef Key & | reference |
typedef const Key & | const_reference |
typedef Size | size_type |
typedef Index | difference_type |
Enums | |
enum | { INITIAL_CAPACITY = 4, INITIAL_NUMBER_OF_BUCKETS = 3 } |
Public Member Functions | |
Iterator | begin () throw () |
Iterator | end () throw () |
ConstIterator | begin () const throw () |
ConstIterator | end () const throw () |
Constructors and Destructors | |
HashSet (Size initial_capacity=INITIAL_CAPACITY, Size number_of_buckets=INITIAL_NUMBER_OF_BUCKETS) throw () | |
Default Constructor. | |
HashSet (const HashSet &hash_set) throw () | |
Copy Constructor. | |
virtual | ~HashSet () throw () |
Destructor. | |
virtual void | clear () throw () |
Clear the hash set. | |
void | destroy () throw () |
Clear the hash set. | |
Assignment | |
void | set (const HashSet &hash_set) throw () |
Assign this HashSet with the contents of another HashSet. | |
const HashSet & | operator= (const HashSet &rhs) throw () |
Assign this HashSet with the contents of another HashSet. | |
void | get (HashSet &hash_set) const throw () |
Assign another HashSet with the contents of this HashSet. | |
void | swap (HashSet &hash_set) throw () |
Swap the contents of two hash sets. | |
Accessors | |
Size | getBucketSize () const throw () |
Return the number of buckets. | |
Size | getCapacity () const throw () |
Return the capcacity of the hash set. | |
Size | getSize () const throw () |
Return the number of elements in the hash set. | |
Size | size () const throw () |
Return the number of elements in the hash set. | |
Iterator | find (const Key &key) throw () |
Find the element whose key is key . | |
ConstIterator | find (const Key &key) const throw () |
Find the element whose key is key . | |
std::pair< Iterator, bool > | insert (const ValueType &item) throw () |
Insert a new entry into the hash set. | |
Iterator | insert (Iterator pos, const ValueType &item) throw () |
Insert a new entry into the hash set. | |
Size | erase (const KeyType &key) throw () |
Erase element with key key . | |
void | erase (Iterator pos) throw (Exception::IncompatibleIterators, Exception::InvalidIterator) |
Erase element at a given position. | |
void | erase (Iterator f, Iterator l) throw (Exception::IncompatibleIterators) |
Erase a range of elements. | |
Operators | |
const HashSet & | operator &= (const HashSet &rhs) throw () |
Intersection operator. | |
const HashSet & | operator|= (const HashSet &rhs) throw () |
Union operator. | |
HashSet | operator & (const HashSet &rhs) const throw () |
Intersection operator. | |
HashSet | operator| (const HashSet &rhs) const throw () |
Union operator. | |
HashSet | operator+ (const HashSet &rhs) const throw () |
Union operator. | |
HashSet | operator- (const HashSet &rhs) const throw () |
Difference operator. | |
const HashSet & | operator+= (const HashSet &rhs) throw () |
Union operator. | |
const HashSet & | operator-= (const HashSet &rhs) throw () |
Difference operator. | |
Miscellaneous | |
virtual void | host (Visitor< HashSet< Key > > &visitor) throw () |
Host a visitor for all set entries. | |
Predicates | |
bool | has (const Key &key) const throw () |
Test whether the set contains the key key . | |
bool | isEmpty () const throw () |
Test whether the set is empty. | |
bool | operator== (const HashSet &hash_set) const throw () |
Compare two hash sets. | |
bool | operator!= (const HashSet &hash_set) const throw () |
Compare two hash sets. | |
Debugging and Diagnostics | |
bool | isValid () const throw () |
Return true if the hash set is consistent. | |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const throw () |
Dump the constent of this instance to an ostream. | |
Iteration | |
bool | apply (UnaryProcessor< ValueType > &processor) throw () |
Apply a processor to all keys in this instance. | |
Protected Member Functions | |
virtual Node * | newNode_ (const ValueType &value, Node *next) const throw () |
virtual void | deleteNode_ (Node *node) const throw () |
virtual HashIndex | hash (const Key &key) const throw () |
virtual bool | needRehashing_ () const throw () |
virtual void | rehash () throw () |
Friends | |
class | IteratorTraits |
|
|
|
Default Constructor.
|
|
Copy Constructor.
|
|
Destructor.
|
|
Apply a processor to all keys in this instance.
|
|
Clear the hash set. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged. |
|
Clear the hash set. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged. Simply calls clear; |
|
Dump the constent of this instance to an ostream.
|
|
Erase a range of elements.
Erase all elements in the range |
|
Erase element at a given position.
|
|
Erase element with key
|
|
Assign another HashSet with the contents of this HashSet.
|
|
Return the number of buckets.
|
|
Return the capcacity of the hash set.
|
|
Return the number of elements in the hash set.
|
|
Test whether the set contains the key
|
|
Host a visitor for all set entries.
|
|
Insert a new entry into the hash set.
For STL compatibility. The value of |
|
Insert a new entry into the hash set.
|
|
Test whether the set is empty.
|
|
Return true if the hash set is consistent. Condition: the number of entries in all buckets has to be equal the stored number of entries (getSize()). |
|
Intersection operator. Compute the intersection of the two hash sets. The left-hand set is not modified. |
|
Intersection operator.
Replace the contents of the current hash set by its intersection with |
|
Compare two hash sets.
|
|
Union operator.
|
|
Union operator.
|
|
Difference operator.
Computes the difference of the two sets, i.e. constructs a set containing the the elements of |
|
Difference operator.
Remove all elements contained in |
|
Assign this HashSet with the contents of another HashSet.
|
|
Compare two hash sets.
|
|
Union operator. Compute the union of the two hash sets. The left-hand set is not modified. |
|
Union operator.
Replace the contents of the current hash set by its union with |
|
Assign this HashSet with the contents of another HashSet.
|
|
Return the number of elements in the hash set.
|
|
Swap the contents of two hash sets.
|