-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdliset_headers.h
136 lines (85 loc) · 2.51 KB
/
dliset_headers.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* @file dliset_headers.h
* @brief ISet function prototypes
* @author Dominique LaSalle <[email protected]>
* Copyright (c) 2013-2015, Dominique LaSalle
* @version 1
* @date 2013-10-05
*/
/* prefixing ugliness */
#define DLISET_PRE2(prefix,suffix) prefix ## _ ## suffix
#define DLISET_PRE1(prefix,suffix) DLISET_PRE2(prefix,suffix)
#define DLISET_PUB(name) DLISET_PRE1(DLISET_PREFIX,name)
#define DLISET_PRI(name) DLISET_PRE1(_,DLISET_PRE1(DLISET_PREFIX,name))
typedef struct DLISET_PUB(iset_t) {
size_t size;
size_t maxsize;
DLISET_TYPE_T min;
DLISET_TYPE_T max;
DLISET_TYPE_T * __DL_RESTRICT ind;
DLISET_TYPE_T * __DL_RESTRICT ptr;
#ifdef DLISET_SYNC
omp_lock_t lock;
#endif
} DLISET_PUB(iset_t);
#ifndef DLISET_STATIC
/******************************************************************************
* FUNCTION PROTOTYPES *********************************************************
******************************************************************************/
/**
* @brief Allocate and initialize an ISet with a minimum and maximum element
* value.
*
* @param min The minimum element (inclusive).
* @param max The maximum element (exclusive).
*
* @return The ISet.
*/
DLISET_PUB(iset_t) * DLISET_PUB(iset_create)(
DLISET_TYPE_T min,
DLISET_TYPE_T max);
DLISET_TYPE_T DLISET_PUB(iset_get)(
size_t i,
DLISET_PUB(iset_t) const * set);
int DLISET_PUB(iset_contains)(
DLISET_TYPE_T item,
DLISET_PUB(iset_t) const * set);
int DLISET_PUB(iset_add)(
DLISET_TYPE_T item,
DLISET_PUB(iset_t) * set);
DLISET_PUB(iset_t) * DLISET_PUB(iset_clone)(
DLISET_PUB(iset_t) * set);
int DLISET_PUB(iset_populate)(
DLISET_PUB(iset_t) * set);
int DLISET_PUB(iset_remove)(
DLISET_TYPE_T item,
DLISET_PUB(iset_t) * set);
DLISET_TYPE_T DLISET_PUB(iset_remove_index)(
size_t idx,
DLISET_PUB(iset_t) * set);
void DLISET_PUB(iset_move_to_front)(
DLISET_TYPE_T item,
DLISET_PUB(iset_t) * set);
size_t DLISET_PUB(iset_clear)(
DLISET_PUB(iset_t) * set);
DLISET_TYPE_T DLISET_PUB(iset_indexof)(
DLISET_TYPE_T item,
DLISET_PUB(iset_t) const * set);
void DLISET_PUB(iset_expand)(
DLISET_TYPE_T nmax,
DLISET_PUB(iset_t) * set);
void DLISET_PUB(iset_free)(
DLISET_PUB(iset_t) * ptr);
#undef DLISET_PRE2
#undef DLISET_PRE1
#undef DLISET_PRI
#undef DLISET_PUB
#else
#undef DLISET_PRE2
#undef DLISET_PRE1
#undef DLISET_PRI
#undef DLISET_PUB
#define DLISET_VISIBILITY static
#include "dliset_funcs.h"
#undef DLISET_VISIBILITY
#endif