CrystalSpace

Public API Reference

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

csSet< T, KeyHandler > Class Template Reference

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

#include <csutil/hash.h>

List of all members.

Public Member Functions

 csSet (int size=23, int grow_rate=5, 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.
size_t 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 578 of file hash.h.


Constructor & Destructor Documentation

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

Construct a new empty set.

The given size will be passed to the hashmap.

Definition at line 609 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 618 of file hash.h.

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 630 of file hash.h.

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 656 of file hash.h.

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

Delete all elements in the set.

Definition at line 646 of file hash.h.

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 668 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 675 of file hash.h.

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

Get the number of elements in the set.

Definition at line 662 of file hash.h.

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 638 of file hash.h.


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