BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

list.h
Go to the documentation of this file.
1 /* $Id$ */
2 /*
3  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 #ifndef __PJ_LIST_H__
21 #define __PJ_LIST_H__
22 
28 #include <pj/types.h>
29 
31 
32 /*
33  * @defgroup PJ_DS Data Structure.
34  */
35 
62 #define PJ_DECL_LIST_MEMBER(type) \
63  \
64  type *prev; \
65  \
66  type *next
67 
68 
74 struct pj_list
75 {
77 } PJ_ATTR_MAY_ALIAS; /* may_alias avoids warning with gcc-4.4 -Wall -O2 */
78 
79 
89 {
90  ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
91 }
92 
93 
103 {
104  return ((pj_list*)node)->next == node;
105 }
106 
107 
116 
117 
126 {
127  pj_list_insert_before(list, node);
128 }
129 
130 
138  pj_list_type *nodes);
139 
149 
150 
159 {
160  pj_list_insert_after(list, node);
161 }
162 
163 
171  pj_list_type *nodes);
172 
173 
188 
189 
205 
206 
212 PJ_IDECL(void) pj_list_erase(pj_list_type *node);
213 
214 
225  pj_list_type *node);
226 
227 
242 PJ_IDECL(pj_list_type*) pj_list_search(pj_list_type *list, void *value,
243  int (*comp)(void *value,
244  const pj_list_type *node)
245  );
246 
247 
256 
257 
262 #if PJ_FUNCTIONS_ARE_INLINED
263 # include "list_i.h"
264 #endif
265 
267 
268 #endif /* __PJ_LIST_H__ */
269 
void pj_list_erase(pj_list_type *node)
void pj_list_push_back(pj_list_type *list, pj_list_type *node)
Definition: list.h:125
pj_list_type * pj_list_find_node(pj_list_type *list, pj_list_type *node)
void pj_list_merge_first(pj_list_type *list1, pj_list_type *list2)
Declaration of basic types and utility.
void pj_list_insert_after(pj_list_type *pos, pj_list_type *node)
void pj_list_insert_nodes_after(pj_list_type *lst, pj_list_type *nodes)
pj_size_t pj_list_size(const pj_list_type *list)
#define PJ_END_DECL
Definition: config.h:1281
pj_list_type * pj_list_search(pj_list_type *list, void *value, int(*comp)(void *value, const pj_list_type *node))
#define PJ_DECL_LIST_MEMBER(type)
Definition: list.h:62
#define PJ_BEGIN_DECL
Definition: config.h:1280
int pj_list_empty(const pj_list_type *node)
Definition: list.h:102
#define PJ_INLINE(type)
Definition: config.h:1174
void pj_list_insert_nodes_before(pj_list_type *lst, pj_list_type *nodes)
void pj_list_type
Definition: types.h:157
#define PJ_IDECL(type)
Definition: config.h:1329
void pj_list_init(pj_list_type *node)
Definition: list.h:88
void pj_list_push_front(pj_list_type *list, pj_list_type *node)
Definition: list.h:158
void pj_list_merge_last(pj_list_type *list1, pj_list_type *list2)
void pj_list_insert_before(pj_list_type *pos, pj_list_type *node)
Definition: list.h:74
size_t pj_size_t
Definition: types.h:58

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.