CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csSet< T, KeyHandler > Class Template Reference

This class implements a basic set for objects. More...

#include <hash.h>

List of all members.

Public Methods

 csSet (int size=257, int grow_rate=64, int max_size=20000)
 Construct a new empty set.

void Add (const T &object)
 Add an object to this set.

void AddNoTest (const T &object)
 Add an object to this set.

bool In (const T &object) const
 Test if an object is in this set.

void DeleteAll ()
 Delete all elements in the set.

bool Delete (const T &object)
 Delete an object from the set.

int GetSize () const
 Get the number of elements in the set.

csHash< T, T, KeyHandler > * GetHash ()
 Return the hash map for this hash set.

GlobalIterator GetIterator () const
 Return an iterator for the hash set, to iterate over all elements.


Detailed Description

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
class csSet< T, KeyHandler >

This class implements a basic set for objects.

You can basically use this to test for the occurrence of some object quickly.

Definition at line 538 of file hash.h.


Constructor & Destructor Documentation

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
csSet< T, KeyHandler >::csSet int    size = 257,
int    grow_rate = 64,
int    max_size = 20000
[inline]
 

Construct a new empty set.

The given size will be passed to the hashmap.

Definition at line 569 of file hash.h.


Member Function Documentation

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
void csSet< T, KeyHandler >::Add const T &    object [inline]
 

Add an object to this set.

This will do nothing if the object is already present.

Definition at line 578 of file hash.h.

References csSet< T, KeyHandler >::AddNoTest(), and csSet< T, KeyHandler >::In().

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
void csSet< T, KeyHandler >::AddNoTest const T &    object [inline]
 

Add an object to this set.

This function does not test if the object is already there. This is used for efficiency reasons. But use with care!

Definition at line 590 of file hash.h.

References csHash< T, K, KeyHandler >::Put().

Referenced by csSet< T, KeyHandler >::Add().

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
bool csSet< T, KeyHandler >::Delete const T &    object [inline]
 

Delete an object from the set.

This function does nothing if the object is not in the set. Return true if the object was present.

Definition at line 616 of file hash.h.

References csHash< T, K, KeyHandler >::Delete().

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
void csSet< T, KeyHandler >::DeleteAll   [inline]
 

Delete all elements in the set.

Definition at line 606 of file hash.h.

References csHash< T, K, KeyHandler >::DeleteAll().

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
csHash<T, T, KeyHandler>* csSet< T, KeyHandler >::GetHash   [inline]
 

Return the hash map for this hash set.

Definition at line 628 of file hash.h.

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
GlobalIterator csSet< T, KeyHandler >::GetIterator   const [inline]
 

Return an iterator for the hash set, to iterate over all elements.

Modifying the set while you have open iterators will cause undefined behaviour.

Definition at line 635 of file hash.h.

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
int csSet< T, KeyHandler >::GetSize   const [inline]
 

Get the number of elements in the set.

Definition at line 622 of file hash.h.

References csHash< T, K, KeyHandler >::GetSize().

template<class T, class KeyHandler = csIntegralHashKeyHandler<T>>
bool csSet< T, KeyHandler >::In const T &    object const [inline]
 

Test if an object is in this set.

Definition at line 598 of file hash.h.

References csHash< T, K, KeyHandler >::In().

Referenced by csSet< T, KeyHandler >::Add().


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18