ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CSpaceHashNative< Element, Updater > Class Template Reference

A space hash implementation that does not rely on std::map or std::tr1:unordered_map. More...

#include <space_hash_native.h>

+ Inheritance diagram for argos::CSpaceHashNative< Element, Updater >:

List of all members.

Classes

struct  SBucket
 A bucket of the native space hash.

Public Member Functions

 CSpaceHashNative ()
 Class constructor.
 ~CSpaceHashNative ()
 Class destructor.
void Clear ()
 Empties all the buckets in the space hash.
virtual void SetSize (size_t un_size)
 Sets the size of the space hash.
virtual void Update ()
 Updates the entire space hash.
virtual void UpdateCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, Element &c_element)
 Adds an element to a cell of the space hash.
virtual bool CheckCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, typename CSpaceHash< Element, Updater >::TElementList &t_elements)
 Looks for elements to process in a cell.
virtual void Dump (CARGoSLog &c_os)

Detailed Description

template<class Element, class Updater>
class argos::CSpaceHashNative< Element, Updater >

A space hash implementation that does not rely on std::map or std::tr1:unordered_map.

It is much more performant than the standard hash table implementations.

Definition at line 19 of file space_hash_native.h.


Constructor & Destructor Documentation

template<class Element , class Updater >
argos::CSpaceHashNative< Element, Updater >::CSpaceHashNative ( ) [inline]

Class constructor.

The size of the space hash (the number of buckets) is set to zero. To be able to use the space hash, you first must set the size to an appropriate value.

See also:
SetSize()

Definition at line 166 of file space_hash_native.h.

template<class Element , class Updater >
argos::CSpaceHashNative< Element, Updater >::~CSpaceHashNative ( ) [inline]

Class destructor.

Definition at line 173 of file space_hash_native.h.


Member Function Documentation

template<class Element , class Updater >
virtual bool argos::CSpaceHashNative< Element, Updater >::CheckCell ( SInt32  n_i,
SInt32  n_j,
SInt32  n_k,
typename CSpaceHash< Element, Updater >::TElementList &  t_elements 
) [inline, virtual]

Looks for elements to process in a cell.

Parameters:
n_iThe X coordinate of the space hash cell.
n_jThe Y coordinate of the space hash cell.
n_kThe Z coordinate of the space hash cell.
Thelist of elements to process.

Definition at line 249 of file space_hash_native.h.

template<class Element , class Updater >
void argos::CSpaceHashNative< Element, Updater >::Clear ( ) [inline]

Empties all the buckets in the space hash.

Definition at line 181 of file space_hash_native.h.

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::Dump ( CARGoSLog c_os) [inline, virtual]

Implements argos::CAbstractSpaceHash< Element >.

Definition at line 282 of file space_hash_native.h.

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::SetSize ( size_t  un_size) [inline, virtual]

Sets the size of the space hash.

The size corresponds to the number of buckets.

Parameters:
un_sizeThe size of the space hash.
Todo:
rehash

Reimplemented from argos::CAbstractSpaceHash< Element >.

Definition at line 192 of file space_hash_native.h.

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::Update ( ) [inline, virtual]

Updates the entire space hash.

It calls the updater for all the elements held by the space hash.

See also:
CSpaceHashUpdater

Reimplemented from argos::CSpaceHash< Element, Updater >.

Definition at line 203 of file space_hash_native.h.

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::UpdateCell ( SInt32  n_i,
SInt32  n_j,
SInt32  n_k,
Element &  c_element 
) [inline, virtual]

Adds an element to a cell of the space hash.

Parameters:
n_xThe x coordinate of the cell.
n_yThe y coordinate of the cell.
n_zThe z coordinate of the cell.
c_elementThe element to add.

Implements argos::CAbstractSpaceHash< Element >.

Definition at line 217 of file space_hash_native.h.


The documentation for this class was generated from the following file: