gatb.core-API-1.4.2
OAHash< Item > Class Template Reference

Hash table implementation. More...

#include <OAHash.hpp>

Public Member Functions

int getMaxNbItems ()
 
 OAHash (u_int64_t max_memory)
 
 ~OAHash ()
 
void insert (const Item &graine, int value)
 
void increment (const Item &graine)
 
bool get (const Item &graine, int *val=0)
 
bool has_key (const Item &graine)
 
u_int64_t memory_usage ()
 
float load_factor ()
 
dp::Iterator< misc::Abundance< Item > > * iterator (bool sorted=false)
 

Static Public Member Functions

static int size_entry ()
 

Detailed Description

template<typename Item>
class gatb::core::tools::collections::impl::OAHash< Item >

Hash table implementation.

Constructor & Destructor Documentation

OAHash ( u_int64_t  max_memory)
inline

Constructor.

Parameters
[in]max_memory: max memory for the hash table.
~OAHash ( )
inline

Destructor.

Member Function Documentation

bool get ( const Item &  graine,
int *  val = 0 
)
inline

Get the value for a given key

Parameters
[in]graine: key
[out]val: value to be retrieved
Returns
true if the key is found, false otherwise.
int getMaxNbItems ( )
inline

Get the max number of items for the hash table

Returns
the max items number.
bool has_key ( const Item &  graine)
inline

Tells whether or not the given key is in the table

Parameters
[in]graine: key to be checked
Returns
true if present, false otherwise.
void increment ( const Item &  graine)
inline

Increment the value for a given key.

Parameters
[in]graine: key
void insert ( const Item &  graine,
int  value 
)
inline

Insert an item with its value into the hash table.

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

Get an iterator for the hash table.

Parameters
[in]sorted: if true, items are iterated in a sorted way
Returns
an iterator over the items of the hash table.
float load_factor ( )
inline

Get the load factor of the hash table

Returns
the load factor.
u_int64_t memory_usage ( )
inline

Get the memory usage of the hash table

Returns
the memory usage (in bits).
static int size_entry ( )
inlinestatic

Get the size (in byte) of an item.

Returns
the item size.

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