ucx/cx/map.h

Sun, 05 Jan 2025 22:00:39 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 05 Jan 2025 22:00:39 +0100
changeset 440
7c4b9cba09ca
parent 373
2eede3d98aba
permissions
-rw-r--r--

update ucx

174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
29 * @file map.h
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
30 * @brief Interface for map implementations.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
31 * @author Mike Becker
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
32 * @author Olaf Wintermann
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
33 * @copyright 2-Clause BSD License
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #ifndef UCX_MAP_H
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #define UCX_MAP_H
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include "common.h"
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 #include "collection.h"
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 #include "string.h"
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 #include "hash_key.h"
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 #ifdef __cplusplus
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 extern "C" {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 #endif
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 /** Type for the UCX map. */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 typedef struct cx_map_s CxMap;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 /** Type for a map entry. */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 typedef struct cx_map_entry_s CxMapEntry;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 /** Type for map class definitions. */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 typedef struct cx_map_class_s cx_map_class;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 /** Structure for the UCX map. */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 struct cx_map_s {
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
59 /**
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
60 * Base attributes.
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
61 */
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
62 CX_COLLECTION_BASE;
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 /** The map class definition. */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 cx_map_class *cl;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 };
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 * The type of iterator for a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 enum cx_map_iterator_type {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 * Iterates over key/value pairs.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 CX_MAP_ITERATOR_PAIRS,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 * Iterates over keys only.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 CX_MAP_ITERATOR_KEYS,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 * Iterates over values only.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 CX_MAP_ITERATOR_VALUES
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 };
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 * The class definition for arbitrary maps.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 struct cx_map_class_s {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 * Deallocates the entire memory.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
92 void (*deallocate)(struct cx_map_s *map);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 * Removes all elements.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 void (*clear)(struct cx_map_s *map);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 * Add or overwrite an element.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 int (*put)(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 CxHashKey key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 );
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 * Returns an element.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 void *(*get)(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
112 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 CxHashKey key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 );
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 * Removes an element.
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
118 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
119 * Implementations SHALL check if @p targetbuf is set and copy the elements
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
120 * to the buffer without invoking any destructor.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
121 * When @p targetbuf is not set, the destructors SHALL be invoked.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
122 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
123 * The function SHALL return zero when the @p key was found and
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
124 * non-zero, otherwise.
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
126 int (*remove)(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 CxHashKey key,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
129 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 );
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 * Creates an iterator for this map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 */
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
135 CxIterator (*iterator)(const CxMap *map, enum cx_map_iterator_type type);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 };
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 * A map entry.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 struct cx_map_entry_s {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 * A pointer to the key.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 */
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
145 const CxHashKey *key;
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 * A pointer to the value.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 void *value;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 };
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 174
diff changeset
152 /**
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 174
diff changeset
153 * A shared instance of an empty map.
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 174
diff changeset
154 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
155 * Writing to that map is not allowed.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
156 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
157 * You can use this is a placeholder for initializing CxMap pointers
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
158 * for which you do not want to reserve memory right from the beginning.
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 174
diff changeset
159 */
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 extern CxMap *const cxEmptyMap;
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 * Advises the map to store copies of the objects (default mode of operation).
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 * Retrieving objects from this map will yield pointers to the copies stored
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 * within this list.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 * @param map the map
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 * @see cxMapStorePointers()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
171 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 static inline void cxMapStoreObjects(CxMap *map) {
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
173 map->collection.store_pointer = false;
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 * Advises the map to only store pointers to the objects.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 * Retrieving objects from this list will yield the original pointers stored.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 * @note This function forcibly sets the element size to the size of a pointer.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 * Invoking this function on a non-empty map that already stores copies of
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 * objects is undefined.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 * @param map the map
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 * @see cxMapStoreObjects()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
188 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 static inline void cxMapStorePointers(CxMap *map) {
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
190 map->collection.store_pointer = true;
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
191 map->collection.elem_size = sizeof(void *);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
194 /**
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
195 * Returns true, if this map is storing pointers instead of the actual data.
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
196 *
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
197 * @param map
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
198 * @return true, if this map is storing pointers
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
199 * @see cxMapStorePointers()
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
200 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
201 cx_attr_nonnull
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
202 static inline bool cxMapIsStoringPointers(const CxMap *map) {
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
203 return map->collection.store_pointer;
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
204 }
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 * Deallocates the memory of the specified map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
209 * Also calls the content destructor functions for each element, if specified.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
210 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
211 * @param map the map to be freed
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
213 void cxMapFree(CxMap *map);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217 * Clears a map by removing all elements.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
219 * Also calls the content destructor functions for each element, if specified.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
220 *
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 * @param map the map to be cleared
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
223 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 static inline void cxMapClear(CxMap *map) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 map->cl->clear(map);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
228 /**
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
229 * Returns the number of elements in this map.
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
230 *
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
231 * @param map the map
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
232 * @return the number of stored elements
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
233 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
234 cx_attr_nonnull
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
235 static inline size_t cxMapSize(const CxMap *map) {
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
236 return map->collection.size;
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
237 }
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
238
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 * Creates a value iterator for a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
242 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 * @return an iterator for the currently stored values
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
248 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
249 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
250 static inline CxIterator cxMapIteratorValues(const CxMap *map) {
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 return map->cl->iterator(map, CX_MAP_ITERATOR_VALUES);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 * Creates a key iterator for a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 * The elements of the iterator are keys of type CxHashKey.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
259 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 * @return an iterator for the currently stored keys
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
265 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
266 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
267 static inline CxIterator cxMapIteratorKeys(const CxMap *map) {
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 return map->cl->iterator(map, CX_MAP_ITERATOR_KEYS);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 * Creates an iterator for a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 * The elements of the iterator are key/value pairs of type CxMapEntry.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
276 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 * @return an iterator for the currently stored entries
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 * @see cxMapIteratorKeys()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 * @see cxMapIteratorValues()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
284 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
285 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
286 static inline CxIterator cxMapIterator(const CxMap *map) {
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 return map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 * Creates a mutating iterator over the values of a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
294 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298 * @return an iterator for the currently stored values
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
300 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
301 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
302 CxIterator cxMapMutIteratorValues(CxMap *map);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305 * Creates a mutating iterator over the keys of a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307 * The elements of the iterator are keys of type CxHashKey.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
309 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 * @return an iterator for the currently stored keys
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
315 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
316 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
317 CxIterator cxMapMutIteratorKeys(CxMap *map);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 * Creates a mutating iterator for a map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 * The elements of the iterator are key/value pairs of type CxMapEntry.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
324 * @note An iterator iterates over all elements successively. Therefore, the order
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 * highly depends on the map implementation and may change arbitrarily when the contents change.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 *
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327 * @param map the map to create the iterator for
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 * @return an iterator for the currently stored entries
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 * @see cxMapMutIteratorKeys()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 * @see cxMapMutIteratorValues()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
332 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
333 cx_attr_nodiscard
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
334 CxIterator cxMapMutIterator(CxMap *map);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 #ifdef __cplusplus
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 } // end the extern "C" block here, because we want to start overloading
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
338 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339 static inline int cxMapPut(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 CxHashKey const &key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 return map->cl->put(map, key, value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
347 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 static inline int cxMapPut(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 cxstring const &key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 return map->cl->put(map, cx_hash_key_cxstr(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
356 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 static inline int cxMapPut(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359 cxmutstr const &key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 return map->cl->put(map, cx_hash_key_cxstr(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
365 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
366 cx_attr_cstr_arg(2)
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 static inline int cxMapPut(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 CxMap *map,
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
369 const char *key,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372 return map->cl->put(map, cx_hash_key_str(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
375 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
376 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 static inline void *cxMapGet(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
378 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 CxHashKey const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381 return map->cl->get(map, key);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
384 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
385 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386 static inline void *cxMapGet(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
387 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
388 cxstring const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
390 return map->cl->get(map, cx_hash_key_cxstr(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
391 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
392
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
393 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
394 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
395 static inline void *cxMapGet(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
396 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
397 cxmutstr const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
399 return map->cl->get(map, cx_hash_key_cxstr(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
400 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
401
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
402 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
403 cx_attr_nodiscard
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
404 cx_attr_cstr_arg(2)
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
405 static inline void *cxMapGet(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
406 const CxMap *map,
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
407 const char *key
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
408 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
409 return map->cl->get(map, cx_hash_key_str(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
410 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
411
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
412 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
413 static inline int cxMapRemove(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
415 CxHashKey const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
416 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
417 return map->cl->remove(map, key, nullptr);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
418 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
419
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
420 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
421 static inline int cxMapRemove(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
422 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
423 cxstring const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
424 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
425 return map->cl->remove(map, cx_hash_key_cxstr(key), nullptr);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
426 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
427
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
428 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
429 static inline int cxMapRemove(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
430 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
431 cxmutstr const &key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
432 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
433 return map->cl->remove(map, cx_hash_key_cxstr(key), nullptr);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
434 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
435
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
436 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
437 cx_attr_cstr_arg(2)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
438 static inline int cxMapRemove(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
439 CxMap *map,
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
440 const char *key
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
441 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
442 return map->cl->remove(map, cx_hash_key_str(key), nullptr);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
443 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
444
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
445 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
446 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
447 static inline int cxMapRemoveAndGet(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
448 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
449 CxHashKey key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
450 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
451 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
452 return map->cl->remove(map, key, targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
453 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
454
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
455 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
456 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
457 static inline int cxMapRemoveAndGet(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
458 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
459 cxstring key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
460 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
461 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
462 return map->cl->remove(map, cx_hash_key_cxstr(key), targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
463 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
464
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
465 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
466 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
467 static inline int cxMapRemoveAndGet(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
468 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
469 cxmutstr key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
470 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
471 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
472 return map->cl->remove(map, cx_hash_key_cxstr(key), targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
473 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
474
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
475 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
476 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
477 cx_attr_cstr_arg(2)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
478 static inline int cxMapRemoveAndGet(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
479 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
480 const char *key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
481 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
482 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
483 return map->cl->remove(map, cx_hash_key_str(key), targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
484 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
485
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
486 #else // __cplusplus
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
487
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
488 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
489 * @copydoc cxMapPut()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
490 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
491 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
492 static inline int cx_map_put(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
493 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
494 CxHashKey key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
495 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
496 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
497 return map->cl->put(map, key, value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
498 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
499
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
500 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
501 * @copydoc cxMapPut()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
502 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
503 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
504 static inline int cx_map_put_cxstr(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
505 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
506 cxstring key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
507 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
508 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
509 return map->cl->put(map, cx_hash_key_cxstr(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
510 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
511
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
512 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
513 * @copydoc cxMapPut()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
514 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
515 cx_attr_nonnull
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
516 static inline int cx_map_put_mustr(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
517 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
518 cxmutstr key,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
519 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
520 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
521 return map->cl->put(map, cx_hash_key_cxstr(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
522 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
523
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
524 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
525 * @copydoc cxMapPut()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
526 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
527 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
528 cx_attr_cstr_arg(2)
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
529 static inline int cx_map_put_str(
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
530 CxMap *map,
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
531 const char *key,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
532 void *value
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
533 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
534 return map->cl->put(map, cx_hash_key_str(key), value);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
535 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
536
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
537 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
538 * Puts a key/value-pair into the map.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
539 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
540 * A possible existing value will be overwritten.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
541 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
542 * If this map is storing pointers, the @p value pointer is written
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
543 * to the map. Otherwise, the memory is copied from @p value with
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
544 * memcpy().
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
545 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
546 * The @p key is always copied.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
547 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
548 * @param map (@c CxMap*) the map
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
549 * @param key (@c CxHashKey, @c char*, @c cxstring, or @c cxmutstr) the key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
550 * @param value (@c void*) the value
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
551 * @retval zero success
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
552 * @retval non-zero value on memory allocation failure
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
553 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
554 #define cxMapPut(map, key, value) _Generic((key), \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
555 CxHashKey: cx_map_put, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
556 cxstring: cx_map_put_cxstr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
557 cxmutstr: cx_map_put_mustr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
558 char*: cx_map_put_str, \
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
559 const char*: cx_map_put_str) \
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
560 (map, key, value)
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
561
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
562 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
563 * @copydoc cxMapGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
564 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
565 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
566 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
567 static inline void *cx_map_get(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
568 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
569 CxHashKey key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
570 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
571 return map->cl->get(map, key);
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
572 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
573
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
574 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
575 * @copydoc cxMapGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
576 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
577 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
578 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
579 static inline void *cx_map_get_cxstr(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
580 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
581 cxstring key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
582 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
583 return map->cl->get(map, cx_hash_key_cxstr(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
584 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
585
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
586 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
587 * @copydoc cxMapGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
588 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
589 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
590 cx_attr_nodiscard
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
591 static inline void *cx_map_get_mustr(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
592 const CxMap *map,
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
593 cxmutstr key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
594 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
595 return map->cl->get(map, cx_hash_key_cxstr(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
596 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
597
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
598 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
599 * @copydoc cxMapGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
600 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
601 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
602 cx_attr_nodiscard
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
603 cx_attr_cstr_arg(2)
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
604 static inline void *cx_map_get_str(
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
605 const CxMap *map,
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
606 const char *key
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
607 ) {
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
608 return map->cl->get(map, cx_hash_key_str(key));
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
609 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
610
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
611 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
612 * Retrieves a value by using a key.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
613 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
614 * If this map is storing pointers, the stored pointer is returned.
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
615 * Otherwise, a pointer to the element within the map's memory
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
616 * is returned (which is valid as long as the element stays in the map).
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
617 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
618 * @param map (@c CxMap*) the map
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
619 * @param key (@c CxHashKey, @c char*, @c cxstring, or @c cxmutstr) the key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
620 * @return (@c void*) the value
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
621 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
622 #define cxMapGet(map, key) _Generic((key), \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
623 CxHashKey: cx_map_get, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
624 cxstring: cx_map_get_cxstr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
625 cxmutstr: cx_map_get_mustr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
626 char*: cx_map_get_str, \
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
627 const char*: cx_map_get_str) \
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
628 (map, key)
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
629
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
630 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
631 * @copydoc cxMapRemove()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
632 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
633 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
634 static inline int cx_map_remove(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
635 CxMap *map,
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
636 CxHashKey key
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
637 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
638 return map->cl->remove(map, key, NULL);
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
639 }
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
640
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
641 /**
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
642 * @copydoc cxMapRemove()
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
643 */
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
644 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
645 static inline int cx_map_remove_cxstr(
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
646 CxMap *map,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
647 cxstring key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
648 ) {
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
649 return map->cl->remove(map, cx_hash_key_cxstr(key), NULL);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
650 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
651
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
652 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
653 * @copydoc cxMapRemove()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
654 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
655 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
656 static inline int cx_map_remove_mustr(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
657 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
658 cxmutstr key
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
659 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
660 return map->cl->remove(map, cx_hash_key_cxstr(key), NULL);
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
661 }
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
662
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
663 /**
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
664 * @copydoc cxMapRemove()
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
665 */
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
666 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
667 cx_attr_cstr_arg(2)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
668 static inline int cx_map_remove_str(
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
669 CxMap *map,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
670 const char *key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
671 ) {
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
672 return map->cl->remove(map, cx_hash_key_str(key), NULL);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
673 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
674
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
675 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
676 * Removes a key/value-pair from the map by using the key.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
677 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
678 * Always invokes the destructors functions, if any, on the removed element.
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
679 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
680 * @param map (@c CxMap*) the map
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
681 * @param key (@c CxHashKey, @c char*, @c cxstring, or @c cxmutstr) the key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
682 * @retval zero success
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
683 * @retval non-zero the key was not found
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
684 *
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
685 * @see cxMapRemoveAndGet()
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
686 */
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
687 #define cxMapRemove(map, key) _Generic((key), \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
688 CxHashKey: cx_map_remove, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
689 cxstring: cx_map_remove_cxstr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
690 cxmutstr: cx_map_remove_mustr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
691 char*: cx_map_remove_str, \
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
692 const char*: cx_map_remove_str) \
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
693 (map, key)
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
694
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
695 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
696 * @copydoc cxMapRemoveAndGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
697 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
698 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
699 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
700 static inline int cx_map_remove_and_get(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
701 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
702 CxHashKey key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
703 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
704 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
705 return map->cl->remove(map, key, targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
706 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
707
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
708 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
709 * @copydoc cxMapRemoveAndGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
710 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
711 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
712 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
713 static inline int cx_map_remove_and_get_cxstr(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
714 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
715 cxstring key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
716 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
717 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
718 return map->cl->remove(map, cx_hash_key_cxstr(key), targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
719 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
720
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
721 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
722 * @copydoc cxMapRemoveAndGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
723 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
724 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
725 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
726 static inline int cx_map_remove_and_get_mustr(
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
727 CxMap *map,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
728 cxmutstr key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
729 void *targetbuf
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
730 ) {
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
731 return map->cl->remove(map, cx_hash_key_cxstr(key), targetbuf);
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
732 }
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
733
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
734 /**
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
735 * @copydoc cxMapRemoveAndGet()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
736 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
737 cx_attr_nonnull
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
738 cx_attr_access_w(3)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
739 cx_attr_cstr_arg(2)
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
740 static inline int cx_map_remove_and_get_str(
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
741 CxMap *map,
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
742 const char *key,
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
743 void *targetbuf
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
744 ) {
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
745 return map->cl->remove(map, cx_hash_key_str(key), targetbuf);
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
746 }
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
747
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
748 /**
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
749 * Removes a key/value-pair from the map by using the key.
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
750 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
751 * This function will copy the contents of the removed element
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
752 * to the target buffer must be guaranteed to be large enough
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
753 * to hold the element (the map's element size).
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
754 * The destructor functions, if any, will @em not be called.
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
755 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
756 * If this map is storing pointers, the element is the pointer itself
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
757 * and not the object it points to.
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
758 *
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
759 * @param map (@c CxMap*) the map
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
760 * @param key (@c CxHashKey, @c char*, @c cxstring, or @c cxmutstr) the key
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
761 * @param targetbuf (@c void*) the buffer where the element shall be copied to
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
762 * @retval zero success
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
763 * @retval non-zero the key was not found
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
764 *
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
765 * @see cxMapStorePointers()
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
766 * @see cxMapRemove()
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
767 */
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
768 #define cxMapRemoveAndGet(map, key, targetbuf) _Generic((key), \
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
769 CxHashKey: cx_map_remove_and_get, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
770 cxstring: cx_map_remove_and_get_cxstr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
771 cxmutstr: cx_map_remove_and_get_mustr, \
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
772 char*: cx_map_remove_and_get_str, \
324
ce13a778654a update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 253
diff changeset
773 const char*: cx_map_remove_and_get_str) \
440
7c4b9cba09ca update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
774 (map, key, targetbuf)
174
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
775
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
776 #endif // __cplusplus
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
777
0358f1d9c506 upgrade ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
778 #endif // UCX_MAP_H

mercurial