483 lines
27 KiB
HTML
483 lines
27 KiB
HTML
<!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>cereal: rapidxml::memory_pool< Ch > 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="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">cereal
|
|
</div>
|
|
<div id="projectbrief">A C++11 library for serialization</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="modules.html"><span>Modules</span></a></li>
|
|
<li class="current"><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="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- 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>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</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 id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>rapidxml</b></li><li class="navelem"><a class="el" href="classrapidxml_1_1memory__pool.html">memory_pool</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Classes</a> |
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classrapidxml_1_1memory__pool-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">rapidxml::memory_pool< Ch > Class Template Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p><code>#include <<a class="el" href="rapidxml_8hpp_source.html">cereal/external/rapidxml/rapidxml.hpp</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for rapidxml::memory_pool< Ch >:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classrapidxml_1_1memory__pool.png" usemap="#rapidxml::memory_pool< Ch >_map" alt=""/>
|
|
<map id="rapidxml::memory_pool< Ch >_map" name="rapidxml::memory_pool< Ch >_map">
|
|
<area href="classrapidxml_1_1xml__document.html" alt="rapidxml::xml_document< Ch >" shape="rect" coords="0,56,184,80"/>
|
|
</map>
|
|
</div></div>
|
|
<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:a0b609da81dff28a19ebd704400788429"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b609da81dff28a19ebd704400788429"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a0b609da81dff28a19ebd704400788429">memory_pool</a> ()</td></tr>
|
|
<tr class="memdesc:a0b609da81dff28a19ebd704400788429"><td class="mdescLeft"> </td><td class="mdescRight">Constructs empty pool with default allocator functions. <br/></td></tr>
|
|
<tr class="separator:a0b609da81dff28a19ebd704400788429"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0a3e82126e59e4077f41e933130bb5a0"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a0a3e82126e59e4077f41e933130bb5a0">~memory_pool</a> ()</td></tr>
|
|
<tr class="separator:a0a3e82126e59e4077f41e933130bb5a0"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4118581c29ee9a2f6b55ebf7dac185f8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > * </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a4118581c29ee9a2f6b55ebf7dac185f8">allocate_node</a> (node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)</td></tr>
|
|
<tr class="separator:a4118581c29ee9a2f6b55ebf7dac185f8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a3de2a66c983336e006ea3844e244ed30"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classrapidxml_1_1xml__attribute.html">xml_attribute</a>< Ch > * </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a3de2a66c983336e006ea3844e244ed30">allocate_attribute</a> (const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)</td></tr>
|
|
<tr class="separator:a3de2a66c983336e006ea3844e244ed30"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a171941b39d55b868358da97462185f58"><td class="memItemLeft" align="right" valign="top">Ch * </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a171941b39d55b868358da97462185f58">allocate_string</a> (const Ch *source=0, std::size_t size=0)</td></tr>
|
|
<tr class="separator:a171941b39d55b868358da97462185f58"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0a10679fc17597d339a0dc107f8a94ac"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > * </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a0a10679fc17597d339a0dc107f8a94ac">clone_node</a> (const <a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > *source, <a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > *result=0)</td></tr>
|
|
<tr class="separator:a0a10679fc17597d339a0dc107f8a94ac"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aad377c835fdaed1cb2cc9df194cf84e4"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#aad377c835fdaed1cb2cc9df194cf84e4">clear</a> ()</td></tr>
|
|
<tr class="separator:aad377c835fdaed1cb2cc9df194cf84e4"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a84d3d8d2cdfc00501e1dcf26d889ae03"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classrapidxml_1_1memory__pool.html#a84d3d8d2cdfc00501e1dcf26d889ae03">set_allocator</a> (alloc_func *af, free_func *ff)</td></tr>
|
|
<tr class="separator:a84d3d8d2cdfc00501e1dcf26d889ae03"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><h3>template<class Ch = char><br/>
|
|
class rapidxml::memory_pool< Ch ></h3>
|
|
|
|
<p>This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. In most cases, you will not need to use this class directly. However, if you need to create nodes manually or modify names/values of nodes, you are encouraged to use <a class="el" href="classrapidxml_1_1memory__pool.html">memory_pool</a> of relevant <a class="el" href="classrapidxml_1_1xml__document.html">xml_document</a> to allocate the memory. Not only is this faster than allocating them by using <code>new</code> operator, but also their lifetime will be tied to the lifetime of document, possibly simplyfing memory management. <br/>
|
|
<br/>
|
|
Call <a class="el" href="classrapidxml_1_1memory__pool.html#a4118581c29ee9a2f6b55ebf7dac185f8">allocate_node()</a> or <a class="el" href="classrapidxml_1_1memory__pool.html#a3de2a66c983336e006ea3844e244ed30">allocate_attribute()</a> functions to obtain new nodes or attributes from the pool. You can also call <a class="el" href="classrapidxml_1_1memory__pool.html#a171941b39d55b868358da97462185f58">allocate_string()</a> function to allocate strings. Such strings can then be used as names or values of nodes without worrying about their lifetime. Note that there is no <code>free()</code> function – all allocations are freed at once when <a class="el" href="classrapidxml_1_1memory__pool.html#aad377c835fdaed1cb2cc9df194cf84e4">clear()</a> function is called, or when the pool is destroyed. <br/>
|
|
<br/>
|
|
It is also possible to create a standalone <a class="el" href="classrapidxml_1_1memory__pool.html">memory_pool</a>, and use it to allocate nodes, whose lifetime will not be tied to any document. <br/>
|
|
<br/>
|
|
Pool maintains <code>RAPIDXML_STATIC_POOL_SIZE</code> bytes of statically allocated memory. Until static memory is exhausted, no dynamic memory allocations are done. When static memory is exhausted, pool allocates additional blocks of memory of size <code>RAPIDXML_DYNAMIC_POOL_SIZE</code> each, by using global <code>new[]</code> and <code>delete[]</code> operators. This behaviour can be changed by setting custom allocation routines. Use <a class="el" href="classrapidxml_1_1memory__pool.html#a84d3d8d2cdfc00501e1dcf26d889ae03">set_allocator()</a> function to set them. <br/>
|
|
<br/>
|
|
Allocations for nodes, attributes and strings are aligned at <code>RAPIDXML_ALIGNMENT</code> bytes. This value defaults to the size of pointer on target architecture. <br/>
|
|
<br/>
|
|
To obtain absolutely top performance from the parser, it is important that all nodes are allocated from a single, contiguous block of memory. Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. If required, you can tweak <code>RAPIDXML_STATIC_POOL_SIZE</code>, <code>RAPIDXML_DYNAMIC_POOL_SIZE</code> and <code>RAPIDXML_ALIGNMENT</code> to obtain best wasted memory to performance compromise. To do it, define their values before <a class="el" href="rapidxml_8hpp.html" title="This file contains rapidxml parser and DOM implementation.">rapidxml.hpp</a> file is included. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">Ch</td><td>Character type of created nodes. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="a0a3e82126e59e4077f41e933130bb5a0"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::~<a class="el" href="classrapidxml_1_1memory__pool.html">memory_pool</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>Destroys pool and frees all the memory. This causes memory occupied by nodes allocated by the pool to be freed. Nodes allocated from the pool are no longer valid. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a3de2a66c983336e006ea3844e244ed30"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classrapidxml_1_1xml__attribute.html">xml_attribute</a><Ch>* <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::allocate_attribute </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const Ch * </td>
|
|
<td class="paramname"><em>name</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const Ch * </td>
|
|
<td class="paramname"><em>value</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::size_t </td>
|
|
<td class="paramname"><em>name_size</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::size_t </td>
|
|
<td class="paramname"><em>value_size</em> = <code>0</code> </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>Allocates a new attribute from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">name</td><td>Name to assign to the attribute, or 0 to assign no name. </td></tr>
|
|
<tr><td class="paramname">value</td><td>Value to assign to the attribute, or 0 to assign no value. </td></tr>
|
|
<tr><td class="paramname">name_size</td><td>Size of name to assign, or 0 to automatically calculate size from name string. </td></tr>
|
|
<tr><td class="paramname">value_size</td><td>Size of value to assign, or 0 to automatically calculate size from value string. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to allocated attribute. This pointer will never be NULL. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a4118581c29ee9a2f6b55ebf7dac185f8"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a><Ch>* <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::allocate_node </td>
|
|
<td>(</td>
|
|
<td class="paramtype">node_type </td>
|
|
<td class="paramname"><em>type</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const Ch * </td>
|
|
<td class="paramname"><em>name</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const Ch * </td>
|
|
<td class="paramname"><em>value</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::size_t </td>
|
|
<td class="paramname"><em>name_size</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::size_t </td>
|
|
<td class="paramname"><em>value_size</em> = <code>0</code> </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>Allocates a new node from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">type</td><td>Type of node to create. </td></tr>
|
|
<tr><td class="paramname">name</td><td>Name to assign to the node, or 0 to assign no name. </td></tr>
|
|
<tr><td class="paramname">value</td><td>Value to assign to the node, or 0 to assign no value. </td></tr>
|
|
<tr><td class="paramname">name_size</td><td>Size of name to assign, or 0 to automatically calculate size from name string. </td></tr>
|
|
<tr><td class="paramname">value_size</td><td>Size of value to assign, or 0 to automatically calculate size from value string. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to allocated node. This pointer will never be NULL. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a171941b39d55b868358da97462185f58"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">Ch* <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::allocate_string </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const Ch * </td>
|
|
<td class="paramname"><em>source</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::size_t </td>
|
|
<td class="paramname"><em>size</em> = <code>0</code> </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>Allocates a char array of given size from the pool, and optionally copies a given string to it. If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">source</td><td>String to initialize the allocated memory with, or 0 to not initialize it. </td></tr>
|
|
<tr><td class="paramname">size</td><td>Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to allocated char array. This pointer will never be NULL. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aad377c835fdaed1cb2cc9df194cf84e4"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::clear </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>Clears the pool. This causes memory occupied by nodes allocated by the pool to be freed. Any nodes or strings allocated from the pool will no longer be valid. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a0a10679fc17597d339a0dc107f8a94ac"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a><Ch>* <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::clone_node </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > * </td>
|
|
<td class="paramname"><em>source</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a>< Ch > * </td>
|
|
<td class="paramname"><em>result</em> = <code>0</code> </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>Clones an <a class="el" href="classrapidxml_1_1xml__node.html">xml_node</a> and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">source</td><td>Node to clone. </td></tr>
|
|
<tr><td class="paramname">result</td><td>Node to put results in, or 0 to automatically allocate result node </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to cloned node. This pointer will never be NULL. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a84d3d8d2cdfc00501e1dcf26d889ae03"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Ch = char> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classrapidxml_1_1memory__pool.html">rapidxml::memory_pool</a>< Ch >::set_allocator </td>
|
|
<td>(</td>
|
|
<td class="paramtype">alloc_func * </td>
|
|
<td class="paramname"><em>af</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">free_func * </td>
|
|
<td class="paramname"><em>ff</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>Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use <code>longjmp()</code> function to pass control to other place of program. If it returns invalid pointer, results are undefined. <br/>
|
|
<br/>
|
|
User defined allocation functions must have the following forms: <br/>
|
|
<code> <br/>
|
|
void *allocate(std::size_t size); <br/>
|
|
void free(void *pointer); </code><br/>
|
|
</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">af</td><td>Allocation function, or 0 to restore default function </td></tr>
|
|
<tr><td class="paramname">ff</td><td>Free function, or 0 to restore default function </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li>include/cereal/external/rapidxml/<a class="el" href="rapidxml_8hpp_source.html">rapidxml.hpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Fri Jul 5 2013 20:54:22 for cereal by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.3.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|