blob: 2746ca38152a579c6bd3a1013ca59606b6f511e5 [file] [log] [blame]
<!-- HTML header for doxygen 1.8.7-->
<!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.16"/>
<title>RapidJSON: rapidjson::MemoryPoolAllocator&lt; BaseAllocator &gt; Class Template 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="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygenextra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="topbanner"><a href="https://github.com/Tencent/rapidjson" title="RapidJSON GitHub"><i class="githublogo"></i></a></div>
<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>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classrapidjson_1_1_memory_pool_allocator.html','');});
/* @license-end */
</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)">
</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> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="classrapidjson_1_1_memory_pool_allocator-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">rapidjson::MemoryPoolAllocator&lt; BaseAllocator &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Default memory allocator used by the parser and DOM.
<a href="classrapidjson_1_1_memory_pool_allocator.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="allocators_8h_source.html">allocators.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a59d783f4feba17dcd35d9f25fcbc09f4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a59d783f4feba17dcd35d9f25fcbc09f4">MemoryPoolAllocator</a> (size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)</td></tr>
<tr class="memdesc:a59d783f4feba17dcd35d9f25fcbc09f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor with chunkSize. <a href="classrapidjson_1_1_memory_pool_allocator.html#a59d783f4feba17dcd35d9f25fcbc09f4">More...</a><br /></td></tr>
<tr class="separator:a59d783f4feba17dcd35d9f25fcbc09f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abcc572bdb6902c9d69711540db5098a7"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#abcc572bdb6902c9d69711540db5098a7">MemoryPoolAllocator</a> (void *buffer, size_t size, size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)</td></tr>
<tr class="memdesc:abcc572bdb6902c9d69711540db5098a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor with user-supplied buffer. <a href="classrapidjson_1_1_memory_pool_allocator.html#abcc572bdb6902c9d69711540db5098a7">More...</a><br /></td></tr>
<tr class="separator:abcc572bdb6902c9d69711540db5098a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af464b5c6323ea1473de8c1def693bda0"><td class="memItemLeft" align="right" valign="top"><a id="af464b5c6323ea1473de8c1def693bda0"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>MemoryPoolAllocator</b> (const <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> &amp;rhs) RAPIDJSON_NOEXCEPT</td></tr>
<tr class="separator:af464b5c6323ea1473de8c1def693bda0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1bac724edf283fa15e197e6930f29668"><td class="memItemLeft" align="right" valign="top"><a id="a1bac724edf283fa15e197e6930f29668"></a>
<a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>operator=</b> (const <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> &amp;rhs) RAPIDJSON_NOEXCEPT</td></tr>
<tr class="separator:a1bac724edf283fa15e197e6930f29668"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5b6810e88de0c46390525cd3a0bd700"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#aa5b6810e88de0c46390525cd3a0bd700">~MemoryPoolAllocator</a> () RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:aa5b6810e88de0c46390525cd3a0bd700"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="classrapidjson_1_1_memory_pool_allocator.html#aa5b6810e88de0c46390525cd3a0bd700">More...</a><br /></td></tr>
<tr class="separator:aa5b6810e88de0c46390525cd3a0bd700"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa5935b0dc40420085822bdb5a3f2840"><td class="memItemLeft" align="right" valign="top"><a id="afa5935b0dc40420085822bdb5a3f2840"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#afa5935b0dc40420085822bdb5a3f2840">Clear</a> () RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:afa5935b0dc40420085822bdb5a3f2840"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deallocates all memory chunks, excluding the first/user one. <br /></td></tr>
<tr class="separator:afa5935b0dc40420085822bdb5a3f2840"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf80d2330d6ae72643674a95ac62c0bd"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#acf80d2330d6ae72643674a95ac62c0bd">Capacity</a> () const RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:acf80d2330d6ae72643674a95ac62c0bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the total capacity of allocated memory chunks. <a href="classrapidjson_1_1_memory_pool_allocator.html#acf80d2330d6ae72643674a95ac62c0bd">More...</a><br /></td></tr>
<tr class="separator:acf80d2330d6ae72643674a95ac62c0bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab7368f377dafc0ecad2c59814cdfe265"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#ab7368f377dafc0ecad2c59814cdfe265">Size</a> () const RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:ab7368f377dafc0ecad2c59814cdfe265"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the memory blocks allocated. <a href="classrapidjson_1_1_memory_pool_allocator.html#ab7368f377dafc0ecad2c59814cdfe265">More...</a><br /></td></tr>
<tr class="separator:ab7368f377dafc0ecad2c59814cdfe265"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1a56b28d5e0d75b628d448ceacd41fc"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#af1a56b28d5e0d75b628d448ceacd41fc">Shared</a> () const RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:af1a56b28d5e0d75b628d448ceacd41fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Whether the allocator is shared. <a href="classrapidjson_1_1_memory_pool_allocator.html#af1a56b28d5e0d75b628d448ceacd41fc">More...</a><br /></td></tr>
<tr class="separator:af1a56b28d5e0d75b628d448ceacd41fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a208c29e04b1d748bfe068444b7044344"><td class="memItemLeft" align="right" valign="top"><a id="a208c29e04b1d748bfe068444b7044344"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a208c29e04b1d748bfe068444b7044344">Malloc</a> (size_t size)</td></tr>
<tr class="memdesc:a208c29e04b1d748bfe068444b7044344"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates a memory block. (concept <a class="el" href="classrapidjson_1_1_allocator.html" title="Concept for allocating, resizing and freeing memory block.">Allocator</a>) <br /></td></tr>
<tr class="separator:a208c29e04b1d748bfe068444b7044344"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a880524b17bbecb5d2691b8075050d55d"><td class="memItemLeft" align="right" valign="top"><a id="a880524b17bbecb5d2691b8075050d55d"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a880524b17bbecb5d2691b8075050d55d">Realloc</a> (void *originalPtr, size_t originalSize, size_t newSize)</td></tr>
<tr class="memdesc:a880524b17bbecb5d2691b8075050d55d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resizes a memory block (concept <a class="el" href="classrapidjson_1_1_allocator.html" title="Concept for allocating, resizing and freeing memory block.">Allocator</a>) <br /></td></tr>
<tr class="separator:a880524b17bbecb5d2691b8075050d55d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaadeb62f04e430ae1254a7e69d54d724"><td class="memItemLeft" align="right" valign="top"><a id="aaadeb62f04e430ae1254a7e69d54d724"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#aaadeb62f04e430ae1254a7e69d54d724">operator==</a> (const <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> &amp;rhs) const RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:aaadeb62f04e430ae1254a7e69d54d724"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compare (equality) with another <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html" title="Default memory allocator used by the parser and DOM.">MemoryPoolAllocator</a>. <br /></td></tr>
<tr class="separator:aaadeb62f04e430ae1254a7e69d54d724"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada927b87fb5640124aefeb07e3e23c99"><td class="memItemLeft" align="right" valign="top"><a id="ada927b87fb5640124aefeb07e3e23c99"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#ada927b87fb5640124aefeb07e3e23c99">operator!=</a> (const <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> &amp;rhs) const RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:ada927b87fb5640124aefeb07e3e23c99"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compare (inequality) with another <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html" title="Default memory allocator used by the parser and DOM.">MemoryPoolAllocator</a>. <br /></td></tr>
<tr class="separator:ada927b87fb5640124aefeb07e3e23c99"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a199ce203dde7f2b364b6b844a8af04ec"><td class="memItemLeft" align="right" valign="top"><a id="a199ce203dde7f2b364b6b844a8af04ec"></a>
static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a199ce203dde7f2b364b6b844a8af04ec">Free</a> (void *ptr) RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:a199ce203dde7f2b364b6b844a8af04ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a memory block (concept <a class="el" href="classrapidjson_1_1_allocator.html" title="Concept for allocating, resizing and freeing memory block.">Allocator</a>) <br /></td></tr>
<tr class="separator:a199ce203dde7f2b364b6b844a8af04ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:a2606d96e19bcfc9d4bf58aefe55c1b29"><td class="memItemLeft" align="right" valign="top"><a id="a2606d96e19bcfc9d4bf58aefe55c1b29"></a>
static const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a2606d96e19bcfc9d4bf58aefe55c1b29">kNeedFree</a> = false</td></tr>
<tr class="memdesc:a2606d96e19bcfc9d4bf58aefe55c1b29"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tell users that no need to call <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a199ce203dde7f2b364b6b844a8af04ec" title="Frees a memory block (concept Allocator)">Free()</a> with this allocator. (concept <a class="el" href="classrapidjson_1_1_allocator.html" title="Concept for allocating, resizing and freeing memory block.">Allocator</a>) <br /></td></tr>
<tr class="separator:a2606d96e19bcfc9d4bf58aefe55c1b29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a285002fe7283af29c222adf63c9c6496"><td class="memItemLeft" align="right" valign="top"><a id="a285002fe7283af29c222adf63c9c6496"></a>
static const bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a285002fe7283af29c222adf63c9c6496">kRefCounted</a> = true</td></tr>
<tr class="memdesc:a285002fe7283af29c222adf63c9c6496"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tell users that this allocator is reference counted on copy. <br /></td></tr>
<tr class="separator:a285002fe7283af29c222adf63c9c6496"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename BaseAllocator = CrtAllocator&gt;<br />
class rapidjson::MemoryPoolAllocator&lt; BaseAllocator &gt;</h3>
<p>Default memory allocator used by the parser and DOM. </p>
<p>This allocator allocate memory blocks from pre-allocated memory chunks.</p>
<p>It does not free memory blocks. And <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html#a880524b17bbecb5d2691b8075050d55d" title="Resizes a memory block (concept Allocator)">Realloc()</a> only allocate new memory.</p>
<p>The memory chunks are allocated by BaseAllocator, which is <a class="el" href="classrapidjson_1_1_crt_allocator.html" title="C-runtime library allocator.">CrtAllocator</a> by default.</p>
<p>User may also supply a buffer as the first chunk.</p>
<p>If the user-buffer is full then additional chunks are allocated by BaseAllocator.</p>
<p>The user-buffer is not deallocated by this allocator.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">BaseAllocator</td><td>the allocator type for allocating memory chunks. Default is <a class="el" href="classrapidjson_1_1_crt_allocator.html" title="C-runtime library allocator.">CrtAllocator</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>implements <a class="el" href="classrapidjson_1_1_allocator.html" title="Concept for allocating, resizing and freeing memory block.">Allocator</a> concept </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a59d783f4feba17dcd35d9f25fcbc09f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a59d783f4feba17dcd35d9f25fcbc09f4">&#9670;&nbsp;</a></span>MemoryPoolAllocator() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::<a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>chunkSize</em> = <code>kDefaultChunkCapacity</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">BaseAllocator *&#160;</td>
<td class="paramname"><em>baseAllocator</em> = <code>0</code>&#160;</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 class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructor with chunkSize. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">chunkSize</td><td>The size of memory chunk. The default is kDefaultChunkSize. </td></tr>
<tr><td class="paramname">baseAllocator</td><td>The allocator for allocating memory chunks. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="abcc572bdb6902c9d69711540db5098a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abcc572bdb6902c9d69711540db5098a7">&#9670;&nbsp;</a></span>MemoryPoolAllocator() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::<a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>chunkSize</em> = <code>kDefaultChunkCapacity</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">BaseAllocator *&#160;</td>
<td class="paramname"><em>baseAllocator</em> = <code>0</code>&#160;</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>Constructor with user-supplied buffer. </p>
<p>The user buffer will be used firstly. When it is full, memory pool allocates new chunk with chunk size.</p>
<p>The user buffer will not be deallocated when this allocator is destructed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>User supplied buffer. </td></tr>
<tr><td class="paramname">size</td><td>Size of the buffer in bytes. It must at least larger than sizeof(ChunkHeader). </td></tr>
<tr><td class="paramname">chunkSize</td><td>The size of memory chunk. The default is kDefaultChunkSize. </td></tr>
<tr><td class="paramname">baseAllocator</td><td>The allocator for allocating memory chunks. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="aa5b6810e88de0c46390525cd3a0bd700"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5b6810e88de0c46390525cd3a0bd700">&#9670;&nbsp;</a></span>~MemoryPoolAllocator()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::~<a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a> </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> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
<p>This deallocates all memory chunks, excluding the user-supplied buffer. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="acf80d2330d6ae72643674a95ac62c0bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf80d2330d6ae72643674a95ac62c0bd">&#9670;&nbsp;</a></span>Capacity()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::Capacity </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</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>Computes the total capacity of allocated memory chunks. </p>
<dl class="section return"><dt>Returns</dt><dd>total capacity in bytes. </dd></dl>
</div>
</div>
<a id="af1a56b28d5e0d75b628d448ceacd41fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af1a56b28d5e0d75b628d448ceacd41fc">&#9670;&nbsp;</a></span>Shared()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::Shared </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</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>Whether the allocator is shared. </p>
<dl class="section return"><dt>Returns</dt><dd>true or false. </dd></dl>
</div>
</div>
<a id="ab7368f377dafc0ecad2c59814cdfe265"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab7368f377dafc0ecad2c59814cdfe265">&#9670;&nbsp;</a></span>Size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename BaseAllocator = CrtAllocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t <a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">rapidjson::MemoryPoolAllocator</a>&lt; BaseAllocator &gt;::Size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</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>Computes the memory blocks allocated. </p>
<dl class="section return"><dt>Returns</dt><dd>total used bytes. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/rapidjson/<a class="el" href="allocators_8h_source.html">allocators.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.7-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespacerapidjson.html">rapidjson</a></li><li class="navelem"><a class="el" href="classrapidjson_1_1_memory_pool_allocator.html">MemoryPoolAllocator</a></li>
</ul>
</div>
</body>
</html>