c_list.h
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
59 #ifndef C_LIST_H_
60 #define C_LIST_H_
61 
62 
63 /**************/
65 #include <stdint.h>
66 #include <stdbool.h>
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 
72 /************/
74 typedef bool (*c_list_callback_t)(void *elm_ptr, void *arg1, void *arg2, void *arg3);
75 
80 typedef void* c_list_ptr;
81 
86 c_list_ptr c_list_create(void);
87 
97 bool c_list_delete(c_list_ptr list, c_list_callback_t delete_callback);
98 
102 uint32_t c_list_node_count(const c_list_ptr list);
103 
112 bool c_list_insert_elm_beg(c_list_ptr list, const void *elm_ptr);
113 bool c_list_insert_elm_end(c_list_ptr list, const void *elm_ptr);
133 void* c_list_get_elm_at(c_list_ptr list, uint32_t index, void **hint);
134 
144 void* c_list_find_elm(c_list_ptr list, c_list_callback_t callback,
145  void *arg1, void *arg2, void *arg3);
146 
155 bool c_list_delete_elm(c_list_ptr list, const void *elm_ptr);
156 
183 bool c_list_for_each_elm(const c_list_ptr list, c_list_callback_t func,
184  void *arg1, void *arg2, void *arg3);
185 
186 
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 #endif /* C_LIST_H_ */
void * c_list_find_elm(c_list_ptr list, c_list_callback_t callback, void *arg1, void *arg2, void *arg3)
Definition: c_list.c:176
c_list_ptr c_list_create(void)
Definition: c_list.c:44
bool c_list_delete_elm(c_list_ptr list, const void *elm_ptr)
Definition: c_list.c:195
bool c_list_insert_elm_beg(c_list_ptr list, const void *elm_ptr)
Definition: c_list.c:116
bool c_list_for_each_elm(const c_list_ptr list, c_list_callback_t func, void *arg1, void *arg2, void *arg3)
Definition: c_list.c:231
void * c_list_get_elm_at(c_list_ptr list, uint32_t index, void **hint)
Definition: c_list.c:141
uint32_t c_list_node_count(const c_list_ptr list)
Definition: c_list.c:80
bool c_list_insert_elm_end(c_list_ptr list, const void *elm_ptr)
Definition: c_list.c:86
bool c_list_delete(c_list_ptr list, c_list_callback_t delete_callback)
Definition: c_list.c:53
void * c_list_ptr
Definition: c_list.h:80
bool(* c_list_callback_t)(void *elm_ptr, void *arg1, void *arg2, void *arg3)
Definition: c_list.h:74