gatb.core-API-1.4.2
Hash16< Item, value_type > Class Template Reference

Class providing hash table service with a given memory max usage. More...

#include <Hash16.hpp>

Public Member Functions

 Hash16 (size_t sizeMB)
 
 Hash16 (u_int64_t nb_entries, u_int64_t *nb_created)
 
 ~Hash16 ()
 
void clear ()
 
void insert (Item graine, value_type value)
 
void insert (Item graine)
 
dp::Iterator< cell > * iterator (bool sorted=false)
 
int get (Item graine, value_type *val)
 
bool contains (Item graine)
 
int remove (Item graine, value_type *val)
 
u_int64_t size ()
 
u_int64_t getMaxNbItems ()
 

Protected Attributes

system::IMemory_memory
 

Detailed Description

template<typename Item, typename value_type = int>
class gatb::core::tools::collections::impl::Hash16< Item, value_type >

Class providing hash table service with a given memory max usage.

Constructor & Destructor Documentation

Hash16 ( size_t  sizeMB)
inline

Constructor.

Parameters
[in]sizeMB: approx max memory to be used by the hash table
Hash16 ( u_int64_t  nb_entries,
u_int64_t *  nb_created 
)
inline

Constructor with directly number of entries wished, return really created in nb_created

Parameters
[in]nb_entries: number of entries.
[in]nb_created: number of created items.
~Hash16 ( )
inline

Destructor

Member Function Documentation

void clear ( )
inline

Clear the content of the hash table.

bool contains ( Item  graine)
inline

Tells whether or not the given key exists in the hash table.

Parameters
[in]graine: key
Returns
true if the key exists, 0 otherwise.
int get ( Item  graine,
value_type *  val 
)
inline

Get the value for a given key

Parameters
[in]graine: key
[out]val: value to be retrieved
Returns
1 if the key exists, 0 otherwise.
u_int64_t getMaxNbItems ( )
inline

Get the max number of items allowed by the hash table

Returns
the max number of items.
void insert ( Item  graine,
value_type  value 
)
inline

Insert an item into the hash table

Parameters
[in]graine: key
[in]value: value
void insert ( Item  graine)
inline

Insert an item into the hash table

Parameters
[in]graine: key
dp::Iterator< cell >* iterator ( bool  sorted = false)
inline

Get an iterator for the hash table.

Parameters
[in]sorted: if true, items are iterated in a sorted way (warning: reorder in place so cant acces hash after that !)
Returns
an iterator over the items of the hash table.
int remove ( Item  graine,
value_type *  val 
)
inline

Remove a key from the hash table.

Parameters
[in]graine: key to be removed from the hash table
[out]val: value of the key
Returns
true if the key was found, 0 otherwise
u_int64_t size ( )
inline

Get the number of items in the hash table

Returns
the number of items.

Member Data Documentation

system::IMemory& _memory
protected

Shortcut


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