~ubuntu-branches/ubuntu/trusty/bmagic/trusty

« back to all changes in this revision

Viewing changes to doc/html/a00124.html

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2010-01-24 14:45:39 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100124144539-4ipk5rt64dpp38hl
Tags: 3.6.3-1
* New upstream release
* debian/patches/config.guess.patch: drop obsolete patch
* Add ${misc:Depends} as requested by lintian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
 
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
 
<title>BitMagic: sample6.cpp Source File</title>
4
 
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
 
<link href="tabs.css" rel="stylesheet" type="text/css">
6
 
</head><body>
7
 
<!-- Generated by Doxygen 1.5.5 -->
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html xmlns="http://www.w3.org/1999/xhtml">
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
 
5
<title>BitMagic: Set algorithms</title>
 
6
<link href="tabs.css" rel="stylesheet" type="text/css"/>
 
7
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
 
8
</head>
 
9
<body>
 
10
<!-- Generated by Doxygen 1.6.1 -->
8
11
<div class="navigation" id="top">
9
12
  <div class="tabs">
10
13
    <ul>
11
14
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12
15
      <li><a href="modules.html"><span>Modules</span></a></li>
13
16
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
14
 
      <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
15
 
      <li class="current"><a href="files.html"><span>Files</span></a></li>
 
17
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
 
18
      <li><a href="files.html"><span>Files</span></a></li>
16
19
      <li><a href="examples.html"><span>Examples</span></a></li>
17
20
    </ul>
18
21
  </div>
19
 
<h1>sample6.cpp</h1><a href="a00102.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
20
 
<a name="l00002"></a>00002 <span class="comment">Copyright(c) 2002-2005 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)</span>
21
 
<a name="l00003"></a>00003 <span class="comment"></span>
22
 
<a name="l00004"></a>00004 <span class="comment">Permission is hereby granted, free of charge, to any person </span>
23
 
<a name="l00005"></a>00005 <span class="comment">obtaining a copy of this software and associated documentation </span>
24
 
<a name="l00006"></a>00006 <span class="comment">files (the "Software"), to deal in the Software without restriction, </span>
25
 
<a name="l00007"></a>00007 <span class="comment">including without limitation the rights to use, copy, modify, merge, </span>
26
 
<a name="l00008"></a>00008 <span class="comment">publish, distribute, sublicense, and/or sell copies of the Software, </span>
27
 
<a name="l00009"></a>00009 <span class="comment">and to permit persons to whom the Software is furnished to do so, </span>
28
 
<a name="l00010"></a>00010 <span class="comment">subject to the following conditions:</span>
29
 
<a name="l00011"></a>00011 <span class="comment"></span>
30
 
<a name="l00012"></a>00012 <span class="comment">The above copyright notice and this permission notice shall be included </span>
31
 
<a name="l00013"></a>00013 <span class="comment">in all copies or substantial portions of the Software.</span>
32
 
<a name="l00014"></a>00014 <span class="comment"></span>
33
 
<a name="l00015"></a>00015 <span class="comment">THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, </span>
34
 
<a name="l00016"></a>00016 <span class="comment">EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES </span>
35
 
<a name="l00017"></a>00017 <span class="comment">OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. </span>
36
 
<a name="l00018"></a>00018 <span class="comment">IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, </span>
37
 
<a name="l00019"></a>00019 <span class="comment">DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, </span>
38
 
<a name="l00020"></a>00020 <span class="comment">ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR </span>
39
 
<a name="l00021"></a>00021 <span class="comment">OTHER DEALINGS IN THE SOFTWARE.</span>
40
 
<a name="l00022"></a>00022 <span class="comment">*/</span>
41
 
<a name="l00023"></a>00023 <span class="comment"></span>
42
 
<a name="l00024"></a>00024 <span class="comment">/** \example sample6.cpp</span>
43
 
<a name="l00025"></a>00025 <span class="comment"> This example demonstrates using of custom memory allocators.</span>
44
 
<a name="l00026"></a>00026 <span class="comment"> In this case allocator works as a memory checker, counts number of </span>
45
 
<a name="l00027"></a>00027 <span class="comment"> allocations and deallocations to make sure that there is no memory leaks. </span>
46
 
<a name="l00028"></a>00028 <span class="comment"></span>
47
 
<a name="l00029"></a>00029 <span class="comment">For more information please visit:  http://bmagic.sourceforge.net</span>
48
 
<a name="l00030"></a>00030 <span class="comment">*/</span>
49
 
<a name="l00031"></a>00031 
50
 
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;iostream&gt;</span>
51
 
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;assert.h&gt;</span>
52
 
<a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="a00082.html">bm.h</a>"</span>
53
 
<a name="l00035"></a>00035 
54
 
<a name="l00036"></a>00036 <span class="keyword">using namespace </span>std;
55
 
<a name="l00037"></a>00037 
56
 
<a name="l00038"></a>00038 
57
 
<a name="l00039"></a>00039 <span class="comment">// Custom allocator keeps number of all alloc/free calls.</span>
58
 
<a name="l00040"></a>00040 <span class="comment">// It also reservs the front word of the allocated block and saves</span>
59
 
<a name="l00041"></a>00041 <span class="comment">// number of elements allocated. On deallocation it makes sure</span>
60
 
<a name="l00042"></a>00042 <span class="comment">// it deallocates the same size as allocated</span>
61
 
<a name="l00043"></a>00043 
62
 
<a name="l00044"></a><a class="code" href="a00055.html">00044</a> <span class="keyword">class </span><a class="code" href="a00055.html">dbg_block_allocator</a>
63
 
<a name="l00045"></a>00045 {
64
 
<a name="l00046"></a>00046 <span class="keyword">public</span>:
65
 
<a name="l00047"></a><a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">00047</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">na_</a>;
66
 
<a name="l00048"></a><a class="code" href="a00055.html#adb605865e1f0ea195000e51e90001e6">00048</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00055.html#adb605865e1f0ea195000e51e90001e6">nf_</a>;
67
 
<a name="l00049"></a>00049 
68
 
<a name="l00050"></a><a class="code" href="a00055.html#93d82be8946cf5b72c9d7c6cb956e804">00050</a>     <span class="keyword">static</span> <a class="code" href="a00106.html#17fd5ba52db3ddda05e6f8dd5000a1a4">bm::word_t</a>* <a class="code" href="a00055.html#93d82be8946cf5b72c9d7c6cb956e804">allocate</a>(<span class="keywordtype">size_t</span> n, <span class="keyword">const</span> <span class="keywordtype">void</span> *)
69
 
<a name="l00051"></a>00051     {
70
 
<a name="l00052"></a>00052         ++<a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">na_</a>;
71
 
<a name="l00053"></a>00053         assert(n);
72
 
<a name="l00054"></a>00054         <a class="code" href="a00106.html#17fd5ba52db3ddda05e6f8dd5000a1a4">bm::word_t</a>* p =
73
 
<a name="l00055"></a>00055             (<a class="code" href="a00106.html#17fd5ba52db3ddda05e6f8dd5000a1a4">bm::word_t</a>*) ::malloc((n+1) * <span class="keyword">sizeof</span>(<a class="code" href="a00106.html#17fd5ba52db3ddda05e6f8dd5000a1a4">bm::word_t</a>));
74
 
<a name="l00056"></a>00056         *p = n;
75
 
<a name="l00057"></a>00057         <span class="keywordflow">return</span> ++p;
76
 
<a name="l00058"></a>00058     }
77
 
<a name="l00059"></a>00059 
78
 
<a name="l00060"></a><a class="code" href="a00055.html#56d40f419ba5f9e54b61d8ab88f93866">00060</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00055.html#56d40f419ba5f9e54b61d8ab88f93866">deallocate</a>(<a class="code" href="a00106.html#17fd5ba52db3ddda05e6f8dd5000a1a4">bm::word_t</a>* p, <span class="keywordtype">size_t</span> n)
79
 
<a name="l00061"></a>00061     {
80
 
<a name="l00062"></a>00062         ++<a class="code" href="a00055.html#adb605865e1f0ea195000e51e90001e6">nf_</a>;
81
 
<a name="l00063"></a>00063         --p;
82
 
<a name="l00064"></a>00064         assert(*p == n);
83
 
<a name="l00065"></a>00065         ::free(p);
84
 
<a name="l00066"></a>00066     }
85
 
<a name="l00067"></a>00067 
86
 
<a name="l00068"></a><a class="code" href="a00055.html#316046faa0e5010b9d4b4881977dde49">00068</a>     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="a00055.html#316046faa0e5010b9d4b4881977dde49">balance</a>()
87
 
<a name="l00069"></a>00069     {
88
 
<a name="l00070"></a>00070         <span class="keywordflow">return</span> <a class="code" href="a00055.html#adb605865e1f0ea195000e51e90001e6">nf_</a> - <a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">na_</a>;
89
 
<a name="l00071"></a>00071     }
90
 
<a name="l00072"></a>00072 };
91
 
<a name="l00073"></a>00073 
92
 
<a name="l00074"></a>00074 <span class="keywordtype">unsigned</span> <a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">dbg_block_allocator::na_</a> = 0;
93
 
<a name="l00075"></a>00075 <span class="keywordtype">unsigned</span> <a class="code" href="a00055.html#adb605865e1f0ea195000e51e90001e6">dbg_block_allocator::nf_</a> = 0;
94
 
<a name="l00076"></a>00076 
95
 
<a name="l00077"></a><a class="code" href="a00056.html">00077</a> <span class="keyword">class </span><a class="code" href="a00056.html">dbg_ptr_allocator</a>
96
 
<a name="l00078"></a>00078 {
97
 
<a name="l00079"></a>00079 <span class="keyword">public</span>:
98
 
<a name="l00080"></a><a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">00080</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">na_</a>;
99
 
<a name="l00081"></a><a class="code" href="a00056.html#fbbe7e12818ba2c51358b66d00fc05f0">00081</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00056.html#fbbe7e12818ba2c51358b66d00fc05f0">nf_</a>;
100
 
<a name="l00082"></a>00082 
101
 
<a name="l00083"></a><a class="code" href="a00056.html#15a6c29419ebabc9221051cdd63e9495">00083</a>     <span class="keyword">static</span> <span class="keywordtype">void</span>* <a class="code" href="a00056.html#15a6c29419ebabc9221051cdd63e9495">allocate</a>(<span class="keywordtype">size_t</span> n, <span class="keyword">const</span> <span class="keywordtype">void</span> *)
102
 
<a name="l00084"></a>00084     {
103
 
<a name="l00085"></a>00085         ++<a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">na_</a>;
104
 
<a name="l00086"></a>00086         assert(<span class="keyword">sizeof</span>(<span class="keywordtype">size_t</span>) == <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*));
105
 
<a name="l00087"></a>00087         <span class="keywordtype">void</span>* p = ::malloc((n+1) * <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*));
106
 
<a name="l00088"></a>00088         <span class="keywordtype">size_t</span>* s = (<span class="keywordtype">size_t</span>*) p;
107
 
<a name="l00089"></a>00089         *s = n;
108
 
<a name="l00090"></a>00090         <span class="keywordflow">return</span> (<span class="keywordtype">void</span>*)++s;
109
 
<a name="l00091"></a>00091     }
110
 
<a name="l00092"></a>00092 
111
 
<a name="l00093"></a><a class="code" href="a00056.html#89cd3e8e84ef4a4598446ba8fa8c10a3">00093</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00056.html#89cd3e8e84ef4a4598446ba8fa8c10a3">deallocate</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">size_t</span> n)
112
 
<a name="l00094"></a>00094     {
113
 
<a name="l00095"></a>00095         ++<a class="code" href="a00056.html#fbbe7e12818ba2c51358b66d00fc05f0">nf_</a>;
114
 
<a name="l00096"></a>00096         <span class="keywordtype">size_t</span>* s = (<span class="keywordtype">size_t</span>*) p;
115
 
<a name="l00097"></a>00097         --s;
116
 
<a name="l00098"></a>00098         assert(*s == n);
117
 
<a name="l00099"></a>00099         ::free(s);
118
 
<a name="l00100"></a>00100     }
119
 
<a name="l00101"></a>00101 
120
 
<a name="l00102"></a><a class="code" href="a00056.html#521bc1068c669de23dc20d582d229918">00102</a>     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="a00056.html#521bc1068c669de23dc20d582d229918">balance</a>()
121
 
<a name="l00103"></a>00103     {
122
 
<a name="l00104"></a>00104         <span class="keywordflow">return</span> <a class="code" href="a00056.html#fbbe7e12818ba2c51358b66d00fc05f0">nf_</a> - <a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">na_</a>;
123
 
<a name="l00105"></a>00105     }
124
 
<a name="l00106"></a>00106 
125
 
<a name="l00107"></a>00107 };
126
 
<a name="l00108"></a>00108 
127
 
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">dbg_ptr_allocator::na_</a> = 0;
128
 
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <a class="code" href="a00056.html#fbbe7e12818ba2c51358b66d00fc05f0">dbg_ptr_allocator::nf_</a> = 0;
129
 
<a name="l00111"></a>00111 
130
 
<a name="l00112"></a>00112 
131
 
<a name="l00113"></a><a class="code" href="a00102.html#a932e8e72ba07938f1a001b6cfcb614e">00113</a> <span class="keyword">typedef</span> <a class="code" href="a00073.html" title="BM style allocator adapter.">bm::mem_alloc&lt;dbg_block_allocator, dbg_ptr_allocator&gt;</a> <a class="code" href="a00073.html" title="BM style allocator adapter.">dbg_alloc</a>;
132
 
<a name="l00114"></a>00114 
133
 
<a name="l00115"></a><a class="code" href="a00102.html#c07bb102df543a0c581493c5f35b2129">00115</a> <span class="keyword">typedef</span> <a class="code" href="a00040.html" title="bitvector with runtime compression of bits.">bm::bvector&lt;dbg_alloc&gt;</a> <a class="code" href="a00040.html" title="bitvector with runtime compression of bits.">bvect</a>;
134
 
<a name="l00116"></a>00116 
135
 
<a name="l00117"></a>00117 
136
 
<a name="l00118"></a>00118 
137
 
<a name="l00119"></a><a class="code" href="a00102.html#840291bc02cba5474a4cb46a9b9566fe">00119</a> <span class="keywordtype">int</span> <a class="code" href="a00097.html#840291bc02cba5474a4cb46a9b9566fe">main</a>(<span class="keywordtype">void</span>)
138
 
<a name="l00120"></a>00120 {
139
 
<a name="l00121"></a>00121     {
140
 
<a name="l00122"></a>00122         <a class="code" href="a00040.html" title="bitvector with runtime compression of bits.">bvect</a> bv;
141
 
<a name="l00123"></a>00123 
142
 
<a name="l00124"></a>00124         bv[10] = <span class="keyword">true</span>;
143
 
<a name="l00125"></a>00125         bv[100000] = <span class="keyword">true</span>;
144
 
<a name="l00126"></a>00126         bv[10000000] = <span class="keyword">false</span>;
145
 
<a name="l00127"></a>00127     }
146
 
<a name="l00128"></a>00128 
147
 
<a name="l00129"></a>00129     cout &lt;&lt; <span class="stringliteral">"Number of BLOCK allocations = "</span> &lt;&lt;  <a class="code" href="a00055.html#2e3f8148fefdb34093ebf3db55b6175b">dbg_block_allocator::na_</a> &lt;&lt; endl;
148
 
<a name="l00130"></a>00130     cout &lt;&lt; <span class="stringliteral">"Number of PTR allocations = "</span> &lt;&lt;  <a class="code" href="a00056.html#1839c318b76fefce64ba0a0aba52e2b0">dbg_ptr_allocator::na_</a> &lt;&lt; endl;
149
 
<a name="l00131"></a>00131 
150
 
<a name="l00132"></a>00132     assert(<a class="code" href="a00055.html#316046faa0e5010b9d4b4881977dde49">dbg_block_allocator::balance</a>() == 0);
151
 
<a name="l00133"></a>00133     assert(<a class="code" href="a00056.html#521bc1068c669de23dc20d582d229918">dbg_ptr_allocator::balance</a>() == 0);
152
 
<a name="l00134"></a>00134 
153
 
<a name="l00135"></a>00135     <span class="keywordflow">return</span> 0;
154
 
<a name="l00136"></a>00136 }
155
 
<a name="l00137"></a>00137 
156
 
<a name="l00138"></a>00138   
157
 
</pre></div></div>
158
 
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Oct 12 12:16:39 2009 for BitMagic by&nbsp;
 
22
</div>
 
23
<div class="contents">
 
24
<h1>Set algorithms<br/>
 
25
<small>
 
26
[<a class="el" href="a00117.html">BitMagic C++ Library</a>]</small>
 
27
</h1>
 
28
<p><div class="dynheader">
 
29
Collaboration diagram for Set algorithms:</div>
 
30
<div class="dynsection">
 
31
<center><table><tr><td><img src="a00124.png" border="0" alt="" usemap="#a00124_map"/>
 
32
<map name="a00124_map" id="a00124">
 
33
<area shape="rect" href="a00117.html" title="For more information please visit: http://bmagic.sourceforge.net." alt="" coords="5,5,149,35"/><area shape="rect" href="a00125.html" title="Distance metrics" alt="" coords="352,5,472,35"/></map></td></tr></table></center>
 
34
</div>
 
35
</p>
 
36
<table border="0" cellpadding="0" cellspacing="0">
 
37
<tr><td colspan="2"><h2>Data Structures</h2></td></tr>
 
38
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00079.html">bm::random_subset&lt; BV &gt;</a></td></tr>
 
39
<tr><td colspan="2"><h2>Modules</h2></td></tr>
 
40
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00125.html">Distance metrics</a></td></tr>
 
41
<tr><td colspan="2"><h2>Functions</h2></td></tr>
 
42
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
43
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#ga54ff78528c99ae3ca443eb99ba44785b">bm::combine_or</a> (BV &amp;bv, It first, It last)</td></tr>
 
44
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">OR Combine bitvector and the iterable sequence.  <a href="#ga54ff78528c99ae3ca443eb99ba44785b"></a><br/></td></tr>
 
45
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
46
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#ga3cb362aee03de6a321495100ae5c8375">bm::combine_xor</a> (BV &amp;bv, It first, It last)</td></tr>
 
47
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">XOR Combine bitvector and the iterable sequence.  <a href="#ga3cb362aee03de6a321495100ae5c8375"></a><br/></td></tr>
 
48
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
49
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#gab88c5bf51484323e0139aa789d7f0b98">bm::combine_sub</a> (BV &amp;bv, It first, It last)</td></tr>
 
50
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">SUB Combine bitvector and the iterable sequence.  <a href="#gab88c5bf51484323e0139aa789d7f0b98"></a><br/></td></tr>
 
51
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
52
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#ga22922f71bd1eec8a5b663dc77b90cf6c">bm::combine_and_sorted</a> (BV &amp;bv, It first, It last)</td></tr>
 
53
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">AND Combine bitvector and the iterable sequence.  <a href="#ga22922f71bd1eec8a5b663dc77b90cf6c"></a><br/></td></tr>
 
54
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
55
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#ga819bdab57a624a08456ea79161b9c5d2">bm::combine_and</a> (BV &amp;bv, It first, It last)</td></tr>
 
56
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">AND Combine bitvector and the iterable sequence.  <a href="#ga819bdab57a624a08456ea79161b9c5d2"></a><br/></td></tr>
 
57
<tr><td class="memTemplParams" colspan="2">template&lt;class BV &gt; </td></tr>
 
58
<tr><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="a00115.html#aa3824d882a037396370b16f2f0a8bf37">bm::id_t</a>&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#gac7a59d3bc266310ec127cb3efadb0d33">bm::count_intervals</a> (const BV &amp;bv)</td></tr>
 
59
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute number of bit intervals (GAPs) in the bitvector.  <a href="#gac7a59d3bc266310ec127cb3efadb0d33"></a><br/></td></tr>
 
60
<tr><td class="memTemplParams" colspan="2">template&lt;class BV , class It &gt; </td></tr>
 
61
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00124.html#gacd88ed9539553dd93419b7029e8a4584">bm::export_array</a> (BV &amp;bv, It first, It last)</td></tr>
 
62
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Export bitset from an array of binary data representing the bit vector.  <a href="#gacd88ed9539553dd93419b7029e8a4584"></a><br/></td></tr>
 
63
</table>
 
64
<hr/><a name="_details"></a><h2>Detailed Description</h2>
 
65
<p>Set algorithms </p>
 
66
<hr/><h2>Function Documentation</h2>
 
67
<a class="anchor" id="ga819bdab57a624a08456ea79161b9c5d2"></a><!-- doxytag: member="bm::combine_and" ref="ga819bdab57a624a08456ea79161b9c5d2" args="(BV &amp;bv, It first, It last)" -->
 
68
<div class="memitem">
 
69
<div class="memproto">
 
70
<div class="memtemplate">
 
71
template&lt;class BV , class It &gt; </div>
 
72
      <table class="memname">
 
73
        <tr>
 
74
          <td class="memname">void bm::combine_and </td>
 
75
          <td>(</td>
 
76
          <td class="paramtype">BV &amp;&nbsp;</td>
 
77
          <td class="paramname"> <em>bv</em>, </td>
 
78
        </tr>
 
79
        <tr>
 
80
          <td class="paramkey"></td>
 
81
          <td></td>
 
82
          <td class="paramtype">It&nbsp;</td>
 
83
          <td class="paramname"> <em>first</em>, </td>
 
84
        </tr>
 
85
        <tr>
 
86
          <td class="paramkey"></td>
 
87
          <td></td>
 
88
          <td class="paramtype">It&nbsp;</td>
 
89
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
90
        </tr>
 
91
        <tr>
 
92
          <td></td>
 
93
          <td>)</td>
 
94
          <td></td><td></td><td><code> [inline]</code></td>
 
95
        </tr>
 
96
      </table>
 
97
</div>
 
98
<div class="memdoc">
 
99
 
 
100
<p>AND Combine bitvector and the iterable sequence. </p>
 
101
<p>Algorithm combines <a class="el" href="a00044.html" title="bitvector with runtime compression of bits.">bvector</a> with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.</p>
 
102
<dl><dt><b>Parameters:</b></dt><dd>
 
103
  <table border="0" cellspacing="2" cellpadding="0">
 
104
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
105
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
106
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence</td></tr>
 
107
  </table>
 
108
  </dd>
 
109
</dl>
 
110
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00124.html#ga22922f71bd1eec8a5b663dc77b90cf6c" title="AND Combine bitvector and the iterable sequence.">combine_and_sorted</a> </dd></dl>
 
111
 
 
112
<p>Definition at line <a class="el" href="a00089_source.html#l01382">1382</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
113
 
 
114
<p>References <a class="el" href="a00089_source.html#l01105">bm::combine_or()</a>.</p>
 
115
 
 
116
</div>
 
117
</div>
 
118
<a class="anchor" id="ga22922f71bd1eec8a5b663dc77b90cf6c"></a><!-- doxytag: member="bm::combine_and_sorted" ref="ga22922f71bd1eec8a5b663dc77b90cf6c" args="(BV &amp;bv, It first, It last)" -->
 
119
<div class="memitem">
 
120
<div class="memproto">
 
121
<div class="memtemplate">
 
122
template&lt;class BV , class It &gt; </div>
 
123
      <table class="memname">
 
124
        <tr>
 
125
          <td class="memname">void bm::combine_and_sorted </td>
 
126
          <td>(</td>
 
127
          <td class="paramtype">BV &amp;&nbsp;</td>
 
128
          <td class="paramname"> <em>bv</em>, </td>
 
129
        </tr>
 
130
        <tr>
 
131
          <td class="paramkey"></td>
 
132
          <td></td>
 
133
          <td class="paramtype">It&nbsp;</td>
 
134
          <td class="paramname"> <em>first</em>, </td>
 
135
        </tr>
 
136
        <tr>
 
137
          <td class="paramkey"></td>
 
138
          <td></td>
 
139
          <td class="paramtype">It&nbsp;</td>
 
140
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
141
        </tr>
 
142
        <tr>
 
143
          <td></td>
 
144
          <td>)</td>
 
145
          <td></td><td></td><td><code> [inline]</code></td>
 
146
        </tr>
 
147
      </table>
 
148
</div>
 
149
<div class="memdoc">
 
150
 
 
151
<p>AND Combine bitvector and the iterable sequence. </p>
 
152
<p>Algorithm combines <a class="el" href="a00044.html" title="bitvector with runtime compression of bits.">bvector</a> with sorted sequence of integers (represents another set).</p>
 
153
<dl><dt><b>Parameters:</b></dt><dd>
 
154
  <table border="0" cellspacing="2" cellpadding="0">
 
155
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
156
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
157
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
 
158
  </table>
 
159
  </dd>
 
160
</dl>
 
161
 
 
162
<p>Definition at line <a class="el" href="a00089_source.html#l01350">1350</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
163
 
 
164
<p>References <a class="el" href="a00092_source.html#l00050">BM_ASSERT</a>.</p>
 
165
 
 
166
</div>
 
167
</div>
 
168
<a class="anchor" id="ga54ff78528c99ae3ca443eb99ba44785b"></a><!-- doxytag: member="bm::combine_or" ref="ga54ff78528c99ae3ca443eb99ba44785b" args="(BV &amp;bv, It first, It last)" -->
 
169
<div class="memitem">
 
170
<div class="memproto">
 
171
<div class="memtemplate">
 
172
template&lt;class BV , class It &gt; </div>
 
173
      <table class="memname">
 
174
        <tr>
 
175
          <td class="memname">void bm::combine_or </td>
 
176
          <td>(</td>
 
177
          <td class="paramtype">BV &amp;&nbsp;</td>
 
178
          <td class="paramname"> <em>bv</em>, </td>
 
179
        </tr>
 
180
        <tr>
 
181
          <td class="paramkey"></td>
 
182
          <td></td>
 
183
          <td class="paramtype">It&nbsp;</td>
 
184
          <td class="paramname"> <em>first</em>, </td>
 
185
        </tr>
 
186
        <tr>
 
187
          <td class="paramkey"></td>
 
188
          <td></td>
 
189
          <td class="paramtype">It&nbsp;</td>
 
190
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
191
        </tr>
 
192
        <tr>
 
193
          <td></td>
 
194
          <td>)</td>
 
195
          <td></td><td></td><td><code> [inline]</code></td>
 
196
        </tr>
 
197
      </table>
 
198
</div>
 
199
<div class="memdoc">
 
200
 
 
201
<p>OR Combine bitvector and the iterable sequence. </p>
 
202
<p>Algorithm combines <a class="el" href="a00044.html" title="bitvector with runtime compression of bits.">bvector</a> with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.</p>
 
203
<dl><dt><b>Parameters:</b></dt><dd>
 
204
  <table border="0" cellspacing="2" cellpadding="0">
 
205
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
206
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
207
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
 
208
  </table>
 
209
  </dd>
 
210
</dl>
 
211
 
 
212
<p>Definition at line <a class="el" href="a00089_source.html#l01105">1105</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
213
 
 
214
<p>References <a class="el" href="a00089_source.html#l01075">bm::block_range_scan()</a>, <a class="el" href="a00092_source.html#l00050">BM_ASSERT</a>, <a class="el" href="a00092_source.html#l00095">BMGAP_PTR</a>, <a class="el" href="a00093_source.html#l02186">bm::gap_limit()</a>, <a class="el" href="a00093_source.html#l01133">bm::gap_set_value()</a>, <a class="el" href="a00091_source.html#l00048">bm::id_max</a>, <a class="el" href="a00091_source.html#l00054">bm::set_block_mask</a>, <a class="el" href="a00091_source.html#l00053">bm::set_block_shift</a>, <a class="el" href="a00091_source.html#l00063">bm::set_word_mask</a>, and <a class="el" href="a00091_source.html#l00062">bm::set_word_shift</a>.</p>
 
215
 
 
216
<p>Referenced by <a class="el" href="a00089_source.html#l01382">bm::combine_and()</a>.</p>
 
217
 
 
218
</div>
 
219
</div>
 
220
<a class="anchor" id="gab88c5bf51484323e0139aa789d7f0b98"></a><!-- doxytag: member="bm::combine_sub" ref="gab88c5bf51484323e0139aa789d7f0b98" args="(BV &amp;bv, It first, It last)" -->
 
221
<div class="memitem">
 
222
<div class="memproto">
 
223
<div class="memtemplate">
 
224
template&lt;class BV , class It &gt; </div>
 
225
      <table class="memname">
 
226
        <tr>
 
227
          <td class="memname">void bm::combine_sub </td>
 
228
          <td>(</td>
 
229
          <td class="paramtype">BV &amp;&nbsp;</td>
 
230
          <td class="paramname"> <em>bv</em>, </td>
 
231
        </tr>
 
232
        <tr>
 
233
          <td class="paramkey"></td>
 
234
          <td></td>
 
235
          <td class="paramtype">It&nbsp;</td>
 
236
          <td class="paramname"> <em>first</em>, </td>
 
237
        </tr>
 
238
        <tr>
 
239
          <td class="paramkey"></td>
 
240
          <td></td>
 
241
          <td class="paramtype">It&nbsp;</td>
 
242
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
243
        </tr>
 
244
        <tr>
 
245
          <td></td>
 
246
          <td>)</td>
 
247
          <td></td><td></td><td><code> [inline]</code></td>
 
248
        </tr>
 
249
      </table>
 
250
</div>
 
251
<div class="memdoc">
 
252
 
 
253
<p>SUB Combine bitvector and the iterable sequence. </p>
 
254
<p>Algorithm combines <a class="el" href="a00044.html" title="bitvector with runtime compression of bits.">bvector</a> with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.</p>
 
255
<dl><dt><b>Parameters:</b></dt><dd>
 
256
  <table border="0" cellspacing="2" cellpadding="0">
 
257
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
258
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
259
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
 
260
  </table>
 
261
  </dd>
 
262
</dl>
 
263
 
 
264
<p>Definition at line <a class="el" href="a00089_source.html#l01268">1268</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
265
 
 
266
<p>References <a class="el" href="a00089_source.html#l01075">bm::block_range_scan()</a>, <a class="el" href="a00092_source.html#l00050">BM_ASSERT</a>, <a class="el" href="a00092_source.html#l00095">BMGAP_PTR</a>, <a class="el" href="a00093_source.html#l02186">bm::gap_limit()</a>, <a class="el" href="a00093_source.html#l01133">bm::gap_set_value()</a>, <a class="el" href="a00093_source.html#l00489">bm::gap_test()</a>, <a class="el" href="a00091_source.html#l00048">bm::id_max</a>, <a class="el" href="a00091_source.html#l00054">bm::set_block_mask</a>, <a class="el" href="a00091_source.html#l00053">bm::set_block_shift</a>, <a class="el" href="a00091_source.html#l00063">bm::set_word_mask</a>, and <a class="el" href="a00091_source.html#l00062">bm::set_word_shift</a>.</p>
 
267
 
 
268
</div>
 
269
</div>
 
270
<a class="anchor" id="ga3cb362aee03de6a321495100ae5c8375"></a><!-- doxytag: member="bm::combine_xor" ref="ga3cb362aee03de6a321495100ae5c8375" args="(BV &amp;bv, It first, It last)" -->
 
271
<div class="memitem">
 
272
<div class="memproto">
 
273
<div class="memtemplate">
 
274
template&lt;class BV , class It &gt; </div>
 
275
      <table class="memname">
 
276
        <tr>
 
277
          <td class="memname">void bm::combine_xor </td>
 
278
          <td>(</td>
 
279
          <td class="paramtype">BV &amp;&nbsp;</td>
 
280
          <td class="paramname"> <em>bv</em>, </td>
 
281
        </tr>
 
282
        <tr>
 
283
          <td class="paramkey"></td>
 
284
          <td></td>
 
285
          <td class="paramtype">It&nbsp;</td>
 
286
          <td class="paramname"> <em>first</em>, </td>
 
287
        </tr>
 
288
        <tr>
 
289
          <td class="paramkey"></td>
 
290
          <td></td>
 
291
          <td class="paramtype">It&nbsp;</td>
 
292
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
293
        </tr>
 
294
        <tr>
 
295
          <td></td>
 
296
          <td>)</td>
 
297
          <td></td><td></td><td><code> [inline]</code></td>
 
298
        </tr>
 
299
      </table>
 
300
</div>
 
301
<div class="memdoc">
 
302
 
 
303
<p>XOR Combine bitvector and the iterable sequence. </p>
 
304
<p>Algorithm combines <a class="el" href="a00044.html" title="bitvector with runtime compression of bits.">bvector</a> with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.</p>
 
305
<dl><dt><b>Parameters:</b></dt><dd>
 
306
  <table border="0" cellspacing="2" cellpadding="0">
 
307
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
308
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
309
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
 
310
  </table>
 
311
  </dd>
 
312
</dl>
 
313
 
 
314
<p>Definition at line <a class="el" href="a00089_source.html#l01184">1184</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
315
 
 
316
<p>References <a class="el" href="a00089_source.html#l01075">bm::block_range_scan()</a>, <a class="el" href="a00092_source.html#l00050">BM_ASSERT</a>, <a class="el" href="a00092_source.html#l00095">BMGAP_PTR</a>, <a class="el" href="a00093_source.html#l02186">bm::gap_limit()</a>, <a class="el" href="a00093_source.html#l01133">bm::gap_set_value()</a>, <a class="el" href="a00093_source.html#l00489">bm::gap_test()</a>, <a class="el" href="a00091_source.html#l00048">bm::id_max</a>, <a class="el" href="a00091_source.html#l00054">bm::set_block_mask</a>, <a class="el" href="a00091_source.html#l00053">bm::set_block_shift</a>, <a class="el" href="a00091_source.html#l00063">bm::set_word_mask</a>, and <a class="el" href="a00091_source.html#l00062">bm::set_word_shift</a>.</p>
 
317
 
 
318
</div>
 
319
</div>
 
320
<a class="anchor" id="gac7a59d3bc266310ec127cb3efadb0d33"></a><!-- doxytag: member="bm::count_intervals" ref="gac7a59d3bc266310ec127cb3efadb0d33" args="(const BV &amp;bv)" -->
 
321
<div class="memitem">
 
322
<div class="memproto">
 
323
<div class="memtemplate">
 
324
template&lt;class BV &gt; </div>
 
325
      <table class="memname">
 
326
        <tr>
 
327
          <td class="memname"><a class="el" href="a00115.html#aa3824d882a037396370b16f2f0a8bf37">bm::id_t</a> bm::count_intervals </td>
 
328
          <td>(</td>
 
329
          <td class="paramtype">const BV &amp;&nbsp;</td>
 
330
          <td class="paramname"> <em>bv</em></td>
 
331
          <td>&nbsp;)&nbsp;</td>
 
332
          <td><code> [inline]</code></td>
 
333
        </tr>
 
334
      </table>
 
335
</div>
 
336
<div class="memdoc">
 
337
 
 
338
<p>Compute number of bit intervals (GAPs) in the bitvector. </p>
 
339
<p>Algorithm traverses bit vector and count number of uninterrupted intervals of 1s and 0s. </p>
 
340
<pre>
 
341
    For example: 
 
342
      00001111100000 - gives us 3 intervals
 
343
      10001111100000 - 4 intervals
 
344
      00000000000000 - 1 interval
 
345
      11111111111111 - 1 interval
 
346
    </pre> <dl class="return"><dt><b>Returns:</b></dt><dd>Number of intervals </dd></dl>
 
347
 
 
348
<p>Definition at line <a class="el" href="a00089_source.html#l01405">1405</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
349
 
 
350
<p>References <a class="el" href="a00093_source.html#l00592">bm::for_each_block()</a>, and <a class="el" href="a00091_source.html#l00080">bm::set_array_size</a>.</p>
 
351
 
 
352
</div>
 
353
</div>
 
354
<a class="anchor" id="gacd88ed9539553dd93419b7029e8a4584"></a><!-- doxytag: member="bm::export_array" ref="gacd88ed9539553dd93419b7029e8a4584" args="(BV &amp;bv, It first, It last)" -->
 
355
<div class="memitem">
 
356
<div class="memproto">
 
357
<div class="memtemplate">
 
358
template&lt;class BV , class It &gt; </div>
 
359
      <table class="memname">
 
360
        <tr>
 
361
          <td class="memname">void bm::export_array </td>
 
362
          <td>(</td>
 
363
          <td class="paramtype">BV &amp;&nbsp;</td>
 
364
          <td class="paramname"> <em>bv</em>, </td>
 
365
        </tr>
 
366
        <tr>
 
367
          <td class="paramkey"></td>
 
368
          <td></td>
 
369
          <td class="paramtype">It&nbsp;</td>
 
370
          <td class="paramname"> <em>first</em>, </td>
 
371
        </tr>
 
372
        <tr>
 
373
          <td class="paramkey"></td>
 
374
          <td></td>
 
375
          <td class="paramtype">It&nbsp;</td>
 
376
          <td class="paramname"> <em>last</em></td><td>&nbsp;</td>
 
377
        </tr>
 
378
        <tr>
 
379
          <td></td>
 
380
          <td>)</td>
 
381
          <td></td><td></td><td><code> [inline]</code></td>
 
382
        </tr>
 
383
      </table>
 
384
</div>
 
385
<div class="memdoc">
 
386
 
 
387
<p>Export bitset from an array of binary data representing the bit vector. </p>
 
388
<p>Input array can be array of ints, chars or other native C types. Method works with iterators, which makes it compatible with STL containers and C arrays</p>
 
389
<dl><dt><b>Parameters:</b></dt><dd>
 
390
  <table border="0" cellspacing="2" cellpadding="0">
 
391
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
 
392
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
 
393
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
 
394
  </table>
 
395
  </dd>
 
396
</dl>
 
397
 
 
398
<p>Definition at line <a class="el" href="a00089_source.html#l01431">1431</a> of file <a class="el" href="a00089_source.html">bmalgo_impl.h</a>.</p>
 
399
 
 
400
<p>References <a class="el" href="a00092_source.html#l00050">BM_ASSERT</a>, <a class="el" href="a00091_source.html#l00116">bm::BM_BIT</a>, <a class="el" href="a00092_source.html#l00095">BMGAP_PTR</a>, <a class="el" href="a00091_source.html#l00052">bm::set_block_size</a>, and <a class="el" href="a00091_source.html#l00083">bm::set_total_blocks</a>.</p>
 
401
 
 
402
</div>
 
403
</div>
 
404
</div>
 
405
<hr size="1"/><address style="text-align: right;"><small>Generated on Fri Jan 8 20:09:20 2010 for BitMagic by&nbsp;
159
406
<a href="http://www.doxygen.org/index.html">
160
 
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
 
407
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
161
408
</body>
162
409
</html>