LibHashSet/libhashset/include/hash_set.h

49 lines
1.7 KiB
C
Raw Normal View History

2022-11-19 17:34:56 +01:00
/******************************************************************************/
/* HashSet for C99, by LoRd_MuldeR <MuldeR2@GMX.de> */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
2022-11-25 00:57:19 +01:00
#ifndef _INC_HASHSET_H
#define _INC_HASHSET_H
2022-11-19 17:34:56 +01:00
#include <stdlib.h>
#include <stdint.h>
2022-11-25 02:53:34 +01:00
#if defined(_WIN32) && defined(HASHSET_DLL)
2022-11-25 00:57:19 +01:00
# ifdef _HASHSET_EXPORTS
# define HASHSET_API extern __declspec(dllexport)
# else
# define HASHSET_API extern __declspec(dllimport)
2022-11-25 00:57:19 +01:00
# endif
#else
# define HASHSET_API extern
#endif
2022-11-19 17:34:56 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2022-11-22 23:59:52 +01:00
#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_ERRNO_T_DEFINED)
typedef int errno_t;
#endif
2022-11-19 17:34:56 +01:00
struct _hash_set;
typedef struct _hash_set hash_set_t;
HASHSET_API hash_set_t *hash_set_create(const size_t initial_capacity, const double load_factor);
HASHSET_API void hash_set_destroy(hash_set_t *const instance);
2022-11-19 17:34:56 +01:00
HASHSET_API errno_t hash_set_insert(hash_set_t *const instance, const uint64_t value);
HASHSET_API errno_t hash_set_remove(hash_set_t *const instance, const uint64_t value);
HASHSET_API errno_t hash_set_clear(hash_set_t *const instance);
HASHSET_API errno_t hash_set_contains(const hash_set_t *const instance, const uint64_t value);
2022-11-25 16:32:58 +01:00
HASHSET_API errno_t hash_set_iterate(const hash_set_t *const instance, uintptr_t *const cursor, uint64_t *const value);
HASHSET_API size_t hash_set_size(const hash_set_t *const instance);
HASHSET_API errno_t hash_set_info(const hash_set_t *const instance, size_t *const capacity, size_t *const valid, size_t *const deleted, size_t *const limit);
2022-11-19 17:34:56 +01:00
#ifdef __cplusplus
}
#endif
#endif