ATLAS Offline Software
Loading...
Searching...
No Matches
slist.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
65
66#ifndef ALGORITHM_SLIST_H
67#define ALGORITHM_SLIST_H
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
79
80typedef struct _SListEntry SListEntry;
81
85
87
91
92typedef void *SListValue;
93
97
102
106
107#define SLIST_NULL ((void *) 0)
108
116
117typedef int (*SListCompareFunc)(SListValue value1, SListValue value2);
118
126
127typedef int (*SListEqualFunc)(SListValue value1, SListValue value2);
128
134
136
145
147
156
158
165
167
174
176
184
186
195
197
204
206
216
218
227
229
239
241 SListEqualFunc callback,
243
250
251void slist_sort(SListEntry **list, SListCompareFunc compare_func);
252
264
266 SListEqualFunc callback,
268
276
278
287
289
297
299
306
308
309#ifdef __cplusplus
310}
311#endif
312
313#endif /* #ifndef ALGORITHM_SLIST_H */
314
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
void slist_free(SListEntry *list)
Free an entire list.
struct _SListIterator SListIterator
Structure used to iterate over a list.
Definition slist.h:86
SListValue slist_data(SListEntry *listentry)
Retrieve the value stored at a list entry.
SListEntry * slist_append(SListEntry **list, SListValue data)
Append a value to the end of a list.
void slist_sort(SListEntry **list, SListCompareFunc compare_func)
Sort a list.
SListEntry * slist_prepend(SListEntry **list, SListValue data)
Prepend a value to the start of a list.
int slist_remove_data(SListEntry **list, SListEqualFunc callback, SListValue data)
Remove all occurrences of a particular value from a list.
SListValue slist_nth_data(SListEntry *list, int n)
Retrieve the value stored at a specified index in the list.
int slist_length(SListEntry *list)
Find the length of a list.
void slist_iter_remove(SListIterator *iterator)
Delete the current entry in the list (the value last returned from slist_iter_next)
int slist_iter_has_more(SListIterator *iterator)
Determine if there are more values in the list to iterate over.
void * SListValue
Value stored in a list.
Definition slist.h:92
SListValue slist_iter_next(SListIterator *iterator)
Using a list iterator, retrieve the next value from the list.
int slist_remove_entry(SListEntry **list, SListEntry *entry)
Remove an entry from a list.
SListEntry * slist_find_data(SListEntry *list, SListEqualFunc callback, SListValue data)
Find the entry for a particular value in a list.
struct _SListEntry SListEntry
Represents an entry in a singly-linked list.
Definition slist.h:80
SListEntry * slist_nth_entry(SListEntry *list, int n)
Retrieve the entry at a specified index in a list.
int(* SListEqualFunc)(SListValue value1, SListValue value2)
Callback function used to determine of two values in a list are equal.
Definition slist.h:127
SListValue * slist_to_array(SListEntry *list)
Create a C array containing the contents of a list.
void slist_iterate(SListEntry **list, SListIterator *iter)
Initialise a SListIterator structure to iterate over a list.
SListEntry * slist_next(SListEntry *listentry)
Retrieve the next entry in a list.
int(* SListCompareFunc)(SListValue value1, SListValue value2)
Callback function used to compare values in a list when sorting.
Definition slist.h:117
Definition of a SListIterator.
Definition slist.h:98
SListEntry * current
Definition slist.h:100
SListEntry ** prev_next
Definition slist.h:99