poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
hashtable.h
Go to the documentation of this file.
1#ifndef POSER_CORE_HASHTABLE_H
2#define POSER_CORE_HASHTABLE_H
3
8#include <poser/decl.h>
9
10#include <stddef.h>
11#include <stdint.h>
12
16C_CLASS_DECL(PSC_HashTable);
17
21C_CLASS_DECL(PSC_HashTableIterator);
22
29DECLEXPORT PSC_HashTable *
31 ATTR_RETNONNULL;
32
42DECLEXPORT void
43PSC_HashTable_set(PSC_HashTable *self, const char *key,
44 void *obj, void (*deleter)(void *))
45 CMETHOD ATTR_NONNULL((2)) ATTR_NONNULL((3));
46
54DECLEXPORT int
55PSC_HashTable_delete(PSC_HashTable *self, const char *key)
56 CMETHOD ATTR_NONNULL((2));
57
63DECLEXPORT size_t
64PSC_HashTable_count(const PSC_HashTable *self)
65 CMETHOD ATTR_PURE;
66
73DECLEXPORT void *
74PSC_HashTable_get(const PSC_HashTable *self, const char *key)
75 CMETHOD ATTR_NONNULL((2));
76
85DECLEXPORT PSC_HashTableIterator *
86PSC_HashTable_iterator(const PSC_HashTable *self)
87 CMETHOD ATTR_RETNONNULL;
88
94DECLEXPORT void
95PSC_HashTable_destroy(PSC_HashTable *self);
96
104DECLEXPORT int
105PSC_HashTableIterator_moveNext(PSC_HashTableIterator *self)
106 CMETHOD;
107
113DECLEXPORT const char *
114PSC_HashTableIterator_key(const PSC_HashTableIterator *self)
115 CMETHOD ATTR_PURE;
116
122DECLEXPORT void *
123PSC_HashTableIterator_current(const PSC_HashTableIterator *self)
124 CMETHOD ATTR_PURE;
125
130DECLEXPORT void
131PSC_HashTableIterator_destroy(PSC_HashTableIterator *self);
132
133#endif
A hash table storing any data objects using string keys.
void PSC_HashTable_set(PSC_HashTable *self, const char *key, void *obj, void(*deleter)(void *))
Set a new object for a key.
PSC_HashTable * PSC_HashTable_create(uint8_t bits)
PSC_HashTable default constructor.
An iterator over the contents of a PSC_HashTable.