BALL
1.4.2
|
#include <BALL/DATATYPE/hashSet.h>
Classes | |
class | IllegalKey |
class | IteratorTraits |
struct | Node |
Public Types | |
typedef Key | ValueType |
typedef Key | KeyType |
typedef Key * | PointerType |
typedef Node * | IteratorPosition |
Enums | |
enum | { INITIAL_CAPACITY = 4, INITIAL_NUMBER_OF_BUCKETS = 3 } |
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 |
Public Member Functions | |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
Constructors and Destructors | |
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 () |
Assignment | |
void | set (const HashSet &hash_set) |
const HashSet & | operator= (const HashSet &rhs) |
void | get (HashSet &hash_set) const |
void | swap (HashSet &hash_set) |
Accessors | |
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) |
Operators | |
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) |
Miscellaneous | |
virtual void | host (Visitor< HashSet< Key > > &visitor) |
Predicates | |
bool | has (const Key &key) const |
bool | isEmpty () const |
bool | operator== (const HashSet &hash_set) const |
bool | operator!= (const HashSet &hash_set) const |
Debugging and Diagnostics | |
bool | isValid () const |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Iteration | |
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 |
Generic Hash Set Class.
typedef ConstIterator BALL::HashSet< Key >::const_iterator |
typedef const Key* BALL::HashSet< Key >::const_pointer |
typedef const Key& BALL::HashSet< Key >::const_reference |
typedef ConstForwardIterator<HashSet<Key>, ValueType, PointerType, IteratorTraits> BALL::HashSet< Key >::ConstIterator |
typedef Index BALL::HashSet< Key >::difference_type |
typedef ForwardIterator<HashSet<Key>, ValueType, PointerType, IteratorTraits> BALL::HashSet< Key >::Iterator |
typedef Iterator BALL::HashSet< Key >::iterator |
typedef Node* BALL::HashSet< Key >::IteratorPosition |
typedef Key BALL::HashSet< Key >::key_type |
typedef Key BALL::HashSet< Key >::KeyType |
typedef Key* BALL::HashSet< Key >::pointer |
typedef Key* BALL::HashSet< Key >::PointerType |
typedef Key& BALL::HashSet< Key >::reference |
typedef Size BALL::HashSet< Key >::size_type |
typedef Key BALL::HashSet< Key >::value_type |
typedef Key BALL::HashSet< Key >::ValueType |
anonymous enum |
BALL::HashSet< Key >::HashSet | ( | Size | initial_capacity = INITIAL_CAPACITY , |
Size | number_of_buckets = INITIAL_NUMBER_OF_BUCKETS |
||
) |
BALL::HashSet< Key >::HashSet | ( | const HashSet< Key > & | hash_set | ) |
|
inlinevirtual |
bool BALL::HashSet< Key >::apply | ( | UnaryProcessor< ValueType > & | processor | ) |
|
inline |
|
inline |
|
virtual |
|
private |
|
protectedvirtual |
BALL_INLINE void BALL::HashSet< Key >::destroy | ( | ) |
|
virtual |
|
inline |
|
inline |
Size BALL::HashSet< Key >::erase | ( | const KeyType & | key | ) |
void BALL::HashSet< Key >::erase | ( | Iterator | pos | ) |
Erase element at a given position.
pos | an iterator pointing to the element to delete |
Exception::IncompatibleIterators | does not point into this HashSet |
Exception::InvalidIterator | if pos is invalid |
void BALL::HashSet< Key >::erase | ( | Iterator | f, |
Iterator | l | ||
) |
Erase a range of elements. Erase all elements in the range f - l
.
Exception::IncompatibleIterators | if one of the arguments does not point into this HashSet |
HashSet< Key >::Iterator BALL::HashSet< Key >::find | ( | const Key & | key | ) |
BALL_INLINE HashSet< Key >::ConstIterator BALL::HashSet< Key >::find | ( | const Key & | key | ) | const |
BALL_INLINE void BALL::HashSet< Key >::get | ( | HashSet< Key > & | hash_set | ) | const |
BALL_INLINE Size BALL::HashSet< Key >::getBucketSize | ( | ) | const |
BALL_INLINE Size BALL::HashSet< Key >::getCapacity | ( | ) | const |
BALL_INLINE Size BALL::HashSet< Key >::getSize | ( | ) | const |
BALL_INLINE bool BALL::HashSet< Key >::has | ( | const Key & | key | ) | const |
|
protectedvirtual |
|
private |
|
virtual |
std::pair< typename HashSet< Key >::Iterator, bool > BALL::HashSet< Key >::insert | ( | const ValueType & | item | ) |
Iterator BALL::HashSet< Key >::insert | ( | Iterator | pos, |
const ValueType & | item | ||
) |
Insert a new entry into the hash set. For STL compatibility. The value of pos
is ignored.
BALL_INLINE bool BALL::HashSet< Key >::isEmpty | ( | ) | const |
bool BALL::HashSet< Key >::isValid | ( | ) | const |
|
protectedvirtual |
|
protectedvirtual |
BALL_INLINE bool BALL::HashSet< Key >::operator!= | ( | const HashSet< Key > & | hash_set | ) | const |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator& | ( | const HashSet< Key > & | rhs | ) | const |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator&= | ( | const HashSet< Key > & | rhs | ) |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator+ | ( | const HashSet< Key > & | rhs | ) | const |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator+= | ( | const HashSet< Key > & | rhs | ) |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator- | ( | const HashSet< Key > & | rhs | ) | const |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator-= | ( | const HashSet< Key > & | rhs | ) |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator= | ( | const HashSet< Key > & | rhs | ) |
bool BALL::HashSet< Key >::operator== | ( | const HashSet< Key > & | hash_set | ) | const |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator| | ( | const HashSet< Key > & | rhs | ) | const |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator|= | ( | const HashSet< Key > & | rhs | ) |
|
protectedvirtual |
|
private |
void BALL::HashSet< Key >::set | ( | const HashSet< Key > & | hash_set | ) |
BALL_INLINE Size BALL::HashSet< Key >::size | ( | ) | const |
BALL_INLINE void BALL::HashSet< Key >::swap | ( | HashSet< Key > & | hash_set | ) |
|
friend |
|
private |
|
private |
|
private |