1 /****************************************************************************** 2 3 Bindings for Elastic Binary Trees library's operations on 64bit nodes. 4 5 This module contains the D binding of the library functions of eb64tree.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.eb64tree; 26 27 import ocean.util.container.ebtree.c.ebtree: eb_root, eb_node; 28 29 /// See original's library documentation for details. 30 struct eb64_node 31 { 32 eb_node node; // the tree node, must be at the beginning 33 ulong key; 34 35 /// Return next node in the tree, skipping duplicates, or NULL if none 36 37 typeof(&this) next ( ) 38 { 39 return eb64_next(&this); 40 } 41 42 /// Return previous node in the tree, or NULL if none 43 44 typeof(&this) prev ( ) 45 { 46 return eb64_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 eb64_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 eb64_prev_unique(&this); 61 } 62 } 63 64 extern (C): 65 66 ///// Return leftmost node in the tree, or NULL if none 67 eb64_node* eb64_first(eb_root* root); 68 69 /// Return rightmost node in the tree, or NULL if none 70 eb64_node* eb64_last(eb_root* root); 71 72 /// Return next node in the tree, or NULL if none 73 eb64_node* eb64_next(eb64_node* eb64); 74 75 /// Return previous node in the tree, or NULL if none 76 eb64_node* eb64_prev(eb64_node* eb64); 77 78 /// Return next node in the tree, skipping duplicates, or NULL if none 79 eb64_node* eb64_next_unique(eb64_node* eb64); 80 81 /// Return previous node in the tree, skipping duplicates, or NULL if none 82 eb64_node* eb64_prev_unique(eb64_node* eb64); 83 84 /// See original's library documentation for details. 85 void eb64_delete(eb64_node* eb64); 86 87 /// See original's library documentation for details. 88 eb64_node* eb64_lookup(eb_root* root, ulong x); 89 90 /// See original's library documentation for details. 91 eb64_node* eb64i_lookup(eb_root* root, long x); 92 93 /// See original's library documentation for details. 94 eb64_node* eb64_lookup_le(eb_root* root, ulong x); 95 96 /// See original's library documentation for details. 97 eb64_node* eb64_lookup_ge(eb_root* root, ulong x); 98 99 /// See original's library documentation for details. 100 eb64_node* eb64_insert(eb_root* root, eb64_node* neww); 101 102 /// See original's library documentation for details. 103 eb64_node* eb64i_insert(eb_root* root, eb64_node* neww);