2 * Copyright (c) 2011 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 struct hmap_node hmap_node;
27 /* A set of "void *" pointers. */
32 #define HMAPX_INITIALIZER(HMAPX) { HMAP_INITIALIZER(&(HMAPX)->map) }
35 void hmapx_init(struct hmapx *);
36 void hmapx_destroy(struct hmapx *);
37 void hmapx_clone(struct hmapx *, const struct hmapx *);
38 void hmapx_swap(struct hmapx *, struct hmapx *);
39 void hmapx_moved(struct hmapx *);
42 bool hmapx_is_empty(const struct hmapx *);
43 size_t hmapx_count(const struct hmapx *);
46 struct hmapx_node *hmapx_add(struct hmapx *, void *);
47 void hmapx_add_assert(struct hmapx *, void *);
50 void hmapx_clear(struct hmapx *);
51 void hmapx_delete(struct hmapx *, struct hmapx_node *);
52 bool hmapx_find_and_delete(struct hmapx *, const void *);
53 void hmapx_find_and_delete_assert(struct hmapx *, const void *);
56 struct hmapx_node *hmapx_find(const struct hmapx *, const void *);
57 bool hmapx_contains(const struct hmapx *, const void *);
58 bool hmapx_equals(const struct hmapx *, const struct hmapx *);
62 /* Iterates through every hmapx_node in HMAPX. */
63 #define HMAPX_FOR_EACH(NODE, HMAPX) \
64 HMAP_FOR_EACH(NODE, hmap_node, &(HMAPX)->map)
66 /* Safe when NODE may be freed (not needed when NODE may be removed from the
67 * hash map but its members remain accessible and intact). */
68 #define HMAPX_FOR_EACH_SAFE(NODE, NEXT, HMAPX) \
69 HMAP_FOR_EACH_SAFE(NODE, NEXT, hmap_node, &(HMAPX)->map)