-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathset.h
78 lines (54 loc) · 1.85 KB
/
set.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Copyright 2008-2022 Carsten Elton Sorensen
This file is part of ASMotor.
ASMotor is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ASMotor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ASMotor. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(UTIL_SET_H_INCLUDED_)
#define UTIL_SET_H_INCLUDED_
#include <stdbool.h>
#include <stdint.h>
#include "mem.h"
#include "protos.h"
#include "str.h"
#if !defined(IN_SET_C_)
struct Set;
typedef struct Set set_t;
#endif
typedef bool (*predicate_t)(set_t* set, intptr_t userData, intptr_t predicateData, intptr_t element);
extern set_t*
set_Create(equals_t equals, hash_t hash, free_t free);
extern void
set_Clear(set_t* set);
extern bool
set_Exists(set_t* set, intptr_t element);
extern bool
set_Find(set_t* set, predicate_t predicate, intptr_t predicateData, intptr_t* value);
extern bool
set_Value(set_t* set, intptr_t element, intptr_t* value);
extern void
set_Insert(set_t* set, intptr_t element);
extern void
set_Remove(set_t* set, intptr_t element);
extern void
set_Free(set_t* set);
extern ssize_t
set_Count(set_t* set);
extern void
set_ForEachElement(set_t* set, void (*forEach)(set_t* set, intptr_t element, intptr_t data), intptr_t data);
extern intptr_t*
set_ToArray(set_t* set, copy_t copy, ssize_t* totalElements);
extern void
set_SetUserData(set_t* set, intptr_t data);
extern intptr_t
set_GetUserData(set_t* set);
extern set_t*
set_CreateSubSet(set_t* set);
#endif