#include <BALL/DATATYPE/hashSet.h>
List of all members.
Classes |
class | IllegalKey |
class | IteratorTraits |
struct | Node |
Public Types |
typedef Key | ValueType |
typedef Key | KeyType |
typedef Key * | PointerType |
typedef Node * | IteratorPosition |
|
|
enum | { INITIAL_CAPACITY = 4,
INITIAL_NUMBER_OF_BUCKETS = 3
} |
|
|
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 |
Public Member Functions |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
|
|
| HashSet (Size initial_capacity=INITIAL_CAPACITY, Size number_of_buckets=INITIAL_NUMBER_OF_BUCKETS) |
| HashSet (const HashSet &hash_set) |
virtual | ~HashSet () |
virtual void | clear () |
void | destroy () |
|
|
void | set (const HashSet &hash_set) |
const HashSet & | operator= (const HashSet &rhs) |
void | get (HashSet &hash_set) const |
void | swap (HashSet &hash_set) |
|
|
Size | getBucketSize () const |
Size | getCapacity () const |
Size | getSize () const |
Size | size () const |
Iterator | find (const Key &key) |
ConstIterator | find (const Key &key) const |
std::pair< Iterator, bool > | insert (const ValueType &item) |
Iterator | insert (Iterator pos, const ValueType &item) |
Size | erase (const KeyType &key) |
void | erase (Iterator pos) |
void | erase (Iterator f, Iterator l) |
|
|
const HashSet & | operator&= (const HashSet &rhs) |
const HashSet & | operator|= (const HashSet &rhs) |
HashSet | operator& (const HashSet &rhs) const |
HashSet | operator| (const HashSet &rhs) const |
HashSet | operator+ (const HashSet &rhs) const |
HashSet | operator- (const HashSet &rhs) const |
const HashSet & | operator+= (const HashSet &rhs) |
const HashSet & | operator-= (const HashSet &rhs) |
|
|
virtual void | host (Visitor< HashSet< Key > > &visitor) |
|
|
bool | has (const Key &key) const |
bool | isEmpty () const |
bool | operator== (const HashSet &hash_set) const |
bool | operator!= (const HashSet &hash_set) const |
|
|
bool | isValid () const |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
|
|
bool | apply (UnaryProcessor< ValueType > &processor) |
Protected Member Functions |
virtual Node * | newNode_ (const ValueType &value, Node *next) const |
virtual void | deleteNode_ (Node *node) const |
virtual HashIndex | hash (const Key &key) const |
virtual bool | needRehashing_ () const |
virtual void | rehash () |
Private Member Functions |
void | deleteBuckets_ () |
Position | hashBucket_ (const Key &key) const |
void | rehash_ () |
Private Attributes |
Size | size_ |
Size | capacity_ |
vector< Node * > | bucket_ |
Friends |
class | IteratorTraits |
Detailed Description
template<class Key>
class BALL::HashSet< Key >
Generic Hash Set Class.
Definition at line 45 of file hashSet.h.
Member Typedef Documentation
Member Enumeration Documentation
- Enumerator:
INITIAL_CAPACITY |
Initial capacity of the hash set.
|
INITIAL_NUMBER_OF_BUCKETS |
Initial number of buckets.
|
Definition at line 245 of file hashSet.h.
Constructor & Destructor Documentation
Default Constructor.
Definition at line 600 of file hashSet.h.
Member Function Documentation
Apply a processor to all keys in this instance.
- Returns:
- true if the processor could be applied.
Definition at line 1217 of file hashSet.h.
Clear the hash set. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged.
Definition at line 660 of file hashSet.h.
template<class Key>
virtual void BALL::HashSet< Key >::deleteNode_ |
( |
Node * |
node |
) |
const [protected, virtual] |
Clear the hash set. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged. Simply calls clear;
Definition at line 681 of file hashSet.h.
template<class Key >
void BALL::HashSet< Key >::dump |
( |
std::ostream & |
s = std::cout , |
|
|
Size |
depth = 0 | |
|
) |
| | const [inline, virtual] |
Dump the constent of this instance to an ostream.
Definition at line 1184 of file hashSet.h.
Erase a range of elements. Erase all elements in the range f - l
.
- Exceptions:
-
Definition at line 999 of file hashSet.h.
Erase element at a given position.
- Parameters:
-
| pos | an iterator pointing to the element to delete |
- Exceptions:
-
Definition at line 960 of file hashSet.h.
Erase element with key key
.
- Returns:
- Size the number of elements erased (0 or 1)
Definition at line 927 of file hashSet.h.
Find the element whose key is key
.
Definition at line 889 of file hashSet.h.
Find the element whose key is key
.
Definition at line 868 of file hashSet.h.
Return the number of buckets.
Definition at line 841 of file hashSet.h.
Return the capcacity of the hash set.
Definition at line 848 of file hashSet.h.
Return the number of elements in the hash set.
Definition at line 855 of file hashSet.h.
Test whether the set contains the key key
.
Definition at line 1120 of file hashSet.h.
Host a visitor for all set entries.
Definition at line 1113 of file hashSet.h.
Insert a new entry into the hash set. For STL compatibility. The value of pos
is ignored.
Insert a new entry into the hash set.
Definition at line 896 of file hashSet.h.
Test whether the set is empty.
Definition at line 1127 of file hashSet.h.
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()).
Definition at line 1162 of file hashSet.h.
template<class Key >
BALL_INLINE bool BALL::HashSet< Key >::needRehashing_ |
( |
|
) |
const [inline, protected, virtual] |
Compare two hash sets.
Definition at line 1156 of file hashSet.h.
Intersection operator. Compute the intersection of the two hash sets. The left-hand set is not modified.
Definition at line 759 of file hashSet.h.
Intersection operator. Replace the contents of the current hash set by its intersection with rhs
.
Definition at line 713 of file hashSet.h.
Union operator.
- See also:
- operator|
Definition at line 834 of file hashSet.h.
Union operator.
- See also:
- operator|=
Definition at line 752 of file hashSet.h.
Difference operator. Computes the difference of the two sets, i.e. constructs a set containing the the elements of this
set that are not contained in rhs
.
Definition at line 779 of file hashSet.h.
Difference operator. Remove all elements contained in rhs
from the set.
Definition at line 799 of file hashSet.h.
Compare two hash sets.
Definition at line 1133 of file hashSet.h.
Union operator. Compute the union of the two hash sets. The left-hand set is not modified.
Definition at line 824 of file hashSet.h.
Union operator. Replace the contents of the current hash set by its union with rhs
.
Definition at line 738 of file hashSet.h.
template<class Key >
BALL_INLINE void BALL::HashSet< Key >::rehash |
( |
|
) |
[inline, protected, virtual] |
Return the number of elements in the hash set.
Definition at line 862 of file hashSet.h.
Swap the contents of two hash sets.
Definition at line 704 of file hashSet.h.
Friends And Related Function Documentation
Member Data Documentation