38#ifndef COAL_BROADPHASE_SIMPLEHASHTABLE_INL_H 
   39#define COAL_BROADPHASE_SIMPLEHASHTABLE_INL_H 
   49template <
typename Key, 
typename Data, 
typename HashFnc>
 
   55template <
typename Key, 
typename Data, 
typename HashFnc>
 
   67template <
typename Key, 
typename Data, 
typename HashFnc>
 
   69  std::vector<unsigned int> indices = h_(key);
 
   70  size_t range = table_.size();
 
   71  for (
size_t i = 0; i < indices.size(); ++i)
 
   72    table_[indices[i] % range].push_back(value);
 
 
 
   76template <
typename Key, 
typename Data, 
typename HashFnc>
 
   78  size_t range = table_.size();
 
   79  std::vector<unsigned int> indices = h_(key);
 
   80  std::set<Data> result;
 
   81  for (
size_t i = 0; i < indices.size(); ++i) {
 
   82    size_t index = indices[i] % range;
 
   83    std::copy(table_[index].begin(), table_[index].end(),
 
   84              std::inserter(result, result.end()));
 
   87  return std::vector<Data>(result.begin(), result.end());
 
   91template <
typename Key, 
typename Data, 
typename HashFnc>
 
   93  size_t range = table_.size();
 
   94  std::vector<unsigned int> indices = h_(key);
 
   95  for (
size_t i = 0; i < indices.size(); ++i) {
 
   96    size_t index = indices[i] % range;
 
   97    table_[index].remove(value);
 
 
  102template <
typename Key, 
typename Data, 
typename HashFnc>
 
  105  table_.resize(table_size_);
 
 
 
 
 
 
 
 
void clear()
clear the hash table
Definition simple_hash_table-inl.h:103
 
std::vector< Data > query(Key key) const
Find the elements in the hash table whose key is the same as query key.
Definition simple_hash_table-inl.h:77
 
SimpleHashTable(const HashFnc &h)
Definition simple_hash_table-inl.h:50
 
void insert(Key key, Data value)
Definition simple_hash_table-inl.h:68
 
void init(size_t size)
Init the number of bins in the hash table.
Definition simple_hash_table-inl.h:56
 
void remove(Key key, Data value)
remove the key-value pair from the table
Definition simple_hash_table-inl.h:92
 
#define COAL_THROW_PRETTY(message, exception)
Definition fwd.hh:64
 
Main namespace.
Definition broadphase_bruteforce.h:44