blob: 778c7632a56017b52facffd51260a73dc23211a2 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::VarArrayBuffer Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::VarArrayBuffer" --><!-- doxytag: inherits="pp::Var" --><div class="dynheader">
Inheritance diagram for pp::VarArrayBuffer:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_var_array_buffer__inherit__graph.png" border="0" usemap="#pp_1_1_var_array_buffer_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_var_array_buffer_inherit__map" id="pp_1_1_var_array_buffer_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page." alt="" coords="41,5,108,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_var_array_buffer-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#a3ce55ddf56dd4fe7bb37cf6cbf10a85a">VarArrayBuffer</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#aa933ee36d23a31ae35acacbb10069a6b">VarArrayBuffer</a> (const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;var)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#a7fd29347661fc1539dd474cc3f0e2a72">VarArrayBuffer</a> (uint32_t size_in_bytes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#a9b76b96c7b11a10aa4424c02b4a5511b">VarArrayBuffer</a> (const <a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a> &amp;buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#afc67644105914d333c2266c056c99190">~VarArrayBuffer</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#afe636bd8a6011c04dce0eaa84af7c1ee">operator=</a> (const <a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#a9cbb8584d8edc5d03875de67dec4086c">operator=</a> (const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#aee1fdb39f8a1ebcd8a78fb5e996e0af2">ByteLength</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#ab81d9579bcacf5eb927a9638092d2f3b">Map</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_var_array_buffer.html#a271e6bb122f313a758b5fce1dc751687">Unmap</a> ()</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous sequence of bytes. </p>
<p>Note that these vars are not part of the embedding page's DOM, and can only be shared with JavaScript using the <code>PostMessage</code> and <code>HandleMessage</code> functions of <code><a class="el" href="classpp_1_1_instance.html">Instance</a></code>. </p>
</div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a3ce55ddf56dd4fe7bb37cf6cbf10a85a"></a><!-- doxytag: member="pp::VarArrayBuffer::VarArrayBuffer" ref="a3ce55ddf56dd4fe7bb37cf6cbf10a85a" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var_array_buffer.html#a3ce55ddf56dd4fe7bb37cf6cbf10a85a">pp::VarArrayBuffer::VarArrayBuffer</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The default constructor constructs a <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> which is 0 byte long. </p>
</div>
</div>
<a class="anchor" id="aa933ee36d23a31ae35acacbb10069a6b"></a><!-- doxytag: member="pp::VarArrayBuffer::VarArrayBuffer" ref="aa933ee36d23a31ae35acacbb10069a6b" args="(const Var &amp;var)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var_array_buffer.html#a3ce55ddf56dd4fe7bb37cf6cbf10a85a">pp::VarArrayBuffer::VarArrayBuffer</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
<td class="paramname"><em>var</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Construct a <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> given a var for which <a class="el" href="classpp_1_1_var.html#ac0fd1d153203f8fe6c23b88618a5ef65" title="This function determines if this Var is an ArrayBuffer.">is_array_buffer()</a> is true. </p>
<p>This will refer to the same <code>ArrayBuffer</code> as var, but allows you to access methods specific to <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">var</td><td>An <code>ArrayBuffer</code> var. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a7fd29347661fc1539dd474cc3f0e2a72"></a><!-- doxytag: member="pp::VarArrayBuffer::VarArrayBuffer" ref="a7fd29347661fc1539dd474cc3f0e2a72" args="(uint32_t size_in_bytes)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var_array_buffer.html#a3ce55ddf56dd4fe7bb37cf6cbf10a85a">pp::VarArrayBuffer::VarArrayBuffer</a> </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>size_in_bytes</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Construct a new <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> which is <code>size_in_bytes</code> bytes long and initialized to zero. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">size_in_bytes</td><td>The size of the constructed <code>ArrayBuffer</code> in bytes. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9b76b96c7b11a10aa4424c02b4a5511b"></a><!-- doxytag: member="pp::VarArrayBuffer::VarArrayBuffer" ref="a9b76b96c7b11a10aa4424c02b4a5511b" args="(const VarArrayBuffer &amp;buffer)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var_array_buffer.html#a3ce55ddf56dd4fe7bb37cf6cbf10a85a">pp::VarArrayBuffer::VarArrayBuffer</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a> &amp;&#160;</td>
<td class="paramname"><em>buffer</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Copy constructor. </p>
</div>
</div>
<a class="anchor" id="afc67644105914d333c2266c056c99190"></a><!-- doxytag: member="pp::VarArrayBuffer::~VarArrayBuffer" ref="afc67644105914d333c2266c056c99190" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classpp_1_1_var_array_buffer.html#afc67644105914d333c2266c056c99190">pp::VarArrayBuffer::~VarArrayBuffer</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="aee1fdb39f8a1ebcd8a78fb5e996e0af2"></a><!-- doxytag: member="pp::VarArrayBuffer::ByteLength" ref="aee1fdb39f8a1ebcd8a78fb5e996e0af2" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t <a class="el" href="classpp_1_1_var_array_buffer.html#aee1fdb39f8a1ebcd8a78fb5e996e0af2">pp::VarArrayBuffer::ByteLength</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_var_array_buffer.html#aee1fdb39f8a1ebcd8a78fb5e996e0af2" title="ByteLength() retrieves the length of the VarArrayBuffer in bytes.">ByteLength()</a> retrieves the length of the <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> in bytes. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The length of the <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> in bytes. </dd></dl>
</div>
</div>
<a class="anchor" id="ab81d9579bcacf5eb927a9638092d2f3b"></a><!-- doxytag: member="pp::VarArrayBuffer::Map" ref="ab81d9579bcacf5eb927a9638092d2f3b" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* <a class="el" href="classpp_1_1_var_array_buffer.html#ab81d9579bcacf5eb927a9638092d2f3b">pp::VarArrayBuffer::Map</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_var_array_buffer.html#ab81d9579bcacf5eb927a9638092d2f3b" title="Map() maps the ArrayBuffer in to the module's address space and returns a pointer to the beginning of...">Map()</a> maps the <code>ArrayBuffer</code> in to the module's address space and returns a pointer to the beginning of the internal buffer for this <code>ArrayBuffer</code>. </p>
<p>ArrayBuffers are copied when transmitted, so changes to the underlying memory are not automatically available to the embedding page.</p>
<p>Note that calling <a class="el" href="classpp_1_1_var_array_buffer.html#ab81d9579bcacf5eb927a9638092d2f3b" title="Map() maps the ArrayBuffer in to the module's address space and returns a pointer to the beginning of...">Map()</a> can be a relatively expensive operation. Use care when calling it in performance-critical code. For example, you should call it only once when looping over an <code>ArrayBuffer</code>.</p>
<p><b>Example:</b></p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">char</span>* data = <span class="keyword">static_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(array_buffer_var.Map());
uint32_t byte_length = array_buffer_var.ByteLength();
<span class="keywordflow">for</span> (uint32_t i = 0; i &lt; byte_length; ++i)
data[i] = <span class="charliteral">&#39;A&#39;</span>;
</pre></div><dl class="return"><dt><b>Returns:</b></dt><dd>A pointer to the internal buffer for this <code>ArrayBuffer</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="afe636bd8a6011c04dce0eaa84af7c1ee"></a><!-- doxytag: member="pp::VarArrayBuffer::operator=" ref="afe636bd8a6011c04dce0eaa84af7c1ee" args="(const VarArrayBuffer &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a>&amp; pp::VarArrayBuffer::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function assigns one <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> to another <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>The <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> to be assigned.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The resulting <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a9cbb8584d8edc5d03875de67dec4086c"></a><!-- doxytag: member="pp::VarArrayBuffer::operator=" ref="a9cbb8584d8edc5d03875de67dec4086c" args="(const Var &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classpp_1_1_var.html">Var</a>&amp; pp::VarArrayBuffer::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function assigns one <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> to another <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code>. </p>
<p>A <a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a>'s assignment operator is overloaded here so that we can check for assigning a non-ArrayBuffer var to a <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>The <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> to be assigned.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The resulting <code><a class="el" href="classpp_1_1_var_array_buffer.html" title="VarArrayBuffer provides a way to interact with JavaScript ArrayBuffers, which represent a contiguous ...">VarArrayBuffer</a></code> (as a <a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a>&amp;). </dd></dl>
<p>Reimplemented from <a class="el" href="classpp_1_1_var.html#a65601024610f1625c9945acb8725d7c4">pp::Var</a>.</p>
</div>
</div>
<a class="anchor" id="a271e6bb122f313a758b5fce1dc751687"></a><!-- doxytag: member="pp::VarArrayBuffer::Unmap" ref="a271e6bb122f313a758b5fce1dc751687" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_var_array_buffer.html#a271e6bb122f313a758b5fce1dc751687">pp::VarArrayBuffer::Unmap</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_var_array_buffer.html#a271e6bb122f313a758b5fce1dc751687" title="Unmap() unmaps this ArrayBuffer var from the module address space.">Unmap()</a> unmaps this <code>ArrayBuffer</code> var from the module address space. </p>
<p>Use this if you want to save memory but might want to call <a class="el" href="classpp_1_1_var_array_buffer.html#ab81d9579bcacf5eb927a9638092d2f3b" title="Map() maps the ArrayBuffer in to the module's address space and returns a pointer to the beginning of...">Map()</a> to map the buffer again later. </p>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="var__array__buffer_8h.html">var_array_buffer.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}