cctools
itable.h
Go to the documentation of this file.
1/*
2Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3Copyright (C) 2022 The University of Notre Dame
4This software is distributed under the GNU General Public License.
5See the file COPYING for details.
6*/
7
8#ifndef ITABLE_H
9#define ITABLE_H
10
11#include "int_sizes.h"
12
56struct itable *itable_create(int buckets);
57
63void itable_clear( struct itable *h, void (*delete_func)(void*) );
64
70void itable_delete(struct itable *h);
71
77int itable_size(struct itable *h);
78
89int itable_insert(struct itable *h, UINT64_T key, const void *value);
90
97void *itable_lookup(struct itable *h, UINT64_T key);
98
105void *itable_remove(struct itable *h, UINT64_T key);
106
112void * itable_pop( struct itable *h );
113
121void itable_firstkey(struct itable *h);
122
131int itable_nextkey(struct itable *h, UINT64_T * key, void **value);
132
147#define ITABLE_ITERATE(table,key,value) itable_firstkey(table); while(itable_nextkey(table,&key,(void**)&value))
148
149#endif
int itable_size(struct itable *h)
Count the entries in an integer table.
int itable_nextkey(struct itable *h, UINT64_T *key, void **value)
Continue iteration over all keys.
void itable_clear(struct itable *h, void(*delete_func)(void *))
Remove all entries from an integer table.
void * itable_lookup(struct itable *h, UINT64_T key)
Look up a value by key.
void itable_delete(struct itable *h)
Delete an integer table.
void itable_firstkey(struct itable *h)
Begin iteration over all keys.
struct itable * itable_create(int buckets)
Create a new integer table.
void * itable_pop(struct itable *h)
Remove any one value.
void * itable_remove(struct itable *h, UINT64_T key)
Remove a value by key.
int itable_insert(struct itable *h, UINT64_T key, const void *value)
Insert a key and value.