CUBRID Engine  latest
broker_list.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  * broker_list.h - Linked-list Utility Interface Header File
22  * This file contains exported stuffs from linked list module.
23  */
24 
25 #ifndef _BROKER_LIST_H_
26 #define _BROKER_LIST_H_
27 
28 #ident "$Id$"
29 
30 
31 #define LINK_LIST_DEFAULT_ASSIGN_FUNC link_list_default_assign_func
32 #define LINK_LIST_DEFAULT_COMPARE_FUNC link_list_default_compare_func
33 
34 #define LINK_LIST_FIND_VALUE(VALUE, HEAD, KEY, KEY_CMP_FUNC) \
35  do { \
36  T_LIST *node; \
37  node = link_list_find(HEAD, KEY, NULL, KEY_CMP_FUNC, NULL); \
38  if (node == NULL) \
39  VALUE = NULL; \
40  else \
41  VALUE = node->value; \
42  } while (0)
43 
44 
45 typedef struct list_tag T_LIST;
46 struct list_tag
47 {
48  void *key;
49  void *value;
50  struct list_tag *next;
51 };
52 
53 
54 extern int link_list_add (T_LIST **, void *, void *, int (*)(T_LIST *, void *, void *));
55 extern T_LIST *link_list_find (T_LIST *, void *, void *, int (*)(void *, void *), int (*)(void *, void *));
56 extern int link_list_node_delete2 (T_LIST **, void *, void *, int (*)(void *, void *), int (*)(void *, void *),
57  void (*)(T_LIST *));
58 extern int link_list_delete (T_LIST **, void (*)(T_LIST *));
59 extern int link_list_node_delete (T_LIST **, void *, int (*)(void *, void *), void (*)(T_LIST *));
60 
61 extern int link_list_default_assign_func (T_LIST * node, void *key, void *value);
62 extern int link_list_default_compare_func (void *key, void *value);
63 extern void *link_list_traverse (T_LIST * head, void *(*traverse_func) (T_LIST *, void *));
64 
65 #endif /* _BROKER_LIST_H_ */
struct list_tag * next
Definition: broker_list.h:50
void * value
Definition: broker_list.h:49
int link_list_node_delete2(T_LIST **, void *, void *, int(*)(void *, void *), int(*)(void *, void *), void(*)(T_LIST *))
Definition: broker_list.c:197
void * link_list_traverse(T_LIST *head, void *(*traverse_func)(T_LIST *, void *))
Definition: broker_list.c:244
void * key
Definition: broker_list.h:48
int link_list_delete(T_LIST **, void(*)(T_LIST *))
Definition: broker_list.c:230
T_LIST * link_list_find(T_LIST *, void *, void *, int(*)(void *, void *), int(*)(void *, void *))
Definition: broker_list.c:112
int link_list_node_delete(T_LIST **, void *, int(*)(void *, void *), void(*)(T_LIST *))
Definition: broker_list.c:156
int link_list_add(T_LIST **, void *, void *, int(*)(T_LIST *, void *, void *))
Definition: broker_list.c:63
int link_list_default_compare_func(void *key, void *value)
Definition: broker_list.c:271
int link_list_default_assign_func(T_LIST *node, void *key, void *value)
Definition: broker_list.c:263