103 lines
46 KiB
HTML
103 lines
46 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.13"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>entt: src/entt/entity/prototype.hpp Source File</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
|
|
 <span id="projectnumber">2.7.1</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.13 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
</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="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_66e9674e8206a335795995fa32a03c91.html">entt</a></li><li class="navelem"><a class="el" href="dir_e3a7bb56c55e5c2286e2fe96e197d4f5.html">entity</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">prototype.hpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef ENTT_ENTITY_PROTOTYPE_HPP</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define ENTT_ENTITY_PROTOTYPE_HPP</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <tuple></span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <utility></span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <cstddef></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <type_traits></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <unordered_map></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "../config/config.h"</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "registry.hpp"</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">namespace </span><a class="code" href="namespaceentt.html">entt</a> {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">template</span><<span class="keyword">typename</span> Entity></div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html"> 39</a></span> <span class="keyword">class </span><a class="code" href="classentt_1_1Prototype.html">Prototype</a> final {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keyword">using</span> basic_fn_type = void(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html">Prototype</a> &, <a class="code" href="classentt_1_1Registry.html">Registry<Entity></a> &, <span class="keyword">const</span> Entity);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keyword">using</span> component_type = <span class="keyword">typename</span> <a class="code" href="classentt_1_1Registry.html#aefd07a0cdff88ebf1e35e531d58c3077">Registry<Entity>::component_type</a>;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keyword">template</span><<span class="keyword">typename</span> Component></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">struct </span>Wrapper { Component component; };</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keyword">struct </span>Handler {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  basic_fn_type *<a class="code" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">accommodate</a>;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  basic_fn_type *<a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  };</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordtype">void</span> release() {</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">if</span>(registry->valid(entity)) {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  registry->destroy(entity);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  }</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a8e4a91009c1cbb0bfaadf4e95178eaec"> 59</a></span>  <span class="keyword">using</span> <a class="code" href="classentt_1_1Registry.html">registry_type</a> = <a class="code" href="classentt_1_1Registry.html">Registry<Entity></a>;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d"> 61</a></span>  <span class="keyword">using</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> = Entity;</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a2a593566474356ad2a03fea9b122de93"> 63</a></span>  <span class="keyword">using</span> <a class="code" href="classentt_1_1Prototype.html#a2a593566474356ad2a03fea9b122de93">size_type</a> = std::size_t;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#aa6033be234aad4d287d740c40db17fec"> 69</a></span>  <a class="code" href="classentt_1_1Prototype.html#aa6033be234aad4d287d740c40db17fec">Prototype</a>(<a class="code" href="classentt_1_1Registry.html">Registry<Entity></a> &registry)</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  : registry{&registry},</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  entity{registry.<a class="code" href="classentt_1_1Registry.html#a433ac3fc8ea49347f691dd4ad1ccb58b">create</a>()}</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  {}</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#acb70104c3d32fcf22fbe37afa7602ed5"> 77</a></span>  <a class="code" href="classentt_1_1Prototype.html#acb70104c3d32fcf22fbe37afa7602ed5">~Prototype</a>() {</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  release();</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="classentt_1_1Prototype.html#aa6033be234aad4d287d740c40db17fec">Prototype</a>(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html">Prototype</a> &) = <span class="keyword">delete</span>;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ad4900c4a27f506b5d2b9db54aba9d224"> 93</a></span>  <a class="code" href="classentt_1_1Prototype.html#ad4900c4a27f506b5d2b9db54aba9d224">Prototype</a>(<a class="code" href="classentt_1_1Prototype.html">Prototype</a> &&other)</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  : handlers{std::move(other.handlers)},</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  registry{other.registry},</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  entity{other.entity}</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  {</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  other.entity = ~<a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a>{};</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  }</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <a class="code" href="classentt_1_1Prototype.html">Prototype</a> & <a class="code" href="classentt_1_1Prototype.html#a65529171240b1b7c348445c7ba4f319e">operator=</a>(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html">Prototype</a> &) = <span class="keyword">delete</span>;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a9faf0b8878925090431a9e6acaed06c5"> 114</a></span>  <a class="code" href="classentt_1_1Prototype.html">Prototype</a> & <a class="code" href="classentt_1_1Prototype.html#a9faf0b8878925090431a9e6acaed06c5">operator=</a>(<a class="code" href="classentt_1_1Prototype.html">Prototype</a> &&other) {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordflow">if</span>(<span class="keyword">this</span> != &other) {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keyword">auto</span> tmp{std::move(other)};</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  handlers.swap(tmp.handlers);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  std::swap(registry, tmp.registry);</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  std::swap(entity, tmp.entity);</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  }</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  }</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keyword">template</span><<span class="keyword">typename</span> Component, <span class="keyword">typename</span>... Args></div><div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#abf665ce59c8f43c4eff3ce77a21c5cfb"> 133</a></span>  Component & <span class="keyword">set</span>(Args &&... args) {</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  basic_fn_type *<a class="code" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">accommodate</a> = [](<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html">Prototype</a> &prototype, <a class="code" href="classentt_1_1Registry.html">Registry<Entity></a> &other, <span class="keyword">const</span> Entity dst) {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keyword">const</span> <span class="keyword">auto</span> &wrapper = prototype.registry->template get<Wrapper<Component>>(prototype.entity);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  other.template accommodate<Component>(dst, wrapper.component);</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  };</div><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>  basic_fn_type *<a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a> = [](<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html">Prototype</a> &prototype, <a class="code" href="classentt_1_1Registry.html">Registry<Entity></a> &other, <span class="keyword">const</span> Entity dst) {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">if</span>(!other.template has<Component>(dst)) {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keyword">const</span> <span class="keyword">auto</span> &wrapper = prototype.registry->template get<Wrapper<Component>>(prototype.entity);</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  other.template accommodate<Component>(dst, wrapper.component);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  }</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  };</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  handlers[registry->template type<Component>()] = Handler{<a class="code" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">accommodate</a>, assign};</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keyword">auto</span> &wrapper = registry->template accommodate<Wrapper<Component>>(entity, Component{std::forward<Args>(args)...});</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordflow">return</span> wrapper.component;</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  }</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="keyword">template</span><<span class="keyword">typename</span> Component></div><div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ac75f485a3afa9dada4574269be50166d"> 156</a></span>  <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#ac75f485a3afa9dada4574269be50166d">unset</a>() ENTT_NOEXCEPT {</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  registry->template reset<Wrapper<Component>>(entity);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  handlers.erase(registry->template type<Component>());</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">template</span><<span class="keyword">typename</span>... Component></div><div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a3f156472cc6a07016eadf51082b8f2f8"> 167</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classentt_1_1Prototype.html#a3f156472cc6a07016eadf51082b8f2f8">has</a>() const ENTT_NOEXCEPT {</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keywordflow">return</span> registry->template has<Wrapper<Component>...>(entity);</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  }</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> </div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keyword">template</span><<span class="keyword">typename</span> Component></div><div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a0d23c82dcf122123ee29ffd3254b4b84"> 184</a></span>  <span class="keyword">const</span> Component & <span class="keyword">get</span>() <span class="keyword">const</span> ENTT_NOEXCEPT {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <span class="keywordflow">return</span> registry->template get<Wrapper<Component>>(entity).component;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  }</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keyword">template</span><<span class="keyword">typename</span> Component></div><div class="line"><a name="l00201"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a4069701eaf29716ed9bbb404da5f1b59"> 201</a></span>  <span class="keyword">inline</span> Component & <span class="keyword">get</span>() ENTT_NOEXCEPT {</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordflow">return</span> <span class="keyword">const_cast<</span>Component &<span class="keyword">></span>(<span class="keyword">const_cast<</span><span class="keyword">const </span><a class="code" href="classentt_1_1Prototype.html">Prototype</a> *<span class="keyword">></span>(<span class="keyword">this</span>)->get<Component>());</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  }</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> </div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <span class="keyword">template</span><<span class="keyword">typename</span>... Component></div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <span class="keyword">inline</span> std::enable_if_t<(<span class="keyword">sizeof</span>...(Component) > 1), std::tuple<<span class="keyword">const</span> Component &...>></div><div class="line"><a name="l00219"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ae52596223d2a61e52c41979b1e76d68f"> 219</a></span>  <span class="keyword">get</span>() <span class="keyword">const</span> ENTT_NOEXCEPT {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">return</span> std::tuple<<span class="keyword">const</span> Component &...>{get<Component>()...};</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  }</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keyword">template</span><<span class="keyword">typename</span>... Component></div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">inline</span> std::enable_if_t<(<span class="keyword">sizeof</span>...(Component) > 1), std::tuple<Component &...>></div><div class="line"><a name="l00237"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a35fcf29a4c01caa611cffa9f73cbe535"> 237</a></span>  <span class="keyword">get</span>() ENTT_NOEXCEPT {</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">return</span> std::tuple<Component &...>{get<Component>()...};</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  }</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span> </div><div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a434b43ae5f761093a0c9e74da0802523"> 259</a></span>  <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> <a class="code" href="classentt_1_1Prototype.html#a434b43ae5f761093a0c9e74da0802523">create</a>(<a class="code" href="classentt_1_1Registry.html">registry_type</a> &other)<span class="keyword"> const </span>{</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="keyword">const</span> <span class="keyword">auto</span> entity = other.<a class="code" href="classentt_1_1Registry.html#a433ac3fc8ea49347f691dd4ad1ccb58b">create</a>();</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>(other, entity);</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="keywordflow">return</span> entity;</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  }</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00282"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec"> 282</a></span>  <span class="keyword">inline</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> <a class="code" href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec">create</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">return</span> <a class="code" href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec">create</a>(*registry);</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  }</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span> </div><div class="line"><a name="l00307"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35"> 307</a></span>  <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>(<a class="code" href="classentt_1_1Registry.html">registry_type</a> &other, <span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst)<span class="keyword"> const </span>{</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span> &handler: handlers) {</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  handler.second.assign(*<span class="keyword">this</span>, other, dst);</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  }</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  }</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> </div><div class="line"><a name="l00333"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ab7bf733f40f1071d73d4f3245526c038"> 333</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#ab7bf733f40f1071d73d4f3245526c038">assign</a>(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst)<span class="keyword"> const </span>{</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>(*registry, dst);</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  }</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span> </div><div class="line"><a name="l00356"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d"> 356</a></span>  <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">accommodate</a>(<a class="code" href="classentt_1_1Registry.html">registry_type</a> &other, <span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst)<span class="keyword"> const </span>{</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span> &handler: handlers) {</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  handler.second.accommodate(*<span class="keyword">this</span>, other, dst);</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  }</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div><div class="line"><a name="l00380"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a37299298c61bb06a75b697296e328477"> 380</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#a37299298c61bb06a75b697296e328477">accommodate</a>(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst)<span class="keyword"> const </span>{</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <a class="code" href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">accommodate</a>(*registry, dst);</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  }</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span> </div><div class="line"><a name="l00405"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ac7cb69aad2015e94f3a0a9ad42b82f1b"> 405</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#ac7cb69aad2015e94f3a0a9ad42b82f1b">operator()</a>(<a class="code" href="classentt_1_1Registry.html">registry_type</a> &other, <span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst) <span class="keyword">const</span> ENTT_NOEXCEPT {</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  <a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>(other, dst);</div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  }</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> </div><div class="line"><a name="l00429"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a6b0560c31432fb6591a772ce9a322728"> 429</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classentt_1_1Prototype.html#a6b0560c31432fb6591a772ce9a322728">operator()</a>(<span class="keyword">const</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> dst) <span class="keyword">const</span> ENTT_NOEXCEPT {</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  <a class="code" href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">assign</a>(*registry, dst);</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  }</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00451"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#a7c401ecc89b0c88ab15ed2dd7686b54e"> 451</a></span>  <span class="keyword">inline</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> <a class="code" href="classentt_1_1Prototype.html#a7c401ecc89b0c88ab15ed2dd7686b54e">operator()</a>(<a class="code" href="classentt_1_1Registry.html">registry_type</a> &other) <span class="keyword">const</span> ENTT_NOEXCEPT {</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>  <span class="keywordflow">return</span> <a class="code" href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec">create</a>(other);</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  }</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> </div><div class="line"><a name="l00472"></a><span class="lineno"><a class="line" href="classentt_1_1Prototype.html#ad39dd5c5449cc647a1402543ebe411fe"> 472</a></span>  <span class="keyword">inline</span> <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> <a class="code" href="classentt_1_1Prototype.html#ad39dd5c5449cc647a1402543ebe411fe">operator()</a>() const ENTT_NOEXCEPT {</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span>  <span class="keywordflow">return</span> <a class="code" href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec">create</a>(*registry);</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  }</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span> </div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span>  std::unordered_map<component_type, Handler> handlers;</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <a class="code" href="classentt_1_1Registry.html">Registry<Entity></a> *registry;</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <a class="code" href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entity_type</a> entity;</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span> };</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span> </div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> </div><div class="line"><a name="l00490"></a><span class="lineno"><a class="line" href="namespaceentt.html#a94d8a4552b7bd5a3543c2ffc6eaf878c"> 490</a></span> <span class="keyword">using</span> <a class="code" href="classentt_1_1Prototype.html">DefaultPrototype</a> = <a class="code" href="classentt_1_1Prototype.html">Prototype<DefaultRegistry::entity_type></a>;</div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span> </div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span> </div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span> }</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span> </div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span> </div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span> <span class="preprocessor">#endif // ENTT_ENTITY_PROTOTYPE_HPP</span></div><div class="ttc" id="classentt_1_1Prototype_html_a2a593566474356ad2a03fea9b122de93"><div class="ttname"><a href="classentt_1_1Prototype.html#a2a593566474356ad2a03fea9b122de93">entt::Prototype::size_type</a></div><div class="ttdeci">std::size_t size_type</div><div class="ttdoc">Unsigned integer type. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00063">prototype.hpp:63</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ab4542df6834170b6f0d96828d094269d"><div class="ttname"><a href="classentt_1_1Prototype.html#ab4542df6834170b6f0d96828d094269d">entt::Prototype::entity_type</a></div><div class="ttdeci">Entity entity_type</div><div class="ttdoc">Underlying entity identifier. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00061">prototype.hpp:61</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Registry_html"><div class="ttname"><a href="classentt_1_1Registry.html">entt::Registry</a></div><div class="ttdoc">Fast and reliable entity-component system. </div><div class="ttdef"><b>Definition:</b> <a href="registry_8hpp_source.html#l00040">registry.hpp:40</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_aa6033be234aad4d287d740c40db17fec"><div class="ttname"><a href="classentt_1_1Prototype.html#aa6033be234aad4d287d740c40db17fec">entt::Prototype::Prototype</a></div><div class="ttdeci">Prototype(Registry< Entity > &registry)</div><div class="ttdoc">Constructs a prototype that is bound to a given registry. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00069">prototype.hpp:69</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ab7bf733f40f1071d73d4f3245526c038"><div class="ttname"><a href="classentt_1_1Prototype.html#ab7bf733f40f1071d73d4f3245526c038">entt::Prototype::assign</a></div><div class="ttdeci">void assign(const entity_type dst) const</div><div class="ttdoc">Assigns the components of a prototype to a given entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00333">prototype.hpp:333</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ad4900c4a27f506b5d2b9db54aba9d224"><div class="ttname"><a href="classentt_1_1Prototype.html#ad4900c4a27f506b5d2b9db54aba9d224">entt::Prototype::Prototype</a></div><div class="ttdeci">Prototype(Prototype &&other)</div><div class="ttdoc">Move constructor. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00093">prototype.hpp:93</a></div></div>
|
|
<div class="ttc" id="namespaceentt_html"><div class="ttname"><a href="namespaceentt.html">entt</a></div><div class="ttdoc">EnTT default namespace. </div><div class="ttdef"><b>Definition:</b> <a href="algorithm_8hpp_source.html#l00010">algorithm.hpp:10</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a6b0560c31432fb6591a772ce9a322728"><div class="ttname"><a href="classentt_1_1Prototype.html#a6b0560c31432fb6591a772ce9a322728">entt::Prototype::operator()</a></div><div class="ttdeci">void operator()(const entity_type dst) const ENTT_NOEXCEPT</div><div class="ttdoc">Assigns the components of a prototype to an entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00429">prototype.hpp:429</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a5a659d7582d8fb52c5be59b0a319e2ec"><div class="ttname"><a href="classentt_1_1Prototype.html#a5a659d7582d8fb52c5be59b0a319e2ec">entt::Prototype::create</a></div><div class="ttdeci">entity_type create() const</div><div class="ttdoc">Creates a new entity using a given prototype. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00282">prototype.hpp:282</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_adaec9cc16436af85ef938fc9686cd02d"><div class="ttname"><a href="classentt_1_1Prototype.html#adaec9cc16436af85ef938fc9686cd02d">entt::Prototype::accommodate</a></div><div class="ttdeci">void accommodate(registry_type &other, const entity_type dst) const</div><div class="ttdoc">Assigns or replaces the components of a prototype for an entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00356">prototype.hpp:356</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ac7cb69aad2015e94f3a0a9ad42b82f1b"><div class="ttname"><a href="classentt_1_1Prototype.html#ac7cb69aad2015e94f3a0a9ad42b82f1b">entt::Prototype::operator()</a></div><div class="ttdeci">void operator()(registry_type &other, const entity_type dst) const ENTT_NOEXCEPT</div><div class="ttdoc">Assigns the components of a prototype to an entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00405">prototype.hpp:405</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_acb70104c3d32fcf22fbe37afa7602ed5"><div class="ttname"><a href="classentt_1_1Prototype.html#acb70104c3d32fcf22fbe37afa7602ed5">entt::Prototype::~Prototype</a></div><div class="ttdeci">~Prototype()</div><div class="ttdoc">Releases all its resources. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00077">prototype.hpp:77</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ac75f485a3afa9dada4574269be50166d"><div class="ttname"><a href="classentt_1_1Prototype.html#ac75f485a3afa9dada4574269be50166d">entt::Prototype::unset</a></div><div class="ttdeci">void unset() ENTT_NOEXCEPT</div><div class="ttdoc">Removes the given component from a prototype. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00156">prototype.hpp:156</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Registry_html_a433ac3fc8ea49347f691dd4ad1ccb58b"><div class="ttname"><a href="classentt_1_1Registry.html#a433ac3fc8ea49347f691dd4ad1ccb58b">entt::Registry::create</a></div><div class="ttdeci">entity_type create()</div><div class="ttdoc">Creates a new entity and returns it. </div><div class="ttdef"><b>Definition:</b> <a href="registry_8hpp_source.html#l00402">registry.hpp:402</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a7c401ecc89b0c88ab15ed2dd7686b54e"><div class="ttname"><a href="classentt_1_1Prototype.html#a7c401ecc89b0c88ab15ed2dd7686b54e">entt::Prototype::operator()</a></div><div class="ttdeci">entity_type operator()(registry_type &other) const ENTT_NOEXCEPT</div><div class="ttdoc">Creates a new entity using a given prototype. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00451">prototype.hpp:451</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a65529171240b1b7c348445c7ba4f319e"><div class="ttname"><a href="classentt_1_1Prototype.html#a65529171240b1b7c348445c7ba4f319e">entt::Prototype::operator=</a></div><div class="ttdeci">Prototype & operator=(const Prototype &)=delete</div><div class="ttdoc">Copying a prototype isn&#39;t allowed. </div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a3f156472cc6a07016eadf51082b8f2f8"><div class="ttname"><a href="classentt_1_1Prototype.html#a3f156472cc6a07016eadf51082b8f2f8">entt::Prototype::has</a></div><div class="ttdeci">bool has() const ENTT_NOEXCEPT</div><div class="ttdoc">Checks if a prototype owns all the given components. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00167">prototype.hpp:167</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Registry_html_aefd07a0cdff88ebf1e35e531d58c3077"><div class="ttname"><a href="classentt_1_1Registry.html#aefd07a0cdff88ebf1e35e531d58c3077">entt::Registry::component_type</a></div><div class="ttdeci">typename component_family::family_type component_type</div><div class="ttdoc">Unsigned integer type. </div><div class="ttdef"><b>Definition:</b> <a href="registry_8hpp_source.html#l00129">registry.hpp:129</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_ad39dd5c5449cc647a1402543ebe411fe"><div class="ttname"><a href="classentt_1_1Prototype.html#ad39dd5c5449cc647a1402543ebe411fe">entt::Prototype::operator()</a></div><div class="ttdeci">entity_type operator()() const ENTT_NOEXCEPT</div><div class="ttdoc">Creates a new entity using a given prototype. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00472">prototype.hpp:472</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html"><div class="ttname"><a href="classentt_1_1Prototype.html">entt::Prototype</a></div><div class="ttdoc">Prototype container for concepts. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00039">prototype.hpp:39</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a0a52cda550a678ee14272cff7b2fcf35"><div class="ttname"><a href="classentt_1_1Prototype.html#a0a52cda550a678ee14272cff7b2fcf35">entt::Prototype::assign</a></div><div class="ttdeci">void assign(registry_type &other, const entity_type dst) const</div><div class="ttdoc">Assigns the components of a prototype to a given entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00307">prototype.hpp:307</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a37299298c61bb06a75b697296e328477"><div class="ttname"><a href="classentt_1_1Prototype.html#a37299298c61bb06a75b697296e328477">entt::Prototype::accommodate</a></div><div class="ttdeci">void accommodate(const entity_type dst) const</div><div class="ttdoc">Assigns or replaces the components of a prototype for an entity. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00380">prototype.hpp:380</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a9faf0b8878925090431a9e6acaed06c5"><div class="ttname"><a href="classentt_1_1Prototype.html#a9faf0b8878925090431a9e6acaed06c5">entt::Prototype::operator=</a></div><div class="ttdeci">Prototype & operator=(Prototype &&other)</div><div class="ttdoc">Move assignment operator. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00114">prototype.hpp:114</a></div></div>
|
|
<div class="ttc" id="classentt_1_1Prototype_html_a434b43ae5f761093a0c9e74da0802523"><div class="ttname"><a href="classentt_1_1Prototype.html#a434b43ae5f761093a0c9e74da0802523">entt::Prototype::create</a></div><div class="ttdeci">entity_type create(registry_type &other) const</div><div class="ttdoc">Creates a new entity using a given prototype. </div><div class="ttdef"><b>Definition:</b> <a href="prototype_8hpp_source.html#l00259">prototype.hpp:259</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.13
|
|
</small></address>
|
|
</body>
|
|
</html>
|