eccLib 1.1.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Data Structures | Functions
hashmap.h extension

Our extension of the hashmap module. More...

Data Structures

struct  map_tuple
 A struct to store a key-value pair. More...
 

Functions

int hashmap_put_tuple (struct hashmap_s *const m, const char *const key, const hashmap_uint32_t len, PyObject *py_key, PyObject *value)
 Put a key-value pair into the hashmap.
 
struct map_tuplehashmap_pop_tuple (struct hashmap_s *const m, const char *const key, const hashmap_uint32_t len)
 Remove a value from the hashmap.
 
void hashmap_destroy_tuple (struct hashmap_s *m)
 Destroy a hashmap, assuming the values are map_tuples.
 
void hashmap_destroy_py (struct hashmap_s *m)
 Destroy a hashmap, assuming the values are PyObjects.
 

Detailed Description

Our extension of the hashmap module.

Since the Python dict object proved far too hermetic for our shenanigans we had to use a third-part hashmap library. We settled on https://github.com/sheredom/hashmap.h, and this module extends that library

Function Documentation

◆ hashmap_destroy_py()

void hashmap_destroy_py ( struct hashmap_s *  m)

Destroy a hashmap, assuming the values are PyObjects.

Parameters
mthe hashmap to destroy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashmap_destroy_tuple()

void hashmap_destroy_tuple ( struct hashmap_s *  m)

Destroy a hashmap, assuming the values are map_tuples.

Parameters
mthe hashmap to destroy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashmap_pop_tuple()

struct map_tuple * hashmap_pop_tuple ( struct hashmap_s *const  m,
const char *const  key,
const hashmap_uint32_t  len 
)

Remove a value from the hashmap.

Parameters
mthe hashmap to remove the value from
keythe key to remove the value for
lenthe length of the key
Returns
the removed value or NULL if not found
Warning
You must free the returned value, and decrement the reference count of the key and value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashmap_put_tuple()

int hashmap_put_tuple ( struct hashmap_s *const  m,
const char *const  key,
const hashmap_uint32_t  len,
PyObject *  py_key,
PyObject *  value 
)

Put a key-value pair into the hashmap.

Parameters
mthe hashmap to put the pair into
keythe key to put
lenthe length of the key
py_keythe Python key object
valuethe value to put
Returns
0 on success, 1 on failure
Note
This funciton will increment the reference count of the key and value