1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
<!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"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Boost.AFIO: boost::afio::v2_xxx::utils Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Boost.AFIO
 <span id="projectnumber">v2.00 early alpha</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.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 Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><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="namespaces.html"><span>Namespace List</span></a></li>
<li><a href="namespacemembers.html"><span>Namespace Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html','');});
</script>
<div id="doc-content">
<!-- 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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark"> </span>Pages</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>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">boost::afio::v2_xxx::utils Namespace Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Utility routines often useful when using AFIO.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1afio_1_1v2__xxx_1_1utils_1_1page__allocator.html">page_allocator</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">An STL allocator which allocates large TLB page memory.If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator <em>may</em> be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified. <a href="classboost_1_1afio_1_1v2__xxx_1_1utils_1_1page__allocator.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1afio_1_1v2__xxx_1_1utils_1_1page__allocator_3_01void_01_4.html">page_allocator< void ></a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a65bcb0fefe7e1e3a29e04000f250137c"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a65bcb0fefe7e1e3a29e04000f250137c">page_size</a> () noexcept</td></tr>
<tr class="memdesc:a65bcb0fefe7e1e3a29e04000f250137c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the smallest page size of this architecture which is useful for calculating direct i/o multiples. <a href="#a65bcb0fefe7e1e3a29e04000f250137c">More...</a><br/></td></tr>
<tr class="separator:a65bcb0fefe7e1e3a29e04000f250137c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a78d32bc4017ad31d5163bf2e4a72160e"><td class="memTemplParams" colspan="2"><a class="anchor" id="a78d32bc4017ad31d5163bf2e4a72160e"></a>
template<class T > </td></tr>
<tr class="memitem:a78d32bc4017ad31d5163bf2e4a72160e"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a78d32bc4017ad31d5163bf2e4a72160e">round_down_to_page_size</a> (T i) noexcept</td></tr>
<tr class="memdesc:a78d32bc4017ad31d5163bf2e4a72160e"><td class="mdescLeft"> </td><td class="mdescRight">Round a value to its next lowest page size multiple. <br/></td></tr>
<tr class="separator:a78d32bc4017ad31d5163bf2e4a72160e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a36c48e9298fe3178c539d1ba839153f2"><td class="memTemplParams" colspan="2"><a class="anchor" id="a36c48e9298fe3178c539d1ba839153f2"></a>
template<class T > </td></tr>
<tr class="memitem:a36c48e9298fe3178c539d1ba839153f2"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a36c48e9298fe3178c539d1ba839153f2">round_up_to_page_size</a> (T i) noexcept</td></tr>
<tr class="memdesc:a36c48e9298fe3178c539d1ba839153f2"><td class="mdescLeft"> </td><td class="mdescRight">Round a value to its next highest page size multiple. <br/></td></tr>
<tr class="separator:a36c48e9298fe3178c539d1ba839153f2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8d1e739f2d7486e7dc74d74d699691ba"><td class="memTemplParams" colspan="2"><a class="anchor" id="a8d1e739f2d7486e7dc74d74d699691ba"></a>
template<class T > </td></tr>
<tr class="memitem:a8d1e739f2d7486e7dc74d74d699691ba"><td class="memTemplItemLeft" align="right" valign="top">std::pair< T *, size_t > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a8d1e739f2d7486e7dc74d74d699691ba">round_to_page_size</a> (std::pair< T *, size_t > i) noexcept</td></tr>
<tr class="memdesc:a8d1e739f2d7486e7dc74d74d699691ba"><td class="mdescLeft"> </td><td class="mdescRight">Round a pair of a pointer and a size_t to their nearest page size multiples. The pointer will be rounded down, the size_t upwards. <br/></td></tr>
<tr class="separator:a8d1e739f2d7486e7dc74d74d699691ba"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae63332cddaecd2a30b839856c7d5fe0e"><td class="memItemLeft" align="right" valign="top">std::vector< size_t > </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#ae63332cddaecd2a30b839856c7d5fe0e">page_sizes</a> (bool only_actually_available=true)</td></tr>
<tr class="memdesc:ae63332cddaecd2a30b839856c7d5fe0e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the page sizes of this architecture which is useful for calculating direct i/o multiples. <a href="#ae63332cddaecd2a30b839856c7d5fe0e">More...</a><br/></td></tr>
<tr class="separator:ae63332cddaecd2a30b839856c7d5fe0e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a372dccddba2f36695a095dbe98474f1a"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a372dccddba2f36695a095dbe98474f1a">file_buffer_default_size</a> () noexcept</td></tr>
<tr class="memdesc:a372dccddba2f36695a095dbe98474f1a"><td class="mdescLeft"> </td><td class="mdescRight">Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb. <a href="#a372dccddba2f36695a095dbe98474f1a">More...</a><br/></td></tr>
<tr class="separator:a372dccddba2f36695a095dbe98474f1a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac7b89428cdd460548bd9a645a6565df4"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#ac7b89428cdd460548bd9a645a6565df4">random_fill</a> (char *buffer, size_t bytes)</td></tr>
<tr class="memdesc:ac7b89428cdd460548bd9a645a6565df4"><td class="mdescLeft"> </td><td class="mdescRight">Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API. <a href="#ac7b89428cdd460548bd9a645a6565df4">More...</a><br/></td></tr>
<tr class="separator:ac7b89428cdd460548bd9a645a6565df4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a051e8deb72941b3460811a1cf5f29915"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#a051e8deb72941b3460811a1cf5f29915">random_string</a> (size_t randomlen)</td></tr>
<tr class="memdesc:a051e8deb72941b3460811a1cf5f29915"><td class="mdescLeft"> </td><td class="mdescRight">Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string(). <a href="#a051e8deb72941b3460811a1cf5f29915">More...</a><br/></td></tr>
<tr class="separator:a051e8deb72941b3460811a1cf5f29915"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2c5271d7226a6ba7a59c8c3c476c5442"><td class="memTemplParams" colspan="2"><a class="anchor" id="a2c5271d7226a6ba7a59c8c3c476c5442"></a>
template<class T , class U > </td></tr>
<tr class="memitem:a2c5271d7226a6ba7a59c8c3c476c5442"><td class="memTemplItemLeft" align="right" valign="top">bool </td><td class="memTemplItemRight" valign="bottom"><b>operator==</b> (const <a class="el" href="classboost_1_1afio_1_1v2__xxx_1_1utils_1_1page__allocator.html">page_allocator</a>< T > &, const <a class="el" href="classboost_1_1afio_1_1v2__xxx_1_1utils_1_1page__allocator.html">page_allocator</a>< U > &) noexcept</td></tr>
<tr class="separator:a2c5271d7226a6ba7a59c8c3c476c5442"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Utility routines often useful when using AFIO. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a372dccddba2f36695a095dbe98474f1a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t boost::afio::v2_xxx::utils::file_buffer_default_size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb. </p>
<dl class="section return"><dt>Returns</dt><dd>A value of a TLB large page size close to 1Mb.</dd></dl>
<dl class="section user"><dt>Complexity</dt><dd>Whatever the system API takes (one would hope constant time). </dd></dl>
<dl class="section user"><dt>Errors returnable</dt><dd>Any error from the operating system or std::bad_alloc. </dd></dl>
<div class="fragment"><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  {</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keyword">static</span> <span class="keywordtype">size_t</span> size;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">if</span>(!size)</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  {</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  std::vector<size_t> sizes(<a class="code" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#ae63332cddaecd2a30b839856c7d5fe0e" title="Returns the page sizes of this architecture which is useful for calculating direct i/o multiples...">page_sizes</a>(<span class="keyword">true</span>));</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span> &i : sizes)</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span>(i >= 1024 * 1024)</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  {</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  size = i;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  }</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">if</span>(!size)</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  size = 1024 * 1024;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  }</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">return</span> size;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a65bcb0fefe7e1e3a29e04000f250137c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t boost::afio::v2_xxx::utils::page_size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the smallest page size of this architecture which is useful for calculating direct i/o multiples. </p>
<dl class="section return"><dt>Returns</dt><dd>The page size of this architecture.</dd></dl>
<dl class="section user"><dt>Complexity</dt><dd>Whatever the system API takes (one would hope constant time). </dd></dl>
</div>
</div>
<a class="anchor" id="ae63332cddaecd2a30b839856c7d5fe0e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::vector<size_t> boost::afio::v2_xxx::utils::page_sizes </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>only_actually_available</em> = <code>true</code></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the page sizes of this architecture which is useful for calculating direct i/o multiples. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">only_actually_available</td><td>Only return page sizes actually available to the user running this process </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The page sizes of this architecture.</dd></dl>
<dl class="section user"><dt>Complexity</dt><dd>Whatever the system API takes (one would hope constant time). </dd></dl>
<dl class="section user"><dt>Errors returnable</dt><dd>Any error from the operating system or std::bad_alloc. </dd></dl>
</div>
</div>
<a class="anchor" id="ac7b89428cdd460548bd9a645a6565df4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void boost::afio::v2_xxx::utils::random_fill </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>bytes</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>A buffer to fill </td></tr>
<tr><td class="paramname">bytes</td><td>How many bytes to fill</td></tr>
</table>
</dd>
</dl>
<dl class="section user"><dt>Complexity</dt><dd>Whatever the system API takes. </dd></dl>
<dl class="section user"><dt>Errors returnable</dt><dd>Any error from the operating system. </dd></dl>
</div>
</div>
<a class="anchor" id="a051e8deb72941b3460811a1cf5f29915"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::string boost::afio::v2_xxx::utils::random_string </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>randomlen</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string(). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">randomlen</td><td>The number of bytes of randomness to use for the string. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string representing the randomness at a 2x ratio, so if 32 bytes were requested, this string would be 64 bytes long.</dd></dl>
<dl class="section user"><dt>Complexity</dt><dd>Whatever the system API takes. </dd></dl>
<dl class="section user"><dt>Errors returnable</dt><dd>Any error from the operating system. </dd></dl>
<div class="fragment"><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  {</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordtype">size_t</span> outlen = randomlen * 2;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  std::string ret(outlen, 0);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <a class="code" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html#ac7b89428cdd460548bd9a645a6565df4" title="Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API...">random_fill</a>(const_cast<char *>(ret.data()), randomlen);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  boost_lite::algorithm::string::to_hex_string(const_cast<char *>(ret.data()), outlen, ret.data(), randomlen);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  }</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespaceboost.html">boost</a></li><li class="navelem"><a class="el" href="namespaceboost_1_1afio.html">afio</a></li><li class="navelem"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx.html">v2_xxx</a></li><li class="navelem"><a class="el" href="namespaceboost_1_1afio_1_1v2__xxx_1_1utils.html">utils</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.3.1 </li>
</ul>
</div>
</body>
</html>
|