CUBRID Engine  latest
esql_hash.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * esql_hash.h - Generic hash table implementation header file.
22  */
23 
24 #ifndef _ESQL_HASH_H_
25 #define _ESQL_HASH_H_
26 
27 #ident "$Id$"
28 
29 typedef unsigned (*HT_HASH_FN) (void *);
30 typedef int (*HT_CMP_FN) (void *, void *);
31 typedef void (*HT_FREE_FN) (void *);
32 
33 typedef struct hash_tab_s HASH_TAB;
34 struct hash_tab_s
35 {
36  void (*free_table) (HASH_TAB * tbl, HT_FREE_FN free);
37  void *(*add_symbol) (HASH_TAB * tbl, void *sym);
38  void *(*find_symbol) (HASH_TAB * tbl, void *sym);
39  void *(*next_symbol) (HASH_TAB * tbl, void *last);
40  void (*remove_symbol) (HASH_TAB * tbl, void *sym);
41  int (*print_table) (HASH_TAB * tbl, void (*prnt) (), void *par, int srt);
42  int (*get_symbol_count) (HASH_TAB * tbl);
43 };
44 
45 extern HASH_TAB *es_ht_make_table (unsigned maxsym, HT_HASH_FN hash, HT_CMP_FN cmp);
46 extern void *es_ht_alloc_new_symbol (int size);
47 extern void es_ht_free_symbol (void *sym);
48 
49 #endif /* _ESQL_HASH_H_ */
int(* HT_CMP_FN)(void *, void *)
Definition: esql_hash.h:30
int(* get_symbol_count)(HASH_TAB *tbl)
Definition: esql_hash.h:42
int(* print_table)(HASH_TAB *tbl, void(*prnt)(), void *par, int srt)
Definition: esql_hash.h:41
void es_ht_free_symbol(void *sym)
Definition: esql_hash.c:369
void(* HT_FREE_FN)(void *)
Definition: esql_hash.h:31
HASH_TAB * es_ht_make_table(unsigned maxsym, HT_HASH_FN hash, HT_CMP_FN cmp)
Definition: esql_hash.c:383
void(* remove_symbol)(HASH_TAB *tbl, void *sym)
Definition: esql_hash.h:40
unsigned(* HT_HASH_FN)(void *)
Definition: esql_hash.h:29
#define cmp
Definition: mprec.h:351
void * es_ht_alloc_new_symbol(int size)
Definition: esql_hash.c:351
void(* free_table)(HASH_TAB *tbl, HT_FREE_FN free)
Definition: esql_hash.h:36