ATLAS Offline Software
Loading...
Searching...
No Matches
set.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
46
47#ifndef ALGORITHM_SET_H
48#define ALGORITHM_SET_H
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
58
59typedef struct _Set Set;
60
66
68
72
73typedef struct _SetEntry SetEntry;
74
78
79typedef void *SetValue;
80
84
90
94
95#define SET_NULL ((void *) 0)
96
100
101typedef unsigned long (*SetHashFunc)(SetValue value);
102
107
108typedef int (*SetEqualFunc)(SetValue value1, SetValue value2);
109
114
115typedef void (*SetFreeFunc)(SetValue value);
116
126
127Set *set_new(SetHashFunc hash_func, SetEqualFunc equal_func);
128
134
136
145
147
158
160
170
172
181
183
190
192
201
203
213
214Set *set_union(Set *set1, Set *set2);
215
225
226Set *set_intersection(Set *set1, Set *set2);
227
235
237
246
248
256
258
259#ifdef __cplusplus
260}
261#endif
262
263#endif /* #ifndef ALGORITHM_SET_H */
264
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
STL class.
int set_insert(Set *set, SetValue data)
Add a value to a set.
void(* SetFreeFunc)(SetValue value)
Function used to free values stored in a set.
Definition set.h:115
int set_query(Set *set, SetValue data)
Query if a particular value is in a set.
SetValue set_iter_next(SetIterator *iterator)
Using a set iterator, retrieve the next value from the set.
int set_remove(Set *set, SetValue data)
Remove a value from a set.
int(* SetEqualFunc)(SetValue value1, SetValue value2)
Equality function.
Definition set.h:108
SetValue * set_to_array(Set *set)
Create an array containing all entries in a set.
struct _SetEntry SetEntry
Internal structure representing an entry in the set.
Definition set.h:73
int set_iter_has_more(SetIterator *iterator)
Determine if there are more values in the set to iterate over.
struct _Set Set
Represents a set of values.
Definition set.h:59
void * SetValue
A value stored in a Set.
Definition set.h:79
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
void set_iterate(Set *set, SetIterator *iter)
Initialise a SetIterator structure to iterate over the values in a set.
unsigned long(* SetHashFunc)(SetValue value)
Hash function.
Definition set.h:101
void set_register_free_function(Set *set, SetFreeFunc free_func)
Register a function to be called when values are removed from the set.
Set * set_new(SetHashFunc hash_func, SetEqualFunc equal_func)
Create a new set.
int set_num_entries(Set *set)
Retrieve the number of entries in a set.
Set * set_union(Set *set1, Set *set2)
Perform a union of two sets.
struct _SetIterator SetIterator
An object used to iterate over a set.
Definition set.h:67
void set_free(Set *set)
Destroy a set.
Definition of a SetIterator.
Definition set.h:85
int next_chain
Definition set.h:88
SetEntry * next_entry
Definition set.h:87
Set * set
Definition set.h:86