eccLib 1.1.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
hashmap_ext.h
Go to the documentation of this file.
1
9#include <Python.h>
10
11#ifndef HASHMAP_EXT_H
12#define HASHMAP_EXT_H
13
14#include "../hashmap/hashmap.h"
15
16// compile flags that should improve performance
17
18#define XXH_INLINE_ALL // slight pefrormance improvement
19#define XXH_NO_STREAM // compile size optimization
20#define XXH_STATIC_LINKING_ONLY // why not if indeed we are statically linking
21#define XXH_NO_STDLIB // we don't use streaming nor states
22
23// supposedly a faster hash function
24#include "../xxHash/xxhash.h"
25
41struct map_tuple {
47 PyObject *key;
52 PyObject *value;
53};
54
66int hashmap_put_tuple(struct hashmap_s *const m, const char *const key,
67 const hashmap_uint32_t len, PyObject *py_key,
68 PyObject *value);
69
80struct map_tuple *hashmap_pop_tuple(struct hashmap_s *const m,
81 const char *const key,
82 const hashmap_uint32_t len);
83
89void hashmap_destroy_tuple(struct hashmap_s *m);
90
96void hashmap_destroy_py(struct hashmap_s *m);
97
104int hashmap_create_xh(const hashmap_uint32_t initial_capacity,
105 struct hashmap_s *const out_hashmap);
106
107#endif
void hashmap_destroy_tuple(struct hashmap_s *m)
Destroy a hashmap, assuming the values are map_tuples.
Definition hashmap_ext.c:111
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.
Definition hashmap_ext.c:70
void hashmap_destroy_py(struct hashmap_s *m)
Destroy a hashmap, assuming the values are PyObjects.
Definition hashmap_ext.c:122
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.
int hashmap_create_xh(const hashmap_uint32_t initial_capacity, struct hashmap_s *const out_hashmap)
Create a hashmap with a custom hash function.
Definition hashmap_ext.c:17
A struct to store a key-value pair.
Definition hashmap_ext.h:41
PyObject * value
The Python object containing the value.
Definition hashmap_ext.h:52
PyObject * key
The Python object containing the key.
Definition hashmap_ext.h:47