ATLAS Offline Software
set.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2005-2008, Simon Howard
4 
5 Permission to use, copy, modify, and/or distribute this software
6 for any purpose with or without fee is hereby granted, provided
7 that the above copyright notice and this permission notice appear
8 in all copies.
9 
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 
19  */
20 
47 #ifndef ALGORITHM_SET_H
48 #define ALGORITHM_SET_H
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
59 typedef struct _Set Set;
60 
67 typedef struct _SetIterator SetIterator;
68 
73 typedef struct _SetEntry SetEntry;
74 
79 typedef void *SetValue;
80 
85 struct _SetIterator {
86  Set *set;
89 };
90 
95 #define SET_NULL ((void *) 0)
96 
101 typedef unsigned long (*SetHashFunc)(SetValue value);
102 
108 typedef int (*SetEqualFunc)(SetValue value1, SetValue value2);
109 
115 typedef void (*SetFreeFunc)(SetValue value);
116 
127 Set *set_new(SetHashFunc hash_func, SetEqualFunc equal_func);
128 
135 void set_free(Set *set);
136 
147 
160 
172 
183 
192 
203 
214 Set *set_union(Set *set1, Set *set2);
215 
226 Set *set_intersection(Set *set1, Set *set2);
227 
237 
248 
258 
259 #ifdef __cplusplus
260 }
261 #endif
262 
263 #endif /* #ifndef ALGORITHM_SET_H */
264 
_SetIterator::next_entry
SetEntry * next_entry
Definition: set.h:87
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
set_remove
int set_remove(Set *set, SetValue data)
Remove a value from a set.
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
set_num_entries
int set_num_entries(Set *set)
Retrieve the number of entries in a set.
set_iter_next
SetValue set_iter_next(SetIterator *iterator)
Using a set iterator, retrieve the next value from the set.
SetFreeFunc
void(* SetFreeFunc)(SetValue value)
Function used to free values stored in a set.
Definition: set.h:115
athena.value
value
Definition: athena.py:124
SetValue
void * SetValue
A value stored in a Set.
Definition: set.h:79
set_iterate
void set_iterate(Set *set, SetIterator *iter)
Initialise a SetIterator structure to iterate over the values in a set.
set_union
Set * set_union(Set *set1, Set *set2)
Perform a union of two sets.
_SetIterator::next_chain
int next_chain
Definition: set.h:88
set_new
Set * set_new(SetHashFunc hash_func, SetEqualFunc equal_func)
Create a new set.
set_register_free_function
void set_register_free_function(Set *set, SetFreeFunc free_func)
Register a function to be called when values are removed from the set.
_SetIterator
Definition of a SetIterator.
Definition: set.h:85
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Set
struct _Set Set
Represents a set of values.
Definition: set.h:59
set_to_array
SetValue * set_to_array(Set *set)
Create an array containing all entries in a set.
_SetIterator::set
Set * set
Definition: set.h:86
SetHashFunc
unsigned long(* SetHashFunc)(SetValue value)
Hash function.
Definition: set.h:101
SetEqualFunc
int(* SetEqualFunc)(SetValue value1, SetValue value2)
Equality function.
Definition: set.h:108
SetEntry
struct _SetEntry SetEntry
Internal structure representing an entry in the set.
Definition: set.h:73
set_iter_has_more
int set_iter_has_more(SetIterator *iterator)
Determine if there are more values in the set to iterate over.
set_insert
int set_insert(Set *set, SetValue data)
Add a value to a set.
set_query
int set_query(Set *set, SetValue data)
Query if a particular value is in a set.
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
set_free
void set_free(Set *set)
Destroy a set.