ATLAS Offline Software
Loading...
Searching...
No Matches
arraylist.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
38
39#ifndef ALGORITHM_ARRAYLIST_H
40#define ALGORITHM_ARRAYLIST_H
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
49
50typedef void *ArrayListValue;
51
58
59typedef struct _ArrayList ArrayList;
60
64
65struct _ArrayList {
66
68
70
72
73 int length;
74
76
78};
79
85
86typedef int (*ArrayListEqualFunc)(ArrayListValue value1, ArrayListValue value2);
87
99
101 ArrayListValue value2);
102
112
114
120
121void arraylist_free(ArrayList *arraylist);
122
132
134
144
146
153
154void arraylist_remove(ArrayList *arraylist, int index);
155
163
164void arraylist_remove_range(ArrayList *arraylist, int index, int length);
165
178
180
191
193 ArrayListEqualFunc callback,
195
201
202void arraylist_clear(ArrayList *arraylist);
203
210
211void arraylist_sort(ArrayList *arraylist, ArrayListCompareFunc compare_func);
212
213#ifdef __cplusplus
214}
215#endif
216
217#endif /* #ifndef ALGORITHM_ARRAYLIST_H */
218
double length(const pvec &v)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
int(* ArrayListCompareFunc)(ArrayListValue value1, ArrayListValue value2)
Compare two values in an arraylist.
Definition arraylist.h:100
int arraylist_index_of(ArrayList *arraylist, ArrayListEqualFunc callback, ArrayListValue data)
Find the index of a particular value in an ArrayList.
void arraylist_clear(ArrayList *arraylist)
Remove all entries from an ArrayList.
void arraylist_remove(ArrayList *arraylist, int index)
Remove the entry at the specified location in an ArrayList.
int arraylist_prepend(ArrayList *arraylist, ArrayListValue data)
Prepend a value to the beginning of an ArrayList.
int arraylist_insert(ArrayList *arraylist, int index, ArrayListValue data)
Insert a value at the specified index in an ArrayList.
int(* ArrayListEqualFunc)(ArrayListValue value1, ArrayListValue value2)
Compare two values in an arraylist to determine if they are equal.
Definition arraylist.h:86
void arraylist_sort(ArrayList *arraylist, ArrayListCompareFunc compare_func)
Sort the values in an ArrayList.
void arraylist_free(ArrayList *arraylist)
Destroy an ArrayList and free back the memory it uses.
int arraylist_append(ArrayList *arraylist, ArrayListValue data)
Append a value to the end of an ArrayList.
void arraylist_remove_range(ArrayList *arraylist, int index, int length)
Remove a range of entries at the specified location in an ArrayList.
void * ArrayListValue
A value to be stored in an ArrayList.
Definition arraylist.h:50
ArrayList * arraylist_new(int length)
Allocate a new ArrayList for use.
struct _ArrayList ArrayList
An ArrayList structure.
Definition arraylist.h:59
Definition index.py:1
Definition of an ArrayList.
Definition arraylist.h:65
int _alloced
Private data and should not be accessed.
Definition arraylist.h:77
int length
Length of the array.
Definition arraylist.h:73
ArrayListValue * data
Entries in the array.
Definition arraylist.h:69