#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) throw (Exception::IncompatibleIterators, Exception::InvalidIterator) |
void | erase (Iterator f, Iterator l) throw (Exception::IncompatibleIterators) |
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.
Definition at line 45 of file hashSet.h.
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 Iterator BALL::HashSet< Key >::iterator |
typedef ForwardIterator<HashSet<Key>, ValueType, PointerType, IteratorTraits> 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 | |||
) | [inline] |
BALL::HashSet< Key >::HashSet | ( | const HashSet< Key > & | hash_set | ) | [inline] |
virtual BALL::HashSet< Key >::~HashSet | ( | ) | [inline, virtual] |
bool BALL::HashSet< Key >::apply | ( | UnaryProcessor< ValueType > & | processor | ) | [inline] |
ConstIterator BALL::HashSet< Key >::begin | ( | ) | const [inline] |
Iterator BALL::HashSet< Key >::begin | ( | ) | [inline] |
void BALL::HashSet< Key >::clear | ( | ) | [inline, virtual] |
void BALL::HashSet< Key >::deleteBuckets_ | ( | ) | [inline, private] |
virtual void BALL::HashSet< Key >::deleteNode_ | ( | Node * | node | ) | const [protected, virtual] |
BALL_INLINE void BALL::HashSet< Key >::destroy | ( | ) | [inline] |
void BALL::HashSet< Key >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline, virtual] |
ConstIterator BALL::HashSet< Key >::end | ( | ) | const [inline] |
Iterator BALL::HashSet< Key >::end | ( | ) | [inline] |
void BALL::HashSet< Key >::erase | ( | Iterator | f, | |
Iterator | l | |||
) | throw (Exception::IncompatibleIterators) [inline] |
void BALL::HashSet< Key >::erase | ( | Iterator | pos | ) | throw (Exception::IncompatibleIterators, Exception::InvalidIterator) [inline] |
Size BALL::HashSet< Key >::erase | ( | const KeyType & | key | ) | [inline] |
BALL_INLINE HashSet< Key >::ConstIterator BALL::HashSet< Key >::find | ( | const Key & | key | ) | const [inline] |
HashSet< Key >::Iterator BALL::HashSet< Key >::find | ( | const Key & | key | ) | [inline] |
BALL_INLINE void BALL::HashSet< Key >::get | ( | HashSet< Key > & | hash_set | ) | const [inline] |
BALL_INLINE Size BALL::HashSet< Key >::getBucketSize | ( | ) | const [inline] |
BALL_INLINE Size BALL::HashSet< Key >::getCapacity | ( | ) | const [inline] |
BALL_INLINE Size BALL::HashSet< Key >::getSize | ( | ) | const [inline] |
BALL_INLINE bool BALL::HashSet< Key >::has | ( | const Key & | key | ) | const [inline] |
BALL_INLINE HashIndex BALL::HashSet< Key >::hash | ( | const Key & | key | ) | const [inline, protected, virtual] |
BALL_INLINE HashIndex BALL::HashSet< Key >::hashBucket_ | ( | const Key & | key | ) | const [inline, private] |
BALL_INLINE void BALL::HashSet< Key >::host | ( | Visitor< HashSet< Key > > & | visitor | ) | [inline, virtual] |
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.
std::pair< typename HashSet< Key >::Iterator, bool > BALL::HashSet< Key >::insert | ( | const ValueType & | item | ) | [inline] |
BALL_INLINE bool BALL::HashSet< Key >::isEmpty | ( | ) | const [inline] |
bool BALL::HashSet< Key >::isValid | ( | ) | const [inline] |
BALL_INLINE bool BALL::HashSet< Key >::needRehashing_ | ( | ) | const [inline, protected, virtual] |
virtual Node* BALL::HashSet< Key >::newNode_ | ( | const ValueType & | value, | |
Node * | next | |||
) | const [protected, virtual] |
BALL_INLINE bool BALL::HashSet< Key >::operator!= | ( | const HashSet< Key > & | hash_set | ) | const [inline] |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator& | ( | const HashSet< Key > & | rhs | ) | const [inline] |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator&= | ( | const HashSet< Key > & | rhs | ) | [inline] |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator+ | ( | const HashSet< Key > & | rhs | ) | const [inline] |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator+= | ( | const HashSet< Key > & | rhs | ) | [inline] |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator- | ( | const HashSet< Key > & | rhs | ) | const [inline] |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator-= | ( | const HashSet< Key > & | rhs | ) | [inline] |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator= | ( | const HashSet< Key > & | rhs | ) | [inline] |
bool BALL::HashSet< Key >::operator== | ( | const HashSet< Key > & | hash_set | ) | const [inline] |
BALL_INLINE HashSet< Key > BALL::HashSet< Key >::operator| | ( | const HashSet< Key > & | rhs | ) | const [inline] |
BALL_INLINE const HashSet< Key > & BALL::HashSet< Key >::operator|= | ( | const HashSet< Key > & | rhs | ) | [inline] |
BALL_INLINE void BALL::HashSet< Key >::rehash | ( | ) | [inline, protected, virtual] |
void BALL::HashSet< Key >::rehash_ | ( | ) | [inline, private] |
void BALL::HashSet< Key >::set | ( | const HashSet< Key > & | hash_set | ) | [inline] |
BALL_INLINE Size BALL::HashSet< Key >::size | ( | ) | const [inline] |
BALL_INLINE void BALL::HashSet< Key >::swap | ( | HashSet< Key > & | hash_set | ) | [inline] |
friend class IteratorTraits [friend] |
vector<Node*> BALL::HashSet< Key >::bucket_ [private] |
Size BALL::HashSet< Key >::capacity_ [private] |
Size BALL::HashSet< Key >::size_ [private] |