Changeset 208db5a in mainline for uspace/lib/c/include/types/adt/odict.h
- Timestamp:
- 2018-10-31T11:05:32Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c70e841
- Parents:
- beb83c1
- git-author:
- Jiri Svoboda <jiri@…> (2018-10-31 06:04:28)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-10-31 11:05:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/types/adt/odict.h
-
Property mode
changed from
100644
to120000
rbeb83c1 r208db5a 1 /* 2 * Copyright (c) 2016 Jiri Svoboda 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup libc 30 * @{ 31 */ 32 /** @file 33 */ 34 35 #ifndef LIBC_TYPES_ODICT_H_ 36 #define LIBC_TYPES_ODICT_H_ 37 38 #include <adt/list.h> 39 40 typedef struct odlink odlink_t; 41 typedef struct odict odict_t; 42 43 typedef void *(*odgetkey_t)(odlink_t *); 44 typedef int (*odcmp_t)(void *, void *); 45 46 typedef enum { 47 odc_black, 48 odc_red 49 } odict_color_t; 50 51 typedef enum { 52 /** Child A */ 53 odcs_a, 54 /** Child B */ 55 odcs_b 56 } odict_child_sel_t; 57 58 /** Ordered dictionary link */ 59 struct odlink { 60 /** Containing dictionary */ 61 odict_t *odict; 62 /** Parent node */ 63 odlink_t *up; 64 /** First child */ 65 odlink_t *a; 66 /** Second child */ 67 odlink_t *b; 68 /** Node color */ 69 odict_color_t color; 70 /** Link to odict->entries */ 71 link_t lentries; 72 }; 73 74 /** Ordered dictionary */ 75 struct odict { 76 /** Root of the tree */ 77 odlink_t *root; 78 /** List of entries in ascending order */ 79 list_t entries; 80 /** Get key operation */ 81 odgetkey_t getkey; 82 /** Compare operation */ 83 odcmp_t cmp; 84 }; 85 86 #endif 87 88 /** @} 89 */ 1 ../../../../../../kernel/generic/include/types/adt/odict.h -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.