ATLAS Offline Software
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1/*
2
3Copyright (c) 2005-2008, Simon Howard
4
5Permission to use, copy, modify, and/or distribute this software
6for any purpose with or without fee is hereby granted, provided
7that the above copyright notice and this permission notice appear
8in all copies.
9
10THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 */
20
52
53#ifndef ALGORITHM_LIST_H
54#define ALGORITHM_LIST_H
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
66
67typedef struct _ListEntry ListEntry;
68
72
74
78
79typedef void *ListValue;
80
84
89
93
94#define LIST_NULL ((void *) 0)
95
105
106typedef int (*ListCompareFunc)(ListValue value1, ListValue value2);
107
117
118typedef int (*ListEqualFunc)(ListValue value1, ListValue value2);
119
125
127
136
138
147
149
157
159
167
169
176
178
186
188
197
199
206
208
218
220
229
231
241
243
250
251void list_sort(ListEntry **list, ListCompareFunc compare_func);
252
263
265 ListEqualFunc callback,
267
274
276
285
287
295
297
304
306
307#ifdef __cplusplus
308}
309#endif
310
311#endif /* #ifndef ALGORITHM_LIST_H */
312
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
int list_remove_data(ListEntry **list, ListEqualFunc callback, ListValue data)
Remove all occurrences of a particular value from a list.
ListValue list_data(ListEntry *listentry)
Retrieve the value at a list entry.
int(* ListCompareFunc)(ListValue value1, ListValue value2)
Callback function used to compare values in a list when sorting.
Definition list.h:106
void list_iterate(ListEntry **list, ListIterator *iter)
Initialise a ListIterator structure to iterate over a list.
ListEntry * list_prev(ListEntry *listentry)
Retrieve the previous entry in a list.
ListValue list_nth_data(ListEntry *list, int n)
Retrieve the value at a specified index in the list.
void list_sort(ListEntry **list, ListCompareFunc compare_func)
Sort a list.
struct _ListEntry ListEntry
Represents an entry in a doubly-linked list.
Definition list.h:67
int list_length(ListEntry *list)
Find the length of a list.
ListEntry * list_append(ListEntry **list, ListValue data)
Append a value to the end of a list.
int(* ListEqualFunc)(ListValue value1, ListValue value2)
Callback function used to determine of two values in a list are equal.
Definition list.h:118
void list_free(ListEntry *list)
Free an entire list.
void * ListValue
A value stored in a list.
Definition list.h:79
int list_iter_has_more(ListIterator *iterator)
Determine if there are more values in the list to iterate over.
ListEntry * list_nth_entry(ListEntry *list, int n)
Retrieve the entry at a specified index in a list.
ListValue * list_to_array(ListEntry *list)
Create a C array containing the contents of a list.
ListEntry * list_find_data(ListEntry *list, ListEqualFunc callback, ListValue data)
Find the entry for a particular value in a list.
void list_iter_remove(ListIterator *iterator)
Delete the current entry in the list (the value last returned from list_iter_next)
int list_remove_entry(ListEntry **list, ListEntry *entry)
Remove an entry from a list.
struct _ListIterator ListIterator
Structure used to iterate over a list.
Definition list.h:73
ListEntry * list_prepend(ListEntry **list, ListValue data)
Prepend a value to the start of a list.
ListEntry * list_next(ListEntry *listentry)
Retrieve the next entry in a list.
ListValue list_iter_next(ListIterator *iterator)
Using a list iterator, retrieve the next value from the list.
Definition of a ListIterator.
Definition list.h:85
ListEntry * current
Definition list.h:87
ListEntry ** prev_next
Definition list.h:86