X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fsset.h;h=625cea987a6563dda5a028f5868d8db6fc7e19de;hb=05f453a895297bd53f18554126048184bcbf1723;hp=a739fce00c75357e9f8d4563cac42c4698fb04a2;hpb=43d1478b1690ecd0ef6b63890bc13438c1914e47;p=sliver-openvswitch.git diff --git a/lib/sset.h b/lib/sset.h index a739fce00..625cea987 100644 --- a/lib/sset.h +++ b/lib/sset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Nicira Networks. + * Copyright (c) 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #define SSET_H #include "hmap.h" +#include "util.h" #ifdef __cplusplus extern "C" { @@ -63,6 +64,8 @@ char *sset_pop(struct sset *); struct sset_node *sset_find(const struct sset *, const char *); bool sset_contains(const struct sset *, const char *); bool sset_equals(const struct sset *, const struct sset *); +struct sset_node *sset_at_position(const struct sset *, + uint32_t *bucketp, uint32_t *offsetp); /* Iteration macros. */ #define SSET_FOR_EACH(NAME, SSET) \ @@ -76,13 +79,15 @@ bool sset_equals(const struct sset *, const struct sset *); ? (NEXT) = SSET_NEXT(SSET, NAME), true \ : false); \ (NAME) = (NEXT)) + +const char **sset_sort(const struct sset *); /* Implementation helper macros. */ #define SSET_NODE_FROM_HMAP_NODE(HMAP_NODE) \ CONTAINER_OF(HMAP_NODE, struct sset_node, hmap_node) #define SSET_NAME_FROM_HMAP_NODE(HMAP_NODE) \ - ((const char *) (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name)) + (CONST_CAST(const char *, (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name))) #define SSET_NODE_FROM_NAME(NAME) CONTAINER_OF(NAME, struct sset_node, name) #define SSET_FIRST(SSET) SSET_NAME_FROM_HMAP_NODE(hmap_first(&(SSET)->map)) #define SSET_NEXT(SSET, NAME) \