forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnpy_hashtable.h
More file actions
47 lines (33 loc) · 1.44 KB
/
npy_hashtable.h
File metadata and controls
47 lines (33 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef NUMPY_CORE_SRC_COMMON_NPY_NPY_HASHTABLE_H_
#define NUMPY_CORE_SRC_COMMON_NPY_NPY_HASHTABLE_H_
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#include "numpy/ndarraytypes.h"
typedef struct {
int key_len; /* number of identities used */
/* Buckets stores: val1, key1[0], key1[1], ..., val2, key2[0], ... */
HPyField *buckets;
npy_intp size; /* current size */
npy_intp nelem; /* number of elements */
} PyArrayIdentityHash;
NPY_NO_EXPORT int
PyArrayIdentityHash_SetItem(PyArrayIdentityHash *tb, PyObject *cache_owner,
PyObject *const *key, PyObject *value, int replace);
NPY_NO_EXPORT PyObject *
PyArrayIdentityHash_GetItem(PyArrayIdentityHash const *tb, PyObject *cache_owner,
PyObject *const *key);
NPY_NO_EXPORT PyArrayIdentityHash *
PyArrayIdentityHash_New(int key_len);
NPY_NO_EXPORT PyArrayIdentityHash *
HPyArrayIdentityHash_New(HPyContext *ctx, int key_len);
NPY_NO_EXPORT void
PyArrayIdentityHash_Dealloc(PyArrayIdentityHash *tb);
NPY_NO_EXPORT int
HPyArrayIdentityHash_SetItem(HPyContext *ctx, HPy cache_owner,
PyArrayIdentityHash *tb, HPy const *key, HPy value, int replace);
NPY_NO_EXPORT HPy
HPyArrayIdentityHash_GetItem(HPyContext *ctx, HPy cache_owner,
PyArrayIdentityHash const *tb, HPy const *key);
NPY_NO_EXPORT int
HPyArrayIdentityHash_Traverse(PyArrayIdentityHash *tb, HPyFunc_visitproc visit, void *arg);
#endif /* NUMPY_CORE_SRC_COMMON_NPY_NPY_HASHTABLE_H_ */