libannodex 0.7.3
anx_list.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2003 Commonwealth Scientific and Industrial Research
3 Organisation (CSIRO) Australia
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8
9 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 - Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16 - Neither the name of CSIRO Australia nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*/
32
33#ifndef __ANX_LIST_H__
34#define __ANX_LIST_H__
35
40#include <annodex/anx_core.h>
41
45typedef struct _AnxList AnxList;
46
47struct _AnxList {
48 AnxList * prev;
49 AnxList * next;
50 void * data;
51};
52
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
62
69
77
84
91AnxList * anx_list_prepend (AnxList * list, void * data);
92
99AnxList * anx_list_append (AnxList * list, void * data);
100
108AnxList * anx_list_add_before (AnxList * list, void * data, AnxList * node);
109
117AnxList * anx_list_add_after (AnxList * list, void * data, AnxList * node);
118
125AnxList * anx_list_find (AnxList * list, void * data);
126
134
141
148
155
163
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* __ANX_LIST_H__ */
Core datatypes etc.
void *(* AnxCloneFunc)(void *data)
Signature of a cloning function.
Definition: anx_core.h:51
void *(* AnxFreeFunc)(void *data)
Signature of a freeing function.
Definition: anx_core.h:56
int anx_list_length(AnxList *list)
Query the number of items in a list.
AnxList * anx_list_prepend(AnxList *list, void *data)
Prepend a new node to a list containing given data.
AnxList * anx_list_append(AnxList *list, void *data)
Append a new node to a list containing given data.
AnxList * anx_list_clone(AnxList *list)
Clone a list using the default clone function.
AnxList * anx_list_remove(AnxList *list, AnxList *node)
Remove a node from a list.
int anx_list_is_empty(AnxList *list)
Query if a list is empty, ie.
AnxList * anx_list_new(void)
Create a new list.
AnxList * anx_list_free(AnxList *list)
Free a list, using anx_free() to free each data element.
AnxList * anx_list_clone_with(AnxList *list, AnxCloneFunc clone)
Clone a list using a custom clone function.
AnxList * anx_list_add_after(AnxList *list, void *data, AnxList *node)
Add a new node containing given data after a given node.
AnxList * anx_list_add_before(AnxList *list, void *data, AnxList *node)
Add a new node containing given data before a given node.
AnxList * anx_list_tail(AnxList *list)
Return the tail element of a list.
int anx_list_is_singleton(AnxList *list)
Query if the list is singleton, ie.
AnxList * anx_list_find(AnxList *list, void *data)
Find the first node containing given data in a list.
AnxList * anx_list_free_with(AnxList *list, AnxFreeFunc free_func)
Free a list, using a given function to free each data element.
Definition: anx_list.h:47