Permalink
Fetching contributors…
Cannot retrieve contributors at this time
718 lines (700 sloc) 101 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>STX B+ Tree Template Classes: stx/btree_multimap.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">STX B+ Tree Template Classes
&#160;<span id="projectnumber">0.9</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">stx/btree_multimap.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="a00030.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/** \file btree_multimap.h</span>
<a name="l00002"></a>00002 <span class="comment"> * Contains the specialized B+ tree template class btree_multimap</span>
<a name="l00003"></a>00003 <span class="comment"> */</span>
<a name="l00004"></a>00004
<a name="l00005"></a>00005 <span class="comment">/*</span>
<a name="l00006"></a>00006 <span class="comment"> * STX B+ Tree Template Classes v0.9</span>
<a name="l00007"></a>00007 <span class="comment"> * Copyright (C) 2008-2013 Timo Bingmann</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Boost Software License - Version 1.0 - August 17th, 2003</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * Permission is hereby granted, free of charge, to any person or organization</span>
<a name="l00012"></a>00012 <span class="comment"> * obtaining a copy of the software and accompanying documentation covered by</span>
<a name="l00013"></a>00013 <span class="comment"> * this license (the &quot;Software&quot;) to use, reproduce, display, distribute,</span>
<a name="l00014"></a>00014 <span class="comment"> * execute, and transmit the Software, and to prepare derivative works of the</span>
<a name="l00015"></a>00015 <span class="comment"> * Software, and to permit third-parties to whom the Software is furnished to</span>
<a name="l00016"></a>00016 <span class="comment"> * do so, all subject to the following:</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * The copyright notices in the Software and this entire statement, including</span>
<a name="l00019"></a>00019 <span class="comment"> * the above license grant, this restriction and the following disclaimer, must</span>
<a name="l00020"></a>00020 <span class="comment"> * be included in all copies of the Software, in whole or in part, and all</span>
<a name="l00021"></a>00021 <span class="comment"> * derivative works of the Software, unless such copies or derivative works are</span>
<a name="l00022"></a>00022 <span class="comment"> * solely in the form of machine-executable object code generated by a source</span>
<a name="l00023"></a>00023 <span class="comment"> * language processor.</span>
<a name="l00024"></a>00024 <span class="comment"> *</span>
<a name="l00025"></a>00025 <span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
<a name="l00026"></a>00026 <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
<a name="l00027"></a>00027 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT</span>
<a name="l00028"></a>00028 <span class="comment"> * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE</span>
<a name="l00029"></a>00029 <span class="comment"> * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,</span>
<a name="l00030"></a>00030 <span class="comment"> * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
<a name="l00031"></a>00031 <span class="comment"> * DEALINGS IN THE SOFTWARE.</span>
<a name="l00032"></a>00032 <span class="comment"> */</span>
<a name="l00033"></a>00033
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef _STX_BTREE_MULTIMAP_H_</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define _STX_BTREE_MULTIMAP_H_</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="a00026.html" title="Contains the main B+ tree implementation template class btree.">stx/btree.h</a>&gt;</span>
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="keyword">namespace </span>stx {
<a name="l00040"></a>00040 <span class="comment"></span>
<a name="l00041"></a>00041 <span class="comment">/** @brief Specialized B+ tree template class implementing STL&#39;s multimap</span>
<a name="l00042"></a>00042 <span class="comment"> * container.</span>
<a name="l00043"></a>00043 <span class="comment"> *</span>
<a name="l00044"></a>00044 <span class="comment"> * Implements the STL multimap using a B+ tree. It can be used as a drop-in</span>
<a name="l00045"></a>00045 <span class="comment"> * replacement for std::multimap. Not all asymptotic time requirements are met</span>
<a name="l00046"></a>00046 <span class="comment"> * in theory. The class has a traits class defining B+ tree properties like</span>
<a name="l00047"></a>00047 <span class="comment"> * slots and self-verification. Furthermore an allocator can be specified for</span>
<a name="l00048"></a>00048 <span class="comment"> * tree nodes.</span>
<a name="l00049"></a>00049 <span class="comment"> *</span>
<a name="l00050"></a>00050 <span class="comment"> * Most noteworthy difference to the default red-black implementation of</span>
<a name="l00051"></a>00051 <span class="comment"> * std::multimap is that the B+ tree does not hold key and data pair together</span>
<a name="l00052"></a>00052 <span class="comment"> * in memory. Instead each B+ tree node has two arrays of keys and data</span>
<a name="l00053"></a>00053 <span class="comment"> * values. This design directly generates many problems in implementing the</span>
<a name="l00054"></a>00054 <span class="comment"> * iterator&#39;s operator&#39;s which return value_type composition pairs.</span>
<a name="l00055"></a>00055 <span class="comment"> */</span>
<a name="l00056"></a>00056 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _Key, <span class="keyword">typename</span> _Data,
<a name="l00057"></a>00057 <span class="keyword">typename</span> _Compare = std::less&lt;_Key&gt;,
<a name="l00058"></a>00058 <span class="keyword">typename</span> _Traits = btree_default_map_traits&lt;_Key, _Data&gt;,
<a name="l00059"></a>00059 <span class="keyword">typename</span> _Alloc = std::allocator&lt;std::pair&lt;_Key, _Data&gt; &gt; &gt;
<a name="l00060"></a><a class="code" href="a00005.html">00060</a> <span class="keyword">class </span><a class="code" href="a00005.html" title="Specialized B+ tree template class implementing STL&#39;s multimap container.">btree_multimap</a>
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 <span class="keyword">public</span>:
<a name="l00063"></a>00063 <span class="comment">// *** Template Parameter Types</span>
<a name="l00064"></a>00064 <span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment"> /// First template parameter: The key type of the btree. This is stored in</span>
<a name="l00066"></a>00066 <span class="comment"> /// inner nodes and leaves</span>
<a name="l00067"></a><a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8">00067</a> <span class="comment"></span> <span class="keyword">typedef</span> _Key <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>;
<a name="l00068"></a>00068 <span class="comment"></span>
<a name="l00069"></a>00069 <span class="comment"> /// Second template parameter: The data type associated with each</span>
<a name="l00070"></a>00070 <span class="comment"> /// key. Stored in the B+ tree&#39;s leaves</span>
<a name="l00071"></a><a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299">00071</a> <span class="comment"></span> <span class="keyword">typedef</span> _Data <a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299" title="Second template parameter: The data type associated with each key.">data_type</a>;
<a name="l00072"></a>00072 <span class="comment"></span>
<a name="l00073"></a>00073 <span class="comment"> /// Third template parameter: Key comparison function object</span>
<a name="l00074"></a><a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012">00074</a> <span class="comment"></span> <span class="keyword">typedef</span> _Compare <a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012" title="Third template parameter: Key comparison function object.">key_compare</a>;
<a name="l00075"></a>00075 <span class="comment"></span>
<a name="l00076"></a>00076 <span class="comment"> /// Fourth template parameter: Traits object used to define more parameters</span>
<a name="l00077"></a>00077 <span class="comment"> /// of the B+ tree</span>
<a name="l00078"></a><a class="code" href="a00005.html#a1156d87c06fbc9814828d9a83b717c0e">00078</a> <span class="comment"></span> <span class="keyword">typedef</span> _Traits <a class="code" href="a00005.html#a1156d87c06fbc9814828d9a83b717c0e" title="Fourth template parameter: Traits object used to define more parameters of the B+ tree...">traits</a>;
<a name="l00079"></a>00079 <span class="comment"></span>
<a name="l00080"></a>00080 <span class="comment"> /// Fifth template parameter: STL allocator</span>
<a name="l00081"></a><a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568">00081</a> <span class="comment"></span> <span class="keyword">typedef</span> _Alloc <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>;
<a name="l00082"></a>00082
<a name="l00083"></a>00083 <span class="comment">// The macro BTREE_FRIENDS can be used by outside class to access the B+</span>
<a name="l00084"></a>00084 <span class="comment">// tree internals. This was added for wxBTreeDemo to be able to draw the</span>
<a name="l00085"></a>00085 <span class="comment">// tree.</span>
<a name="l00086"></a>00086 <a class="code" href="a00026.html#aec07a93b351ce398f789007a441a4320" title="The macro BTREE_FRIENDS can be used by outside class to access the B+ tree internals.">BTREE_FRIENDS</a>
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <span class="keyword">public</span>:
<a name="l00089"></a>00089 <span class="comment">// *** Constructed Types</span>
<a name="l00090"></a>00090 <span class="comment"></span>
<a name="l00091"></a>00091 <span class="comment"> /// Typedef of our own type</span>
<a name="l00092"></a><a class="code" href="a00005.html#aae5bae110a73423fd534e6d9e769a23a">00092</a> <span class="comment"></span> <span class="keyword">typedef</span> <a class="code" href="a00005.html" title="Specialized B+ tree template class implementing STL&#39;s multimap container.">btree_multimap&lt;key_type, data_type, key_compare, traits, allocator_type&gt;</a> <span class="keyword">self</span>;
<a name="l00093"></a>00093 <span class="comment"></span>
<a name="l00094"></a>00094 <span class="comment"> /// Construct the STL-required value_type as a composition pair of key and</span>
<a name="l00095"></a>00095 <span class="comment"> /// data types</span>
<a name="l00096"></a><a class="code" href="a00005.html#aa9c86e804b95247c742db5ad7b9351fe">00096</a> <span class="comment"></span> <span class="keyword">typedef</span> std::pair&lt;key_type, data_type&gt; <a class="code" href="a00005.html#aa9c86e804b95247c742db5ad7b9351fe" title="Construct the STL-required value_type as a composition pair of key and data types.">value_type</a>;
<a name="l00097"></a>00097 <span class="comment"></span>
<a name="l00098"></a>00098 <span class="comment"> /// Implementation type of the btree_base</span>
<a name="l00099"></a>00099 <span class="comment"></span> <span class="keyword">typedef</span> <a class="code" href="a00001.html" title="Basic class implementing a base B+ tree data structure in memory.">stx::btree</a>&lt;<a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>, <a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299" title="Second template parameter: The data type associated with each key.">data_type</a>, <a class="code" href="a00005.html#aa9c86e804b95247c742db5ad7b9351fe" title="Construct the STL-required value_type as a composition pair of key and data types.">value_type</a>, <a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012" title="Third template parameter: Key comparison function object.">key_compare</a>,
<a name="l00100"></a><a class="code" href="a00005.html#a3d8a91cbf60c0ae367ea7430e2e7b973">00100</a> <a class="code" href="a00005.html#a1156d87c06fbc9814828d9a83b717c0e" title="Fourth template parameter: Traits object used to define more parameters of the B+ tree...">traits</a>, <span class="keyword">true</span>, <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>, <span class="keyword">false</span>&gt; <a class="code" href="a00005.html#a3d8a91cbf60c0ae367ea7430e2e7b973" title="Implementation type of the btree_base.">btree_impl</a>;
<a name="l00101"></a>00101 <span class="comment"></span>
<a name="l00102"></a>00102 <span class="comment"> /// Function class comparing two value_type pairs.</span>
<a name="l00103"></a><a class="code" href="a00005.html#aaf6e0051b191679e462a0f4f8fd49f93">00103</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::value_compare <a class="code" href="a00005.html#aaf6e0051b191679e462a0f4f8fd49f93" title="Function class comparing two value_type pairs.">value_compare</a>;
<a name="l00104"></a>00104 <span class="comment"></span>
<a name="l00105"></a>00105 <span class="comment"> /// Size type used to count keys</span>
<a name="l00106"></a><a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4">00106</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="a00001.html#aa692f5303dd2c4fee4958cbbfc3db5da" title="Size type used to count keys.">btree_impl::size_type</a> <a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4" title="Size type used to count keys.">size_type</a>;
<a name="l00107"></a>00107 <span class="comment"></span>
<a name="l00108"></a>00108 <span class="comment"> /// Small structure containing statistics about the tree</span>
<a name="l00109"></a><a class="code" href="a00005.html#ac5b2a55d1982b407a1075b9474c0d986">00109</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::tree_stats <a class="code" href="a00005.html#ac5b2a55d1982b407a1075b9474c0d986" title="Small structure containing statistics about the tree.">tree_stats</a>;
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <span class="keyword">public</span>:
<a name="l00112"></a>00112 <span class="comment">// *** Static Constant Options and Values of the B+ Tree</span>
<a name="l00113"></a>00113 <span class="comment"></span>
<a name="l00114"></a>00114 <span class="comment"> /// Base B+ tree parameter: The number of key/data slots in each leaf</span>
<a name="l00115"></a><a class="code" href="a00005.html#a5c4b3099fb62acea6118e4700de3d62b">00115</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="a00005.html#a5c4b3099fb62acea6118e4700de3d62b" title="Base B+ tree parameter: The number of key/data slots in each leaf.">leafslotmax</a> = <a class="code" href="a00001.html#ac6c274f39fce8e14f6a881fc1da39cf8" title="Base B+ tree parameter: The number of key/data slots in each leaf.">btree_impl::leafslotmax</a>;
<a name="l00116"></a>00116 <span class="comment"></span>
<a name="l00117"></a>00117 <span class="comment"> /// Base B+ tree parameter: The number of key slots in each inner node,</span>
<a name="l00118"></a>00118 <span class="comment"> /// this can differ from slots in each leaf.</span>
<a name="l00119"></a><a class="code" href="a00005.html#a3b9667a0290d4edcc1e5218f9a3a9a68">00119</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="a00005.html#a3b9667a0290d4edcc1e5218f9a3a9a68" title="Base B+ tree parameter: The number of key slots in each inner node, this can differ from slots in eac...">innerslotmax</a> = <a class="code" href="a00001.html#a78ae296638b9d6961f9101ddf45bf3e0" title="Base B+ tree parameter: The number of key slots in each inner node, this can differ from slots in eac...">btree_impl::innerslotmax</a>;
<a name="l00120"></a>00120 <span class="comment"></span>
<a name="l00121"></a>00121 <span class="comment"> /// Computed B+ tree parameter: The minimum number of key/data slots used</span>
<a name="l00122"></a>00122 <span class="comment"> /// in a leaf. If fewer slots are used, the leaf will be merged or slots</span>
<a name="l00123"></a>00123 <span class="comment"> /// shifted from it&#39;s siblings.</span>
<a name="l00124"></a><a class="code" href="a00005.html#a1a58b9466f1025afe1443fffda360300">00124</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="a00005.html#a1a58b9466f1025afe1443fffda360300" title="Computed B+ tree parameter: The minimum number of key/data slots used in a leaf.">minleafslots</a> = <a class="code" href="a00001.html#ad8525611bf3b079ca4ab13dbab9b23c0" title="Computed B+ tree parameter: The minimum number of key/data slots used in a leaf.">btree_impl::minleafslots</a>;
<a name="l00125"></a>00125 <span class="comment"></span>
<a name="l00126"></a>00126 <span class="comment"> /// Computed B+ tree parameter: The minimum number of key slots used</span>
<a name="l00127"></a>00127 <span class="comment"> /// in an inner node. If fewer slots are used, the inner node will be</span>
<a name="l00128"></a>00128 <span class="comment"> /// merged or slots shifted from it&#39;s siblings.</span>
<a name="l00129"></a><a class="code" href="a00005.html#a0a8dc7c50bc26002a6cacdfff86167cf">00129</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="a00005.html#a0a8dc7c50bc26002a6cacdfff86167cf" title="Computed B+ tree parameter: The minimum number of key slots used in an inner node.">mininnerslots</a> = <a class="code" href="a00001.html#aefbcc95b60d5bae8dd7ba9c25e5b6654" title="Computed B+ tree parameter: The minimum number of key slots used in an inner node.">btree_impl::mininnerslots</a>;
<a name="l00130"></a>00130 <span class="comment"></span>
<a name="l00131"></a>00131 <span class="comment"> /// Debug parameter: Enables expensive and thorough checking of the B+ tree</span>
<a name="l00132"></a>00132 <span class="comment"> /// invariants after each insert/erase operation.</span>
<a name="l00133"></a><a class="code" href="a00005.html#aefab8e1341d14a1738961ecaf38c8d63">00133</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#aefab8e1341d14a1738961ecaf38c8d63" title="Debug parameter: Enables expensive and thorough checking of the B+ tree invariants after each insert/...">selfverify</a> = <a class="code" href="a00001.html#a598601fa16cfb97b8b60a4eae6bde5ae" title="Debug parameter: Enables expensive and thorough checking of the B+ tree invariants after each insert/...">btree_impl::selfverify</a>;
<a name="l00134"></a>00134 <span class="comment"></span>
<a name="l00135"></a>00135 <span class="comment"> /// Debug parameter: Prints out lots of debug information about how the</span>
<a name="l00136"></a>00136 <span class="comment"> /// algorithms change the tree. Requires the header file to be compiled</span>
<a name="l00137"></a>00137 <span class="comment"> /// with BTREE_DEBUG and the key type must be std::ostream printable.</span>
<a name="l00138"></a><a class="code" href="a00005.html#ae6acad1234b0b3ff715884ecbbda2ac7">00138</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#ae6acad1234b0b3ff715884ecbbda2ac7" title="Debug parameter: Prints out lots of debug information about how the algorithms change the tree...">debug</a> = <a class="code" href="a00001.html#a224f31a88d50490e14f0f291d70ef2fc" title="Debug parameter: Prints out lots of debug information about how the algorithms change the tree...">btree_impl::debug</a>;
<a name="l00139"></a>00139 <span class="comment"></span>
<a name="l00140"></a>00140 <span class="comment"> /// Operational parameter: Allow duplicate keys in the btree.</span>
<a name="l00141"></a><a class="code" href="a00005.html#abdf2f0d71029020565eb3c9df2a71db6">00141</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#abdf2f0d71029020565eb3c9df2a71db6" title="Operational parameter: Allow duplicate keys in the btree.">allow_duplicates</a> = <a class="code" href="a00001.html#acd41575a35d1c5d55e955aafc9762454" title="Sixth template parameter: Allow duplicate keys in the B+ tree.">btree_impl::allow_duplicates</a>;
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="keyword">public</span>:
<a name="l00144"></a>00144 <span class="comment">// *** Iterators and Reverse Iterators</span>
<a name="l00145"></a>00145 <span class="comment"></span>
<a name="l00146"></a>00146 <span class="comment"> /// STL-like iterator object for B+ tree items. The iterator points to a</span>
<a name="l00147"></a>00147 <span class="comment"> /// specific slot number in a leaf.</span>
<a name="l00148"></a><a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322">00148</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::iterator <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a>;
<a name="l00149"></a>00149 <span class="comment"></span>
<a name="l00150"></a>00150 <span class="comment"> /// STL-like iterator object for B+ tree items. The iterator points to a</span>
<a name="l00151"></a>00151 <span class="comment"> /// specific slot number in a leaf.</span>
<a name="l00152"></a><a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246">00152</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::const_iterator <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a>;
<a name="l00153"></a>00153 <span class="comment"></span>
<a name="l00154"></a>00154 <span class="comment"> /// create mutable reverse iterator by using STL magic</span>
<a name="l00155"></a><a class="code" href="a00005.html#aa54a3a740748e22fae3b05f599458863">00155</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::reverse_iterator <a class="code" href="a00005.html#aa54a3a740748e22fae3b05f599458863" title="create mutable reverse iterator by using STL magic">reverse_iterator</a>;
<a name="l00156"></a>00156 <span class="comment"></span>
<a name="l00157"></a>00157 <span class="comment"> /// create constant reverse iterator by using STL magic</span>
<a name="l00158"></a><a class="code" href="a00005.html#a0af611010281b93a36b1b0fd3fd2144a">00158</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">typename</span> btree_impl::const_reverse_iterator <a class="code" href="a00005.html#a0af611010281b93a36b1b0fd3fd2144a" title="create constant reverse iterator by using STL magic">const_reverse_iterator</a>;
<a name="l00159"></a>00159
<a name="l00160"></a>00160 <span class="keyword">private</span>:
<a name="l00161"></a>00161 <span class="comment">// *** Tree Implementation Object</span>
<a name="l00162"></a>00162 <span class="comment"></span>
<a name="l00163"></a>00163 <span class="comment"> /// The contained implementation object</span>
<a name="l00164"></a><a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e">00164</a> <span class="comment"></span> <a class="code" href="a00001.html">btree_impl</a> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>;
<a name="l00165"></a>00165
<a name="l00166"></a>00166 <span class="keyword">public</span>:
<a name="l00167"></a>00167 <span class="comment">// *** Constructors and Destructor</span>
<a name="l00168"></a>00168 <span class="comment"></span>
<a name="l00169"></a>00169 <span class="comment"> /// Default constructor initializing an empty B+ tree with the standard key</span>
<a name="l00170"></a>00170 <span class="comment"> /// comparison function</span>
<a name="l00171"></a><a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c">00171</a> <span class="comment"></span> <span class="keyword">explicit</span> <span class="keyword">inline</span> <a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c" title="Default constructor initializing an empty B+ tree with the standard key comparison function...">btree_multimap</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a> &amp;alloc = <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>())
<a name="l00172"></a>00172 : <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>(alloc)
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175 <span class="comment"></span>
<a name="l00176"></a>00176 <span class="comment"> /// Constructor initializing an empty B+ tree with a special key</span>
<a name="l00177"></a>00177 <span class="comment"> /// comparison object</span>
<a name="l00178"></a><a class="code" href="a00005.html#aa364ef57b237fb7c633346b3b42f9db3">00178</a> <span class="comment"></span> <span class="keyword">explicit</span> <span class="keyword">inline</span> <a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c" title="Default constructor initializing an empty B+ tree with the standard key comparison function...">btree_multimap</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012" title="Third template parameter: Key comparison function object.">key_compare</a> &amp;kcf,
<a name="l00179"></a>00179 <span class="keyword">const</span> <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a> &amp;alloc = <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>())
<a name="l00180"></a>00180 : <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>(kcf, alloc)
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 <span class="comment"></span>
<a name="l00184"></a>00184 <span class="comment"> /// Constructor initializing a B+ tree with the range [first,last)</span>
<a name="l00185"></a>00185 <span class="comment"></span> <span class="keyword">template</span> &lt;<span class="keyword">class</span> InputIterator&gt;
<a name="l00186"></a><a class="code" href="a00005.html#a3c52e5b56314500448e3262670ab1e75">00186</a> <span class="keyword">inline</span> <a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c" title="Default constructor initializing an empty B+ tree with the standard key comparison function...">btree_multimap</a>(InputIterator first, InputIterator last,
<a name="l00187"></a>00187 <span class="keyword">const</span> <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a> &amp;alloc = <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>())
<a name="l00188"></a>00188 : <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>(first, last, alloc)
<a name="l00189"></a>00189 {
<a name="l00190"></a>00190 }
<a name="l00191"></a>00191 <span class="comment"></span>
<a name="l00192"></a>00192 <span class="comment"> /// Constructor initializing a B+ tree with the range [first,last) and a</span>
<a name="l00193"></a>00193 <span class="comment"> /// special key comparison object</span>
<a name="l00194"></a>00194 <span class="comment"></span> <span class="keyword">template</span> &lt;<span class="keyword">class</span> InputIterator&gt;
<a name="l00195"></a><a class="code" href="a00005.html#ae32115eb2997acfb493f10421355e953">00195</a> <span class="keyword">inline</span> <a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c" title="Default constructor initializing an empty B+ tree with the standard key comparison function...">btree_multimap</a>(InputIterator first, InputIterator last, <span class="keyword">const</span> <a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012" title="Third template parameter: Key comparison function object.">key_compare</a> &amp;kcf,
<a name="l00196"></a>00196 <span class="keyword">const</span> <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a> &amp;alloc = <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a>())
<a name="l00197"></a>00197 : <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>(first, last, kcf, alloc)
<a name="l00198"></a>00198 {
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 <span class="comment"></span>
<a name="l00201"></a>00201 <span class="comment"> /// Frees up all used B+ tree memory pages</span>
<a name="l00202"></a><a class="code" href="a00005.html#a67e377caa7e95aafe58620dd0687a2ab">00202</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a67e377caa7e95aafe58620dd0687a2ab" title="Frees up all used B+ tree memory pages.">~btree_multimap</a>()
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 <span class="comment"></span>
<a name="l00206"></a>00206 <span class="comment"> /// Fast swapping of two identical B+ tree objects.</span>
<a name="l00207"></a><a class="code" href="a00005.html#a5fedcb02d137aa7c270aa79d67bbe726">00207</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a5fedcb02d137aa7c270aa79d67bbe726" title="Fast swapping of two identical B+ tree objects.">swap</a>(<span class="keyword">self</span>&amp; from)
<a name="l00208"></a>00208 {
<a name="l00209"></a>00209 <a class="code" href="a00005.html#a5fedcb02d137aa7c270aa79d67bbe726" title="Fast swapping of two identical B+ tree objects.">std::swap</a>(<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>, from.tree);
<a name="l00210"></a>00210 }
<a name="l00211"></a>00211
<a name="l00212"></a>00212 <span class="keyword">public</span>:
<a name="l00213"></a>00213 <span class="comment">// *** Key and Value Comparison Function Objects</span>
<a name="l00214"></a>00214 <span class="comment"></span>
<a name="l00215"></a>00215 <span class="comment"> /// Constant access to the key comparison object sorting the B+ tree</span>
<a name="l00216"></a><a class="code" href="a00005.html#abd05c6ac64de9889b2ed8888be6ca3e8">00216</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#abedfcc2e864fadba606bd3c42b278012" title="Third template parameter: Key comparison function object.">key_compare</a> <a class="code" href="a00005.html#abd05c6ac64de9889b2ed8888be6ca3e8" title="Constant access to the key comparison object sorting the B+ tree.">key_comp</a>()<span class="keyword"> const</span>
<a name="l00217"></a>00217 <span class="keyword"> </span>{
<a name="l00218"></a>00218 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a6200a8a00989f77f053e1200da7f816b" title="Constant access to the key comparison object sorting the B+ tree.">key_comp</a>();
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220 <span class="comment"></span>
<a name="l00221"></a>00221 <span class="comment"> /// Constant access to a constructed value_type comparison object. required</span>
<a name="l00222"></a>00222 <span class="comment"> /// by the STL</span>
<a name="l00223"></a><a class="code" href="a00005.html#aa5f97381439395bc58d0f1beae6cce59">00223</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#aaf6e0051b191679e462a0f4f8fd49f93" title="Function class comparing two value_type pairs.">value_compare</a> <a class="code" href="a00005.html#aa5f97381439395bc58d0f1beae6cce59" title="Constant access to a constructed value_type comparison object.">value_comp</a>()<span class="keyword"> const</span>
<a name="l00224"></a>00224 <span class="keyword"> </span>{
<a name="l00225"></a>00225 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a35152f783bc65c97504cd22d1812f673" title="Constant access to a constructed value_type comparison object.">value_comp</a>();
<a name="l00226"></a>00226 }
<a name="l00227"></a>00227
<a name="l00228"></a>00228 <span class="keyword">public</span>:
<a name="l00229"></a>00229 <span class="comment">// *** Allocators</span>
<a name="l00230"></a>00230 <span class="comment"></span>
<a name="l00231"></a>00231 <span class="comment"> /// Return the base node allocator provided during construction.</span>
<a name="l00232"></a><a class="code" href="a00005.html#af3b5134ebb847dc69e3faa5e17094ecb">00232</a> <span class="comment"></span> <a class="code" href="a00005.html#abd0de8807a5e19e3610d8f2dcf803568" title="Fifth template parameter: STL allocator.">allocator_type</a> <a class="code" href="a00005.html#af3b5134ebb847dc69e3faa5e17094ecb" title="Return the base node allocator provided during construction.">get_allocator</a>()<span class="keyword"> const</span>
<a name="l00233"></a>00233 <span class="keyword"> </span>{
<a name="l00234"></a>00234 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#ad7b097e1a4301e319d8a7e6f6bb661fd" title="Return the base node allocator provided during construction.">get_allocator</a>();
<a name="l00235"></a>00235 }
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <span class="keyword">public</span>:
<a name="l00238"></a>00238 <span class="comment">// *** Fast Destruction of the B+ Tree</span>
<a name="l00239"></a>00239 <span class="comment"></span>
<a name="l00240"></a>00240 <span class="comment"> /// Frees all key/data pairs and all nodes of the tree</span>
<a name="l00241"></a><a class="code" href="a00005.html#add3d1d6cad6d331313d1821dbddda9f3">00241</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#add3d1d6cad6d331313d1821dbddda9f3" title="Frees all key/data pairs and all nodes of the tree.">clear</a>()
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#aa2acf975007740100b9803fcea573036" title="Frees all key/data pairs and all nodes of the tree.">clear</a>();
<a name="l00244"></a>00244 }
<a name="l00245"></a>00245
<a name="l00246"></a>00246 <span class="keyword">public</span>:
<a name="l00247"></a>00247 <span class="comment">// *** STL Iterator Construction Functions</span>
<a name="l00248"></a>00248 <span class="comment"></span>
<a name="l00249"></a>00249 <span class="comment"> /// Constructs a read/data-write iterator that points to the first slot in</span>
<a name="l00250"></a>00250 <span class="comment"> /// the first leaf of the B+ tree.</span>
<a name="l00251"></a><a class="code" href="a00005.html#adf675fbe6c088fd2b210d7c27b48548f">00251</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#adf675fbe6c088fd2b210d7c27b48548f" title="Constructs a read/data-write iterator that points to the first slot in the first leaf of the B+ tree...">begin</a>()
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a564a6ea78bcc0de0bbc1fdff65f547fd" title="Constructs a read/data-write iterator that points to the first slot in the first leaf of the B+ tree...">begin</a>();
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 <span class="comment"></span>
<a name="l00256"></a>00256 <span class="comment"> /// Constructs a read/data-write iterator that points to the first invalid</span>
<a name="l00257"></a>00257 <span class="comment"> /// slot in the last leaf of the B+ tree.</span>
<a name="l00258"></a><a class="code" href="a00005.html#a2ac890e6114060f5a40f9651bfc686cf">00258</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a2ac890e6114060f5a40f9651bfc686cf" title="Constructs a read/data-write iterator that points to the first invalid slot in the last leaf of the B...">end</a>()
<a name="l00259"></a>00259 {
<a name="l00260"></a>00260 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a8f1fbaf7eabefca66188e2bf6996573d" title="Constructs a read/data-write iterator that points to the first invalid slot in the last leaf of the B...">end</a>();
<a name="l00261"></a>00261 }
<a name="l00262"></a>00262 <span class="comment"></span>
<a name="l00263"></a>00263 <span class="comment"> /// Constructs a read-only constant iterator that points to the first slot</span>
<a name="l00264"></a>00264 <span class="comment"> /// in the first leaf of the B+ tree.</span>
<a name="l00265"></a><a class="code" href="a00005.html#a7c76d3fe4e370b5f7dc2e77deccf61e6">00265</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a> <a class="code" href="a00005.html#adf675fbe6c088fd2b210d7c27b48548f" title="Constructs a read/data-write iterator that points to the first slot in the first leaf of the B+ tree...">begin</a>()<span class="keyword"> const</span>
<a name="l00266"></a>00266 <span class="keyword"> </span>{
<a name="l00267"></a>00267 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a564a6ea78bcc0de0bbc1fdff65f547fd" title="Constructs a read/data-write iterator that points to the first slot in the first leaf of the B+ tree...">begin</a>();
<a name="l00268"></a>00268 }
<a name="l00269"></a>00269 <span class="comment"></span>
<a name="l00270"></a>00270 <span class="comment"> /// Constructs a read-only constant iterator that points to the first</span>
<a name="l00271"></a>00271 <span class="comment"> /// invalid slot in the last leaf of the B+ tree.</span>
<a name="l00272"></a><a class="code" href="a00005.html#ab00f7a57cbb9bb1bce4a7a8bd7a1885b">00272</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a> <a class="code" href="a00005.html#a2ac890e6114060f5a40f9651bfc686cf" title="Constructs a read/data-write iterator that points to the first invalid slot in the last leaf of the B...">end</a>()<span class="keyword"> const</span>
<a name="l00273"></a>00273 <span class="keyword"> </span>{
<a name="l00274"></a>00274 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a8f1fbaf7eabefca66188e2bf6996573d" title="Constructs a read/data-write iterator that points to the first invalid slot in the last leaf of the B...">end</a>();
<a name="l00275"></a>00275 }
<a name="l00276"></a>00276 <span class="comment"></span>
<a name="l00277"></a>00277 <span class="comment"> /// Constructs a read/data-write reverse iterator that points to the first</span>
<a name="l00278"></a>00278 <span class="comment"> /// invalid slot in the last leaf of the B+ tree. Uses STL magic.</span>
<a name="l00279"></a><a class="code" href="a00005.html#a26f25e4676e2e40f775f206d15ec410a">00279</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#aa54a3a740748e22fae3b05f599458863" title="create mutable reverse iterator by using STL magic">reverse_iterator</a> <a class="code" href="a00005.html#a26f25e4676e2e40f775f206d15ec410a" title="Constructs a read/data-write reverse iterator that points to the first invalid slot in the last leaf ...">rbegin</a>()
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a4e2f4ba4141820f4bc5782298c261aa5" title="Constructs a read/data-write reverse iterator that points to the first invalid slot in the last leaf ...">rbegin</a>();
<a name="l00282"></a>00282 }
<a name="l00283"></a>00283 <span class="comment"></span>
<a name="l00284"></a>00284 <span class="comment"> /// Constructs a read/data-write reverse iterator that points to the first</span>
<a name="l00285"></a>00285 <span class="comment"> /// slot in the first leaf of the B+ tree. Uses STL magic.</span>
<a name="l00286"></a><a class="code" href="a00005.html#a65869601a55e3f965a847adea7ab48be">00286</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#aa54a3a740748e22fae3b05f599458863" title="create mutable reverse iterator by using STL magic">reverse_iterator</a> <a class="code" href="a00005.html#a65869601a55e3f965a847adea7ab48be" title="Constructs a read/data-write reverse iterator that points to the first slot in the first leaf of the ...">rend</a>()
<a name="l00287"></a>00287 {
<a name="l00288"></a>00288 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a625d6f5e37cfed631a403fe36fa818dc" title="Constructs a read/data-write reverse iterator that points to the first slot in the first leaf of the ...">rend</a>();
<a name="l00289"></a>00289 }
<a name="l00290"></a>00290 <span class="comment"></span>
<a name="l00291"></a>00291 <span class="comment"> /// Constructs a read-only reverse iterator that points to the first</span>
<a name="l00292"></a>00292 <span class="comment"> /// invalid slot in the last leaf of the B+ tree. Uses STL magic.</span>
<a name="l00293"></a><a class="code" href="a00005.html#a25803c0b24900806f18ba1c437000b8f">00293</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a0af611010281b93a36b1b0fd3fd2144a" title="create constant reverse iterator by using STL magic">const_reverse_iterator</a> <a class="code" href="a00005.html#a26f25e4676e2e40f775f206d15ec410a" title="Constructs a read/data-write reverse iterator that points to the first invalid slot in the last leaf ...">rbegin</a>()<span class="keyword"> const</span>
<a name="l00294"></a>00294 <span class="keyword"> </span>{
<a name="l00295"></a>00295 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a4e2f4ba4141820f4bc5782298c261aa5" title="Constructs a read/data-write reverse iterator that points to the first invalid slot in the last leaf ...">rbegin</a>();
<a name="l00296"></a>00296 }
<a name="l00297"></a>00297 <span class="comment"></span>
<a name="l00298"></a>00298 <span class="comment"> /// Constructs a read-only reverse iterator that points to the first slot</span>
<a name="l00299"></a>00299 <span class="comment"> /// in the first leaf of the B+ tree. Uses STL magic.</span>
<a name="l00300"></a><a class="code" href="a00005.html#af19d878da96d44622a86b9108e87f339">00300</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a0af611010281b93a36b1b0fd3fd2144a" title="create constant reverse iterator by using STL magic">const_reverse_iterator</a> <a class="code" href="a00005.html#a65869601a55e3f965a847adea7ab48be" title="Constructs a read/data-write reverse iterator that points to the first slot in the first leaf of the ...">rend</a>()<span class="keyword"> const</span>
<a name="l00301"></a>00301 <span class="keyword"> </span>{
<a name="l00302"></a>00302 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a625d6f5e37cfed631a403fe36fa818dc" title="Constructs a read/data-write reverse iterator that points to the first slot in the first leaf of the ...">rend</a>();
<a name="l00303"></a>00303 }
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <span class="keyword">public</span>:
<a name="l00306"></a>00306 <span class="comment">// *** Access Functions to the Item Count</span>
<a name="l00307"></a>00307 <span class="comment"></span>
<a name="l00308"></a>00308 <span class="comment"> /// Return the number of key/data pairs in the B+ tree</span>
<a name="l00309"></a><a class="code" href="a00005.html#a0b2c9f7d4790b64ea53576e96da76ea0">00309</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4" title="Size type used to count keys.">size_type</a> <a class="code" href="a00005.html#a0b2c9f7d4790b64ea53576e96da76ea0" title="Return the number of key/data pairs in the B+ tree.">size</a>()<span class="keyword"> const</span>
<a name="l00310"></a>00310 <span class="keyword"> </span>{
<a name="l00311"></a>00311 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a3942d7144bc93cf094b62f03e6113f4e" title="Return the number of key/data pairs in the B+ tree.">size</a>();
<a name="l00312"></a>00312 }
<a name="l00313"></a>00313 <span class="comment"></span>
<a name="l00314"></a>00314 <span class="comment"> /// Returns true if there is at least one key/data pair in the B+ tree</span>
<a name="l00315"></a><a class="code" href="a00005.html#a4e48d18f8564ea81d6702398767f05dd">00315</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a4e48d18f8564ea81d6702398767f05dd" title="Returns true if there is at least one key/data pair in the B+ tree.">empty</a>()<span class="keyword"> const</span>
<a name="l00316"></a>00316 <span class="keyword"> </span>{
<a name="l00317"></a>00317 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#ad7cf0c4833d2ea3fcd79df4c884bab40" title="Returns true if there is at least one key/data pair in the B+ tree.">empty</a>();
<a name="l00318"></a>00318 }
<a name="l00319"></a>00319 <span class="comment"></span>
<a name="l00320"></a>00320 <span class="comment"> /// Returns the largest possible size of the B+ Tree. This is just a</span>
<a name="l00321"></a>00321 <span class="comment"> /// function required by the STL standard, the B+ Tree can hold more items.</span>
<a name="l00322"></a><a class="code" href="a00005.html#a122b57700263111abc6d8740123e2480">00322</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4" title="Size type used to count keys.">size_type</a> <a class="code" href="a00005.html#a122b57700263111abc6d8740123e2480" title="Returns the largest possible size of the B+ Tree.">max_size</a>()<span class="keyword"> const</span>
<a name="l00323"></a>00323 <span class="keyword"> </span>{
<a name="l00324"></a>00324 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a3285e41cd6c4566e99d8c82803ad4d92" title="Returns the largest possible size of the B+ Tree.">max_size</a>();
<a name="l00325"></a>00325 }
<a name="l00326"></a>00326 <span class="comment"></span>
<a name="l00327"></a>00327 <span class="comment"> /// Return a const reference to the current statistics.</span>
<a name="l00328"></a><a class="code" href="a00005.html#ac6d2b48072e4917eae4db73f21212d09">00328</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="a00005.html#ac5b2a55d1982b407a1075b9474c0d986" title="Small structure containing statistics about the tree.">tree_stats</a>&amp; <a class="code" href="a00005.html#ac6d2b48072e4917eae4db73f21212d09" title="Return a const reference to the current statistics.">get_stats</a>()<span class="keyword"> const</span>
<a name="l00329"></a>00329 <span class="keyword"> </span>{
<a name="l00330"></a>00330 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a81c7f4e56b3421976855daf40c6e20fc" title="Return a const reference to the current statistics.">get_stats</a>();
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332
<a name="l00333"></a>00333 <span class="keyword">public</span>:
<a name="l00334"></a>00334 <span class="comment">// *** Standard Access Functions Querying the Tree by Descending to a Leaf</span>
<a name="l00335"></a>00335 <span class="comment"></span>
<a name="l00336"></a>00336 <span class="comment"> /// Non-STL function checking whether a key is in the B+ tree. The same as</span>
<a name="l00337"></a>00337 <span class="comment"> /// (find(k) != end()) or (count() != 0).</span>
<a name="l00338"></a><a class="code" href="a00005.html#ae5a4cbbd44f3c1ac0380814d42227f08">00338</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#ae5a4cbbd44f3c1ac0380814d42227f08" title="Non-STL function checking whether a key is in the B+ tree.">exists</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)<span class="keyword"> const</span>
<a name="l00339"></a>00339 <span class="keyword"> </span>{
<a name="l00340"></a>00340 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a3c1b922d80faa7d5864237b4791a7961" title="Non-STL function checking whether a key is in the B+ tree.">exists</a>(key);
<a name="l00341"></a>00341 }
<a name="l00342"></a>00342 <span class="comment"></span>
<a name="l00343"></a>00343 <span class="comment"> /// Tries to locate a key in the B+ tree and returns an iterator to the</span>
<a name="l00344"></a>00344 <span class="comment"> /// key/data slot if found. If unsuccessful it returns end().</span>
<a name="l00345"></a><a class="code" href="a00005.html#a34e793de6eed772651697e23e8adaf9c">00345</a> <span class="comment"></span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a34e793de6eed772651697e23e8adaf9c" title="Tries to locate a key in the B+ tree and returns an iterator to the key/data slot if found...">find</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)
<a name="l00346"></a>00346 {
<a name="l00347"></a>00347 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a90bd85f703bb74d7ab7dc967bf8d712f" title="Tries to locate a key in the B+ tree and returns an iterator to the key/data slot if found...">find</a>(key);
<a name="l00348"></a>00348 }
<a name="l00349"></a>00349 <span class="comment"></span>
<a name="l00350"></a>00350 <span class="comment"> /// Tries to locate a key in the B+ tree and returns an constant iterator</span>
<a name="l00351"></a>00351 <span class="comment"> /// to the key/data slot if found. If unsuccessful it returns end().</span>
<a name="l00352"></a><a class="code" href="a00005.html#a8e1f92f877b124becd55debded93392a">00352</a> <span class="comment"></span> <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a> <a class="code" href="a00005.html#a34e793de6eed772651697e23e8adaf9c" title="Tries to locate a key in the B+ tree and returns an iterator to the key/data slot if found...">find</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)<span class="keyword"> const</span>
<a name="l00353"></a>00353 <span class="keyword"> </span>{
<a name="l00354"></a>00354 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a90bd85f703bb74d7ab7dc967bf8d712f" title="Tries to locate a key in the B+ tree and returns an iterator to the key/data slot if found...">find</a>(key);
<a name="l00355"></a>00355 }
<a name="l00356"></a>00356 <span class="comment"></span>
<a name="l00357"></a>00357 <span class="comment"> /// Tries to locate a key in the B+ tree and returns the number of</span>
<a name="l00358"></a>00358 <span class="comment"> /// identical key entries found.</span>
<a name="l00359"></a><a class="code" href="a00005.html#a6c0afdca1eb33639f5e8a2a7c939de9a">00359</a> <span class="comment"></span> <a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4" title="Size type used to count keys.">size_type</a> <a class="code" href="a00005.html#a6c0afdca1eb33639f5e8a2a7c939de9a" title="Tries to locate a key in the B+ tree and returns the number of identical key entries found...">count</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)<span class="keyword"> const</span>
<a name="l00360"></a>00360 <span class="keyword"> </span>{
<a name="l00361"></a>00361 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a3882a2b0e2ea8eb43b4261e7f3eb32f2" title="Tries to locate a key in the B+ tree and returns the number of identical key entries found...">count</a>(key);
<a name="l00362"></a>00362 }
<a name="l00363"></a>00363 <span class="comment"></span>
<a name="l00364"></a>00364 <span class="comment"> /// Searches the B+ tree and returns an iterator to the first pair</span>
<a name="l00365"></a>00365 <span class="comment"> /// equal to or greater than key, or end() if all keys are smaller.</span>
<a name="l00366"></a><a class="code" href="a00005.html#a966752ba450e4fc9e373482569d6a2d4">00366</a> <span class="comment"></span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a966752ba450e4fc9e373482569d6a2d4" title="Searches the B+ tree and returns an iterator to the first pair equal to or greater than key...">lower_bound</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)
<a name="l00367"></a>00367 {
<a name="l00368"></a>00368 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#aa0b7c53085ef7106f3d430d850b4959e" title="Searches the B+ tree and returns an iterator to the first pair equal to or greater than key...">lower_bound</a>(key);
<a name="l00369"></a>00369 }
<a name="l00370"></a>00370 <span class="comment"></span>
<a name="l00371"></a>00371 <span class="comment"> /// Searches the B+ tree and returns a constant iterator to the</span>
<a name="l00372"></a>00372 <span class="comment"> /// first pair equal to or greater than key, or end() if all keys</span>
<a name="l00373"></a>00373 <span class="comment"> /// are smaller.</span>
<a name="l00374"></a><a class="code" href="a00005.html#abe98b44e72292ab38b1894a892c7db0e">00374</a> <span class="comment"></span> <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a> <a class="code" href="a00005.html#a966752ba450e4fc9e373482569d6a2d4" title="Searches the B+ tree and returns an iterator to the first pair equal to or greater than key...">lower_bound</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)<span class="keyword"> const</span>
<a name="l00375"></a>00375 <span class="keyword"> </span>{
<a name="l00376"></a>00376 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#aa0b7c53085ef7106f3d430d850b4959e" title="Searches the B+ tree and returns an iterator to the first pair equal to or greater than key...">lower_bound</a>(key);
<a name="l00377"></a>00377 }
<a name="l00378"></a>00378 <span class="comment"></span>
<a name="l00379"></a>00379 <span class="comment"> /// Searches the B+ tree and returns an iterator to the first pair</span>
<a name="l00380"></a>00380 <span class="comment"> /// greater than key, or end() if all keys are smaller or equal.</span>
<a name="l00381"></a><a class="code" href="a00005.html#a383fe4dc086b012197acbae9ded8d35f">00381</a> <span class="comment"></span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a383fe4dc086b012197acbae9ded8d35f" title="Searches the B+ tree and returns an iterator to the first pair greater than key, or end() if all keys...">upper_bound</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)
<a name="l00382"></a>00382 {
<a name="l00383"></a>00383 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a0404bb704466a149ea96613b7c5ef3e2" title="Searches the B+ tree and returns an iterator to the first pair greater than key, or end() if all keys...">upper_bound</a>(key);
<a name="l00384"></a>00384 }
<a name="l00385"></a>00385 <span class="comment"></span>
<a name="l00386"></a>00386 <span class="comment"> /// Searches the B+ tree and returns a constant iterator to the</span>
<a name="l00387"></a>00387 <span class="comment"> /// first pair greater than key, or end() if all keys are smaller</span>
<a name="l00388"></a>00388 <span class="comment"> /// or equal.</span>
<a name="l00389"></a><a class="code" href="a00005.html#a9c40897d0188187c253cccb186042876">00389</a> <span class="comment"></span> <a class="code" href="a00005.html#a8994ae561b750a09e636040be65c5246" title="STL-like iterator object for B+ tree items.">const_iterator</a> <a class="code" href="a00005.html#a383fe4dc086b012197acbae9ded8d35f" title="Searches the B+ tree and returns an iterator to the first pair greater than key, or end() if all keys...">upper_bound</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)<span class="keyword"> const</span>
<a name="l00390"></a>00390 <span class="keyword"> </span>{
<a name="l00391"></a>00391 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a0404bb704466a149ea96613b7c5ef3e2" title="Searches the B+ tree and returns an iterator to the first pair greater than key, or end() if all keys...">upper_bound</a>(key);
<a name="l00392"></a>00392 }
<a name="l00393"></a>00393 <span class="comment"></span>
<a name="l00394"></a>00394 <span class="comment"> /// Searches the B+ tree and returns both lower_bound() and upper_bound().</span>
<a name="l00395"></a><a class="code" href="a00005.html#a2cea662bd204a5d6cd5a994636368a08">00395</a> <span class="comment"></span> <span class="keyword">inline</span> std::pair&lt;iterator, iterator&gt; <a class="code" href="a00005.html#a2cea662bd204a5d6cd5a994636368a08" title="Searches the B+ tree and returns both lower_bound() and upper_bound().">equal_range</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)
<a name="l00396"></a>00396 {
<a name="l00397"></a>00397 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#ac73cf4621b0650fef2ea3ea1d2fd2f90" title="Searches the B+ tree and returns both lower_bound() and upper_bound().">equal_range</a>(key);
<a name="l00398"></a>00398 }
<a name="l00399"></a>00399 <span class="comment"></span>
<a name="l00400"></a>00400 <span class="comment"> /// Searches the B+ tree and returns both lower_bound() and upper_bound().</span>
<a name="l00401"></a><a class="code" href="a00005.html#a0f4f44a5553b3b0afe077e15e2204c18">00401</a> <span class="comment"></span> <span class="keyword">inline</span> std::pair&lt;const_iterator, const_iterator&gt; <a class="code" href="a00005.html#a2cea662bd204a5d6cd5a994636368a08" title="Searches the B+ tree and returns both lower_bound() and upper_bound().">equal_range</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key)<span class="keyword"> const</span>
<a name="l00402"></a>00402 <span class="keyword"> </span>{
<a name="l00403"></a>00403 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#ac73cf4621b0650fef2ea3ea1d2fd2f90" title="Searches the B+ tree and returns both lower_bound() and upper_bound().">equal_range</a>(key);
<a name="l00404"></a>00404 }
<a name="l00405"></a>00405
<a name="l00406"></a>00406 <span class="keyword">public</span>:
<a name="l00407"></a>00407 <span class="comment">// *** B+ Tree Object Comparison Functions</span>
<a name="l00408"></a>00408 <span class="comment"></span>
<a name="l00409"></a>00409 <span class="comment"> /// Equality relation of B+ trees of the same type. B+ trees of the same</span>
<a name="l00410"></a>00410 <span class="comment"> /// size and equal elements (both key and data) are considered</span>
<a name="l00411"></a>00411 <span class="comment"> /// equal. Beware of the random ordering of duplicate keys.</span>
<a name="l00412"></a><a class="code" href="a00005.html#a28eb83b95a403ae4e22e857a53f1c312">00412</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a28eb83b95a403ae4e22e857a53f1c312" title="Equality relation of B+ trees of the same type.">operator==</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00413"></a>00413 <span class="keyword"> </span>{
<a name="l00414"></a>00414 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> == other.tree);
<a name="l00415"></a>00415 }
<a name="l00416"></a>00416 <span class="comment"></span>
<a name="l00417"></a>00417 <span class="comment"> /// Inequality relation. Based on operator==.</span>
<a name="l00418"></a><a class="code" href="a00005.html#a776810538e2694bb322d7acbfe1d40bb">00418</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a776810538e2694bb322d7acbfe1d40bb" title="Inequality relation. Based on operator==.">operator!=</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00419"></a>00419 <span class="keyword"> </span>{
<a name="l00420"></a>00420 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> != other.tree);
<a name="l00421"></a>00421 }
<a name="l00422"></a>00422 <span class="comment"></span>
<a name="l00423"></a>00423 <span class="comment"> /// Total ordering relation of B+ trees of the same type. It uses</span>
<a name="l00424"></a>00424 <span class="comment"> /// std::lexicographical_compare() for the actual comparison of elements.</span>
<a name="l00425"></a><a class="code" href="a00005.html#a6a5db9c99ef0795047d9830ca874835b">00425</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a6a5db9c99ef0795047d9830ca874835b" title="Total ordering relation of B+ trees of the same type.">operator&lt;</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00426"></a>00426 <span class="keyword"> </span>{
<a name="l00427"></a>00427 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> &lt; other.tree);
<a name="l00428"></a>00428 }
<a name="l00429"></a>00429 <span class="comment"></span>
<a name="l00430"></a>00430 <span class="comment"> /// Greater relation. Based on operator&lt;.</span>
<a name="l00431"></a><a class="code" href="a00005.html#adee49a9016375954653fb9e636b34fd4">00431</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#adee49a9016375954653fb9e636b34fd4" title="Greater relation. Based on operator&lt;.">operator&gt;</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00432"></a>00432 <span class="keyword"> </span>{
<a name="l00433"></a>00433 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> &gt; other.tree);
<a name="l00434"></a>00434 }
<a name="l00435"></a>00435 <span class="comment"></span>
<a name="l00436"></a>00436 <span class="comment"> /// Less-equal relation. Based on operator&lt;.</span>
<a name="l00437"></a><a class="code" href="a00005.html#a3307b73ee5b14e6b9448e8d015d6f6ca">00437</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a3307b73ee5b14e6b9448e8d015d6f6ca" title="Less-equal relation. Based on operator&lt;.">operator&lt;=</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00438"></a>00438 <span class="keyword"> </span>{
<a name="l00439"></a>00439 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> &lt;= other.tree);
<a name="l00440"></a>00440 }
<a name="l00441"></a>00441 <span class="comment"></span>
<a name="l00442"></a>00442 <span class="comment"> /// Greater-equal relation. Based on operator&lt;.</span>
<a name="l00443"></a><a class="code" href="a00005.html#aa6feaadc9209791ac4b324b9fbaec951">00443</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#aa6feaadc9209791ac4b324b9fbaec951" title="Greater-equal relation. Based on operator&lt;.">operator&gt;=</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)<span class="keyword"> const</span>
<a name="l00444"></a>00444 <span class="keyword"> </span>{
<a name="l00445"></a>00445 <span class="keywordflow">return</span> (<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> &gt;= other.tree);
<a name="l00446"></a>00446 }
<a name="l00447"></a>00447
<a name="l00448"></a>00448 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00449"></a>00449 <span class="comment"> /// *** Fast Copy: Assign Operator and Copy Constructors</span>
<a name="l00450"></a>00450 <span class="comment"></span><span class="comment"></span>
<a name="l00451"></a>00451 <span class="comment"> /// Assignment operator. All the key/data pairs are copied</span>
<a name="l00452"></a><a class="code" href="a00005.html#ac46186ae3adf35e4ed2a2f3146294f2a">00452</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keyword">self</span>&amp; <a class="code" href="a00005.html#ac46186ae3adf35e4ed2a2f3146294f2a" title="*** Fast Copy: Assign Operator and Copy Constructors">operator= </a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)
<a name="l00453"></a>00453 {
<a name="l00454"></a>00454 <span class="keywordflow">if</span> (<span class="keyword">this</span> != &amp;other)
<a name="l00455"></a>00455 {
<a name="l00456"></a>00456 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a> = other.tree;
<a name="l00457"></a>00457 }
<a name="l00458"></a>00458 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00459"></a>00459 }
<a name="l00460"></a>00460 <span class="comment"></span>
<a name="l00461"></a>00461 <span class="comment"> /// Copy constructor. The newly initialized B+ tree object will contain a</span>
<a name="l00462"></a>00462 <span class="comment"> /// copy or all key/data pairs.</span>
<a name="l00463"></a><a class="code" href="a00005.html#a52cd4e7dd5a8d75e71292985de7837af">00463</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#af5437efbbc9ea35223ac6bfbcfbaf05c" title="Default constructor initializing an empty B+ tree with the standard key comparison function...">btree_multimap</a>(<span class="keyword">const</span> <span class="keyword">self</span> &amp;other)
<a name="l00464"></a>00464 : <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>(other.<a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>)
<a name="l00465"></a>00465 {
<a name="l00466"></a>00466 }
<a name="l00467"></a>00467
<a name="l00468"></a>00468 <span class="keyword">public</span>:
<a name="l00469"></a>00469 <span class="comment">// *** Public Insertion Functions</span>
<a name="l00470"></a>00470 <span class="comment"></span>
<a name="l00471"></a>00471 <span class="comment"> /// Attempt to insert a key/data pair into the B+ tree. As this tree allows</span>
<a name="l00472"></a>00472 <span class="comment"> /// duplicates insertion never fails.</span>
<a name="l00473"></a><a class="code" href="a00005.html#ae333d92079886a0c0b2a2d32201b712f">00473</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#ae333d92079886a0c0b2a2d32201b712f" title="Attempt to insert a key/data pair into the B+ tree.">insert</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#aa9c86e804b95247c742db5ad7b9351fe" title="Construct the STL-required value_type as a composition pair of key and data types.">value_type</a>&amp; x)
<a name="l00474"></a>00474 {
<a name="l00475"></a>00475 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a586dd230f8be24eaeebc75cc95196d78" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(x.first, x.second).first;
<a name="l00476"></a>00476 }
<a name="l00477"></a>00477 <span class="comment"></span>
<a name="l00478"></a>00478 <span class="comment"> /// Attempt to insert a key/data pair into the B+ tree. Beware that if</span>
<a name="l00479"></a>00479 <span class="comment"> /// key_type == data_type, then the template iterator insert() is called</span>
<a name="l00480"></a>00480 <span class="comment"> /// instead. As this tree allows duplicates insertion never fails.</span>
<a name="l00481"></a><a class="code" href="a00005.html#a21efd634ae0900fa4255933e41d1fc55">00481</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#ae333d92079886a0c0b2a2d32201b712f" title="Attempt to insert a key/data pair into the B+ tree.">insert</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key, <span class="keyword">const</span> <a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299" title="Second template parameter: The data type associated with each key.">data_type</a>&amp; data)
<a name="l00482"></a>00482 {
<a name="l00483"></a>00483 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a586dd230f8be24eaeebc75cc95196d78" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(key, data).first;
<a name="l00484"></a>00484 }
<a name="l00485"></a>00485 <span class="comment"></span>
<a name="l00486"></a>00486 <span class="comment"> /// Attempt to insert a key/data pair into the B+ tree. This function is the</span>
<a name="l00487"></a>00487 <span class="comment"> /// same as the other insert, however if key_type == data_type then the</span>
<a name="l00488"></a>00488 <span class="comment"> /// non-template function cannot be called. As this tree allows duplicates</span>
<a name="l00489"></a>00489 <span class="comment"> /// insertion never fails.</span>
<a name="l00490"></a><a class="code" href="a00005.html#a73db5a4a7d48733d515319436935ae5c">00490</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a73db5a4a7d48733d515319436935ae5c" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key, <span class="keyword">const</span> <a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299" title="Second template parameter: The data type associated with each key.">data_type</a>&amp; data)
<a name="l00491"></a>00491 {
<a name="l00492"></a>00492 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a586dd230f8be24eaeebc75cc95196d78" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(key, data).first;
<a name="l00493"></a>00493 }
<a name="l00494"></a>00494 <span class="comment"></span>
<a name="l00495"></a>00495 <span class="comment"> /// Attempt to insert a key/data pair into the B+ tree. The iterator hint</span>
<a name="l00496"></a>00496 <span class="comment"> /// is currently ignored by the B+ tree insertion routine.</span>
<a name="l00497"></a><a class="code" href="a00005.html#a29e267a1e4178dca1f954d12aaff5cee">00497</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#ae333d92079886a0c0b2a2d32201b712f" title="Attempt to insert a key/data pair into the B+ tree.">insert</a>(<a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> hint, <span class="keyword">const</span> <a class="code" href="a00005.html#aa9c86e804b95247c742db5ad7b9351fe" title="Construct the STL-required value_type as a composition pair of key and data types.">value_type</a> &amp;x)
<a name="l00498"></a>00498 {
<a name="l00499"></a>00499 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a586dd230f8be24eaeebc75cc95196d78" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(hint, x.first, x.second);
<a name="l00500"></a>00500 }
<a name="l00501"></a>00501 <span class="comment"></span>
<a name="l00502"></a>00502 <span class="comment"> /// Attempt to insert a key/data pair into the B+ tree. The iterator hint is</span>
<a name="l00503"></a>00503 <span class="comment"> /// currently ignored by the B+ tree insertion routine.</span>
<a name="l00504"></a><a class="code" href="a00005.html#afbb8f4655de73accf1fefdb14a71c755">00504</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <a class="code" href="a00005.html#a73db5a4a7d48733d515319436935ae5c" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(<a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> hint, <span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a>&amp; key, <span class="keyword">const</span> <a class="code" href="a00005.html#acd5f5ea401940bfc91c52571e0a27299" title="Second template parameter: The data type associated with each key.">data_type</a>&amp; data)
<a name="l00505"></a>00505 {
<a name="l00506"></a>00506 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a586dd230f8be24eaeebc75cc95196d78" title="Attempt to insert a key/data pair into the B+ tree.">insert2</a>(hint, key, data);
<a name="l00507"></a>00507 }
<a name="l00508"></a>00508 <span class="comment"></span>
<a name="l00509"></a>00509 <span class="comment"> /// Attempt to insert the range [first,last) of value_type pairs into the B+</span>
<a name="l00510"></a>00510 <span class="comment"> /// tree. Each key/data pair is inserted individually.</span>
<a name="l00511"></a>00511 <span class="comment"></span> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> InputIterator&gt;
<a name="l00512"></a><a class="code" href="a00005.html#ad1d876c4c9afe1c8ecf3a28d23be5049">00512</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#ae333d92079886a0c0b2a2d32201b712f" title="Attempt to insert a key/data pair into the B+ tree.">insert</a>(InputIterator first, InputIterator last)
<a name="l00513"></a>00513 {
<a name="l00514"></a>00514 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a29d3aa8b03d2def35a358aebb2853053" title="Attempt to insert a key/data pair into the B+ tree.">insert</a>(first, last);
<a name="l00515"></a>00515 }
<a name="l00516"></a>00516 <span class="comment"></span>
<a name="l00517"></a>00517 <span class="comment"> /// Bulk load a sorted range [first,last). Loads items into leaves and</span>
<a name="l00518"></a>00518 <span class="comment"> /// constructs a B-tree above them. The tree must be empty when calling</span>
<a name="l00519"></a>00519 <span class="comment"> /// this function.</span>
<a name="l00520"></a>00520 <span class="comment"></span> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Iterator&gt;
<a name="l00521"></a><a class="code" href="a00005.html#a03c07294f0b9bfbcd17f15ba23669dca">00521</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a03c07294f0b9bfbcd17f15ba23669dca" title="Bulk load a sorted range [first,last).">bulk_load</a>(Iterator first, Iterator last)
<a name="l00522"></a>00522 {
<a name="l00523"></a>00523 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a053c808858d78e6f0a93041ab612d656" title="Bulk load a sorted range.">bulk_load</a>(first, last);
<a name="l00524"></a>00524 }
<a name="l00525"></a>00525
<a name="l00526"></a>00526 <span class="keyword">public</span>:
<a name="l00527"></a>00527 <span class="comment">// *** Public Erase Functions</span>
<a name="l00528"></a>00528 <span class="comment"></span>
<a name="l00529"></a>00529 <span class="comment"> /// Erases one (the first) of the key/data pairs associated with the given</span>
<a name="l00530"></a>00530 <span class="comment"> /// key.</span>
<a name="l00531"></a><a class="code" href="a00005.html#a63e0ea7673d9a512feb86c990f28cca0">00531</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a63e0ea7673d9a512feb86c990f28cca0" title="Erases one (the first) of the key/data pairs associated with the given key.">erase_one</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)
<a name="l00532"></a>00532 {
<a name="l00533"></a>00533 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a07ca3a19f1e20908f7cca3180420c817" title="Erases one (the first) of the key/data pairs associated with the given key.">erase_one</a>(key);
<a name="l00534"></a>00534 }
<a name="l00535"></a>00535 <span class="comment"></span>
<a name="l00536"></a>00536 <span class="comment"> /// Erases all the key/data pairs associated with the given key. This is</span>
<a name="l00537"></a>00537 <span class="comment"> /// implemented using erase_one() and thus not very efficient.</span>
<a name="l00538"></a><a class="code" href="a00005.html#af53814c6408f8708d5c755e3277b92d4">00538</a> <span class="comment"></span> <a class="code" href="a00005.html#abd83889e9697c609bffd95ec4548ddb4" title="Size type used to count keys.">size_type</a> <a class="code" href="a00005.html#af53814c6408f8708d5c755e3277b92d4" title="Erases all the key/data pairs associated with the given key.">erase</a>(<span class="keyword">const</span> <a class="code" href="a00005.html#adb607d4142977e7e6ca36ff38c42ace8" title="First template parameter: The key type of the btree.">key_type</a> &amp;key)
<a name="l00539"></a>00539 {
<a name="l00540"></a>00540 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a8bced926ecf575a393e06ca7d35291f1" title="Erases all the key/data pairs associated with the given key.">erase</a>(key);
<a name="l00541"></a>00541 }
<a name="l00542"></a>00542 <span class="comment"></span>
<a name="l00543"></a>00543 <span class="comment"> /// Erase the key/data pair referenced by the iterator.</span>
<a name="l00544"></a><a class="code" href="a00005.html#a2e1cd81a36b44a74d3602c9cca2fc07d">00544</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#af53814c6408f8708d5c755e3277b92d4" title="Erases all the key/data pairs associated with the given key.">erase</a>(<a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> iter)
<a name="l00545"></a>00545 {
<a name="l00546"></a>00546 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a8bced926ecf575a393e06ca7d35291f1" title="Erases all the key/data pairs associated with the given key.">erase</a>(iter);
<a name="l00547"></a>00547 }
<a name="l00548"></a>00548
<a name="l00549"></a>00549 <span class="preprocessor">#ifdef BTREE_TODO</span>
<a name="l00550"></a>00550 <span class="preprocessor"></span><span class="comment"> /// Erase all key/data pairs in the range [first,last). This function is</span>
<a name="l00551"></a>00551 <span class="comment"></span><span class="comment"> /// currently not implemented by the B+ Tree.</span>
<a name="l00552"></a><a class="code" href="a00005.html#a213de9620ab9ecee3286769bb4415030">00552</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#af53814c6408f8708d5c755e3277b92d4" title="Erases all the key/data pairs associated with the given key.">erase</a>(<a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <span class="comment">/* first */</span>, <a class="code" href="a00005.html#a979a7cd352bd12f3fdd4554f65e56322" title="STL-like iterator object for B+ tree items.">iterator</a> <span class="comment">/* last */</span>)
<a name="l00553"></a>00553 {
<a name="l00554"></a>00554 abort();
<a name="l00555"></a>00555 }
<a name="l00556"></a>00556 <span class="preprocessor">#endif</span>
<a name="l00557"></a>00557 <span class="preprocessor"></span>
<a name="l00558"></a>00558 <span class="preprocessor">#ifdef BTREE_DEBUG</span>
<a name="l00559"></a>00559 <span class="preprocessor"></span><span class="keyword">public</span>:
<a name="l00560"></a>00560 <span class="comment">// *** Debug Printing</span>
<a name="l00561"></a>00561 <span class="comment"></span>
<a name="l00562"></a>00562 <span class="comment"> /// Print out the B+ tree structure with keys onto the given ostream. This function</span>
<a name="l00563"></a>00563 <span class="comment"> /// requires that the header is compiled with BTREE_DEBUG and that key_type</span>
<a name="l00564"></a>00564 <span class="comment"> /// is printable via std::ostream.</span>
<a name="l00565"></a><a class="code" href="a00005.html#a1beb6a5071999014c38504e595e39138">00565</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a1beb6a5071999014c38504e595e39138" title="Print out the B+ tree structure with keys onto the given ostream.">print</a>(std::ostream &amp;os)<span class="keyword"> const</span>
<a name="l00566"></a>00566 <span class="keyword"> </span>{
<a name="l00567"></a>00567 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a29af931b81dc3446d1ffadab6fd5e017" title="Print out the B+ tree structure with keys onto the given ostream.">print</a>(os);
<a name="l00568"></a>00568 }
<a name="l00569"></a>00569 <span class="comment"></span>
<a name="l00570"></a>00570 <span class="comment"> /// Print out only the leaves via the double linked list.</span>
<a name="l00571"></a><a class="code" href="a00005.html#a57515b3f833998d01408a65a92a8edf2">00571</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a57515b3f833998d01408a65a92a8edf2" title="Print out only the leaves via the double linked list.">print_leaves</a>(std::ostream &amp;os)<span class="keyword"> const</span>
<a name="l00572"></a>00572 <span class="keyword"> </span>{
<a name="l00573"></a>00573 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#a2e9097d4266851d84d9e3813921155c6" title="Print out only the leaves via the double linked list.">print_leaves</a>(os);
<a name="l00574"></a>00574 }
<a name="l00575"></a>00575 <span class="preprocessor">#endif</span>
<a name="l00576"></a>00576 <span class="preprocessor"></span>
<a name="l00577"></a>00577 <span class="keyword">public</span>:
<a name="l00578"></a>00578 <span class="comment">// *** Verification of B+ Tree Invariants</span>
<a name="l00579"></a>00579 <span class="comment"></span>
<a name="l00580"></a>00580 <span class="comment"> /// Run a thorough verification of all B+ tree invariants. The program</span>
<a name="l00581"></a>00581 <span class="comment"> /// aborts via BTREE_ASSERT() if something is wrong.</span>
<a name="l00582"></a><a class="code" href="a00005.html#a4bebd9c9a9b8d33f120a65ee74358e4e">00582</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a4bebd9c9a9b8d33f120a65ee74358e4e" title="Run a thorough verification of all B+ tree invariants.">verify</a>()<span class="keyword"> const</span>
<a name="l00583"></a>00583 <span class="keyword"> </span>{
<a name="l00584"></a>00584 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#ad7008114b409fe53a5739a69f3b90e59" title="Run a thorough verification of all B+ tree invariants.">verify</a>();
<a name="l00585"></a>00585 }
<a name="l00586"></a>00586
<a name="l00587"></a>00587 <span class="keyword">public</span>:
<a name="l00588"></a>00588 <span class="comment"></span>
<a name="l00589"></a>00589 <span class="comment"> /// Dump the contents of the B+ tree out onto an ostream as a binary</span>
<a name="l00590"></a>00590 <span class="comment"> /// image. The image contains memory pointers which will be fixed when the</span>
<a name="l00591"></a>00591 <span class="comment"> /// image is restored. For this to work your key_type and data_type must be</span>
<a name="l00592"></a>00592 <span class="comment"> /// integral types and contain no pointers or references.</span>
<a name="l00593"></a><a class="code" href="a00005.html#a99f1ed0f5efa8232ed7b7e0c870c0865">00593</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="a00005.html#a99f1ed0f5efa8232ed7b7e0c870c0865" title="Dump the contents of the B+ tree out onto an ostream as a binary image.">dump</a>(std::ostream &amp;os)<span class="keyword"> const</span>
<a name="l00594"></a>00594 <span class="keyword"> </span>{
<a name="l00595"></a>00595 <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#af26da2c6a1723bd3c98229b3670e2d28" title="Dump the contents of the B+ tree out onto an ostream as a binary image.">dump</a>(os);
<a name="l00596"></a>00596 }
<a name="l00597"></a>00597 <span class="comment"></span>
<a name="l00598"></a>00598 <span class="comment"> /// Restore a binary image of a dumped B+ tree from an istream. The B+ tree</span>
<a name="l00599"></a>00599 <span class="comment"> /// pointers are fixed using the dump order. For dump and restore to work</span>
<a name="l00600"></a>00600 <span class="comment"> /// your key_type and data_type must be integral types and contain no</span>
<a name="l00601"></a>00601 <span class="comment"> /// pointers or references. Returns true if the restore was successful.</span>
<a name="l00602"></a><a class="code" href="a00005.html#a16bc358a14546c2f83da80108041993c">00602</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="a00005.html#a16bc358a14546c2f83da80108041993c" title="Restore a binary image of a dumped B+ tree from an istream.">restore</a>(std::istream &amp;is)
<a name="l00603"></a>00603 {
<a name="l00604"></a>00604 <span class="keywordflow">return</span> <a class="code" href="a00005.html#a4fff5ab80801d04325bb5528bfdc4e1e" title="The contained implementation object.">tree</a>.<a class="code" href="a00001.html#adf438d8a86c9784e277adfbb6ed5783d" title="Restore a binary image of a dumped B+ tree from an istream.">restore</a>(is);
<a name="l00605"></a>00605 }
<a name="l00606"></a>00606 };
<a name="l00607"></a>00607
<a name="l00608"></a>00608 } <span class="comment">// namespace stx</span>
<a name="l00609"></a>00609
<a name="l00610"></a>00610 <span class="preprocessor">#endif // _STX_BTREE_MULTIMAP_H_</span>
</pre></div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Sun May 5 2013 23:38:43 for STX B+ Tree Template Classes by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>