1 /****************************************************************************** 2 3 Bindings for Elastic Binary Trees library's operations on 32bit nodes. 4 5 This module contains the D binding of the library functions of eb32tree.h. 6 Please consult the original header documentation for details. 7 8 You need to have the library installed and link with -lebtree. 9 10 Copyright: 11 Copyright (c) 2009-2016 dunnhumby Germany GmbH. 12 All rights reserved. 13 14 License: 15 Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. 16 Alternatively, this file may be distributed under the terms of the Tango 17 3-Clause BSD License (see LICENSE_BSD.txt for details). 18 19 Bear in mind this module provides bindings to an external library that 20 has its own license, which might be more restrictive. Please check the 21 external library license to see which conditions apply for linking. 22 23 ******************************************************************************/ 24 25 module ocean.util.container.ebtree.c.eb32tree; 26 27 import ocean.util.container.ebtree.c.ebtree: eb_root, eb_node; 28 29 /// See original's library documentation for details. 30 struct eb32_node 31 { 32 eb_node node; // the tree node, must be at the beginning 33 uint key; 34 35 /// Return next node in the tree, skipping duplicates, or NULL if none 36 37 typeof(&this) next ( ) 38 { 39 return eb32_next(&this); 40 } 41 42 /// Return previous node in the tree, or NULL if none 43 44 typeof(&this) prev ( ) 45 { 46 return eb32_prev(&this); 47 } 48 49 /// Return next node in the tree, skipping duplicates, or NULL if none 50 51 typeof(&this) next_unique ( ) 52 { 53 return eb32_next_unique(&this); 54 } 55 56 /// Return previous node in the tree, skipping duplicates, or NULL if none 57 58 typeof(&this) prev_unique ( ) 59 { 60 return eb32_prev_unique(&this); 61 } 62 } 63 64 extern (C): 65 66 /// Return leftmost node in the tree, or NULL if none 67 eb32_node* eb32_first(eb_root* root); 68 69 /// Return rightmost node in the tree, or NULL if none 70 eb32_node* eb32_last(eb_root* root); 71 72 /// Return next node in the tree, or NULL if none 73 eb32_node* eb32_next(eb32_node* eb32); 74 75 /// Return previous node in the tree, or NULL if none 76 eb32_node* eb32_prev(eb32_node* eb32); 77 78 /// Return next node in the tree, skipping duplicates, or NULL if none 79 eb32_node* eb32_next_unique(eb32_node* eb32); 80 81 /// Return previous node in the tree, skipping duplicates, or NULL if none 82 eb32_node* eb32_prev_unique(eb32_node* eb32); 83 84 /// See original's library documentation for details. 85 void eb32_delete(eb32_node* eb32); 86 87 /// See original's library documentation for details. 88 eb32_node* eb32_lookup(eb_root* root, uint x); 89 90 /// See original's library documentation for details. 91 eb32_node* eb32i_lookup(eb_root* root, int x); 92 93 /// See original's library documentation for details. 94 eb32_node* eb32_lookup_le(eb_root* root, uint x); 95 96 /// See original's library documentation for details. 97 eb32_node* eb32_lookup_ge(eb_root* root, uint x); 98 99 /// See original's library documentation for details. 100 eb32_node* eb32_insert(eb_root* root, eb32_node* neww); 101 102 /// See original's library documentation for details. 103 eb32_node* eb32i_insert(eb_root* root, eb32_node* neww);