00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef LIST_H
00017 #define LIST_H
00018
00019 #include <assert.h>
00020 #include <inttypes.h>
00021 #include <stdbool.h>
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <string.h>
00025
00026 #include "common/gru_base.h"
00027 #include "common/gru_status.h"
00028 #include "gru_collection_callbacks.h"
00029 #include "gru_node.h"
00030 #include "gru_node_info.h"
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035
00036 typedef struct gru_list_t_ {
00037 gru_node_t *root;
00038 gru_node_t *current;
00039 } gru_list_t;
00040
00045 gru_export gru_list_t *gru_list_new(gru_status_t *status);
00046
00051 gru_export void gru_list_destroy(gru_list_t **list);
00052
00059 gru_export uint32_t gru_list_count(const gru_list_t *list);
00060
00070 gru_export const gru_node_t *gru_list_append(gru_list_t *list, const void *data);
00071
00079 gru_export gru_node_t *gru_list_insert(
00080 gru_list_t *list, const void *data, uint32_t position);
00081
00088 gru_export gru_node_t *gru_list_remove(gru_list_t *list, uint32_t position);
00089
00097 gru_export bool gru_list_remove_item(
00098 gru_list_t *list, compare_function_t comparable, const void *other);
00099
00106 gru_export const gru_node_t *gru_list_get(const gru_list_t *list, uint32_t position);
00107
00116 gru_export void gru_list_for_each_compare(const gru_list_t *list, bool uniqueness,
00117 compare_function_t comparable, const void *compare, void *result);
00118
00125 gru_export void gru_list_for_each(
00126 const gru_list_t *list, handle_function_t handle, void *data);
00127
00135 gru_export void gru_list_for_each_ex(
00136 const gru_list_t *list, handle_function_info_t handle, void *data);
00137
00146 gru_export const void *gru_list_get_item(
00147 const gru_list_t *list, compare_function_t comparable, const void *other);
00148
00149 #ifdef __cplusplus
00150 }
00151 #endif
00152
00153 #endif