Files
entt/classentt_1_1basic__snapshot__loader.html
2021-12-21 13:20:51 +01:00

342 lines
19 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EnTT: entt::basic_snapshot_loader&lt; Entity &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="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>
<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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">EnTT
&#160;<span id="projectnumber">3.9.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<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','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- 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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespaceentt.html">entt</a></li><li class="navelem"><a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classentt_1_1basic__snapshot__loader-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">entt::basic_snapshot_loader&lt; Entity &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Utility class to restore a snapshot as a whole.
<a href="classentt_1_1basic__snapshot__loader.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a73d5864a57a78d528cc0bcbe36ff5039"><td class="memItemLeft" align="right" valign="top"><a id="a73d5864a57a78d528cc0bcbe36ff5039"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#a73d5864a57a78d528cc0bcbe36ff5039">entity_type</a> = Entity</td></tr>
<tr class="memdesc:a73d5864a57a78d528cc0bcbe36ff5039"><td class="mdescLeft">&#160;</td><td class="mdescRight">Underlying entity identifier. <br /></td></tr>
<tr class="separator:a73d5864a57a78d528cc0bcbe36ff5039"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><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:ac7bf5c8d48c665020c8689f14879db77"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#ac7bf5c8d48c665020c8689f14879db77">basic_snapshot_loader</a> (<a class="el" href="classentt_1_1basic__registry.html">basic_registry</a>&lt; <a class="el" href="classentt_1_1basic__snapshot__loader.html#a73d5864a57a78d528cc0bcbe36ff5039">entity_type</a> &gt; &amp;source)</td></tr>
<tr class="memdesc:ac7bf5c8d48c665020c8689f14879db77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs an instance that is bound to a given registry. <a href="classentt_1_1basic__snapshot__loader.html#ac7bf5c8d48c665020c8689f14879db77">More...</a><br /></td></tr>
<tr class="separator:ac7bf5c8d48c665020c8689f14879db77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc078b2e9068ae41a2910168b40322d4"><td class="memItemLeft" align="right" valign="top"><a id="acc078b2e9068ae41a2910168b40322d4"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#acc078b2e9068ae41a2910168b40322d4">basic_snapshot_loader</a> (<a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&amp;)=default</td></tr>
<tr class="memdesc:acc078b2e9068ae41a2910168b40322d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default move constructor. <br /></td></tr>
<tr class="separator:acc078b2e9068ae41a2910168b40322d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa55eeaad2ab4dd117524afff9d6e184b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#aa55eeaad2ab4dd117524afff9d6e184b">operator=</a> (<a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&amp;)=default</td></tr>
<tr class="memdesc:aa55eeaad2ab4dd117524afff9d6e184b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default move assignment operator. <a href="classentt_1_1basic__snapshot__loader.html#aa55eeaad2ab4dd117524afff9d6e184b">More...</a><br /></td></tr>
<tr class="separator:aa55eeaad2ab4dd117524afff9d6e184b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ee608c24b47e2f54a1224177a0dc741"><td class="memTemplParams" colspan="2">template&lt;typename Archive &gt; </td></tr>
<tr class="memitem:a0ee608c24b47e2f54a1224177a0dc741"><td class="memTemplItemLeft" align="right" valign="top">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#a0ee608c24b47e2f54a1224177a0dc741">entities</a> (Archive &amp;archive) const</td></tr>
<tr class="memdesc:a0ee608c24b47e2f54a1224177a0dc741"><td class="mdescLeft">&#160;</td><td class="mdescRight">Restores entities that were in use during serialization. <a href="classentt_1_1basic__snapshot__loader.html#a0ee608c24b47e2f54a1224177a0dc741">More...</a><br /></td></tr>
<tr class="separator:a0ee608c24b47e2f54a1224177a0dc741"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af7352e091c3421432cc2ef77010a0a2d"><td class="memTemplParams" colspan="2">template&lt;typename... Component, typename Archive &gt; </td></tr>
<tr class="memitem:af7352e091c3421432cc2ef77010a0a2d"><td class="memTemplItemLeft" align="right" valign="top">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#af7352e091c3421432cc2ef77010a0a2d">component</a> (Archive &amp;archive) const</td></tr>
<tr class="memdesc:af7352e091c3421432cc2ef77010a0a2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Restores components and assigns them to the right entities. <a href="classentt_1_1basic__snapshot__loader.html#af7352e091c3421432cc2ef77010a0a2d">More...</a><br /></td></tr>
<tr class="separator:af7352e091c3421432cc2ef77010a0a2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd881016761f5eb598763fbf3595a625"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1basic__snapshot__loader.html#acd881016761f5eb598763fbf3595a625">orphans</a> () const</td></tr>
<tr class="memdesc:acd881016761f5eb598763fbf3595a625"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys those entities that have no components. <a href="classentt_1_1basic__snapshot__loader.html#acd881016761f5eb598763fbf3595a625">More...</a><br /></td></tr>
<tr class="separator:acd881016761f5eb598763fbf3595a625"><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 Entity&gt;<br />
class entt::basic_snapshot_loader&lt; Entity &gt;</h3>
<p>Utility class to restore a snapshot as a whole. </p>
<p>A snapshot loader requires that the destination registry be empty and loads all the data at once while keeping intact the identifiers that the entities originally had.<br />
An example of use is the implementation of a save/restore utility.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">Entity</td><td>A valid entity type (see <a class="el" href="classentt_1_1entt__traits.html" title="Entity traits.">entt_traits</a> for more details). </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="snapshot_8hpp_source.html#l00161">161</a> of file <a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ac7bf5c8d48c665020c8689f14879db77"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7bf5c8d48c665020c8689f14879db77">&#9670;&nbsp;</a></span>basic_snapshot_loader()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Entity &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classentt_1_1basic__snapshot__loader.html">entt::basic_snapshot_loader</a>&lt; Entity &gt;::<a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classentt_1_1basic__registry.html">basic_registry</a>&lt; <a class="el" href="classentt_1_1basic__snapshot__loader.html#a73d5864a57a78d528cc0bcbe36ff5039">entity_type</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>source</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>Constructs an instance that is bound to a given registry. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">source</td><td>A valid reference to a registry. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="snapshot_8hpp_source.html#l00198">198</a> of file <a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="af7352e091c3421432cc2ef77010a0a2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af7352e091c3421432cc2ef77010a0a2d">&#9670;&nbsp;</a></span>component()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Entity &gt; </div>
<div class="memtemplate">
template&lt;typename... Component, typename Archive &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a>&amp; <a class="el" href="classentt_1_1basic__snapshot__loader.html">entt::basic_snapshot_loader</a>&lt; Entity &gt;::component </td>
<td>(</td>
<td class="paramtype">Archive &amp;&#160;</td>
<td class="paramname"><em>archive</em></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>Restores components and assigns them to the right entities. </p>
<p>The template parameter list must be exactly the same used during serialization. In the event that the entity to which the component is assigned doesn't exist yet, the loader will take care to create it with the version it originally had.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">Component</td><td>Types of components to restore. </td></tr>
<tr><td class="paramname">Archive</td><td>Type of input archive. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">archive</td><td>A valid reference to an input archive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A valid loader to continue restoring data. </dd></dl>
<p class="definition">Definition at line <a class="el" href="snapshot_8hpp_source.html#l00250">250</a> of file <a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>.</p>
</div>
</div>
<a id="a0ee608c24b47e2f54a1224177a0dc741"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ee608c24b47e2f54a1224177a0dc741">&#9670;&nbsp;</a></span>entities()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Entity &gt; </div>
<div class="memtemplate">
template&lt;typename Archive &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a>&amp; <a class="el" href="classentt_1_1basic__snapshot__loader.html">entt::basic_snapshot_loader</a>&lt; Entity &gt;::entities </td>
<td>(</td>
<td class="paramtype">Archive &amp;&#160;</td>
<td class="paramname"><em>archive</em></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>Restores entities that were in use during serialization. </p>
<p>This function restores the entities that were in use during serialization and gives them the versions they originally had.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">Archive</td><td>Type of input archive. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">archive</td><td>A valid reference to an input archive. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A valid loader to continue restoring data. </dd></dl>
<p class="definition">Definition at line <a class="el" href="snapshot_8hpp_source.html#l00221">221</a> of file <a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>.</p>
</div>
</div>
<a id="aa55eeaad2ab4dd117524afff9d6e184b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa55eeaad2ab4dd117524afff9d6e184b">&#9670;&nbsp;</a></span>operator=()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Entity &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a>&amp; <a class="el" href="classentt_1_1basic__snapshot__loader.html">entt::basic_snapshot_loader</a>&lt; Entity &gt;::operator= </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a>&lt; Entity &gt; &amp;&amp;&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Default move assignment operator. </p>
<dl class="section return"><dt>Returns</dt><dd>This loader. </dd></dl>
</div>
</div>
<a id="acd881016761f5eb598763fbf3595a625"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acd881016761f5eb598763fbf3595a625">&#9670;&nbsp;</a></span>orphans()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Entity &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classentt_1_1basic__snapshot__loader.html">basic_snapshot_loader</a>&amp; <a class="el" href="classentt_1_1basic__snapshot__loader.html">entt::basic_snapshot_loader</a>&lt; Entity &gt;::orphans </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>Destroys those entities that have no components. </p>
<p>In case all the entities were serialized but only part of the components was saved, it could happen that some of the entities have no components once restored.<br />
This functions helps to identify and destroy those entities.</p>
<dl class="section return"><dt>Returns</dt><dd>A valid loader to continue restoring data. </dd></dl>
<p class="definition">Definition at line <a class="el" href="snapshot_8hpp_source.html#l00265">265</a> of file <a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/entt/entity/<a class="el" href="entity_2fwd_8hpp_source.html">fwd.hpp</a></li>
<li>src/entt/entity/<a class="el" href="snapshot_8hpp_source.html">snapshot.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>