shaka-packager/docs/df/d4e/classshaka_1_1IoCache.html

306 lines
17 KiB
HTML
Raw Normal View History

<!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.6"/>
<title>Shaka Packager SDK: shaka::IoCache Class 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">Shaka Packager SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<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&#160;Page</span></a></li>
<li><a href="../../namespaces.html"><span>Namespaces</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&#160;List</span></a></li>
<li><a href="../../classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="../../hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="../../functions.html"><span>Class&#160;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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</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"><a class="el" href="../../d8/daf/namespaceshaka.html">shaka</a></li><li class="navelem"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html">IoCache</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../d2/d2a/classshaka_1_1IoCache-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">shaka::IoCache Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Declaration of class which implements a thread-safe circular buffer.
<a href="../../df/d4e/classshaka_1_1IoCache.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="../../d3/d19/io__cache_8h_source.html">io_cache.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:acd0983786dc742e5bd0c0bae9d49d052"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd0983786dc742e5bd0c0bae9d49d052"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>IoCache</b> (uint64_t cache_size)</td></tr>
<tr class="separator:acd0983786dc742e5bd0c0bae9d49d052"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7cc144c2f848725db08b3ca175475fc2"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a7cc144c2f848725db08b3ca175475fc2">Read</a> (void *buffer, uint64_t size)</td></tr>
<tr class="separator:a7cc144c2f848725db08b3ca175475fc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a483277a6c68dd58cebb8dafb5c1dcd21"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a483277a6c68dd58cebb8dafb5c1dcd21">Write</a> (const void *buffer, uint64_t size)</td></tr>
<tr class="separator:a483277a6c68dd58cebb8dafb5c1dcd21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a10c8e56478fe7bc4c30ea0087eb22804"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a10c8e56478fe7bc4c30ea0087eb22804"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a10c8e56478fe7bc4c30ea0087eb22804">Clear</a> ()</td></tr>
<tr class="memdesc:a10c8e56478fe7bc4c30ea0087eb22804"><td class="mdescLeft">&#160;</td><td class="mdescRight">Empties the cache. <br/></td></tr>
<tr class="separator:a10c8e56478fe7bc4c30ea0087eb22804"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c54ca1d747cf0b0b9ab681babff73e6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a1c54ca1d747cf0b0b9ab681babff73e6">Close</a> ()</td></tr>
<tr class="separator:a1c54ca1d747cf0b0b9ab681babff73e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69c0074123339c9c60dec6a27a5c085c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a69c0074123339c9c60dec6a27a5c085c">closed</a> ()</td></tr>
<tr class="separator:a69c0074123339c9c60dec6a27a5c085c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2c7cbec6d771de00fe0cfe0b7d0e454"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac2c7cbec6d771de00fe0cfe0b7d0e454"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#ac2c7cbec6d771de00fe0cfe0b7d0e454">Reopen</a> ()</td></tr>
<tr class="memdesc:ac2c7cbec6d771de00fe0cfe0b7d0e454"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reopens the cache. Any data still in the cache will be lost. <br/></td></tr>
<tr class="separator:ac2c7cbec6d771de00fe0cfe0b7d0e454"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8033da711e62112877be7a6ac2186622"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a8033da711e62112877be7a6ac2186622">BytesCached</a> ()</td></tr>
<tr class="separator:a8033da711e62112877be7a6ac2186622"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a744559cbb0a3878027ca6fc2a12555c1"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#a744559cbb0a3878027ca6fc2a12555c1">BytesFree</a> ()</td></tr>
<tr class="separator:a744559cbb0a3878027ca6fc2a12555c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abafe56067c5961d56611271b6fc5a760"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abafe56067c5961d56611271b6fc5a760"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d4e/classshaka_1_1IoCache.html#abafe56067c5961d56611271b6fc5a760">WaitUntilEmptyOrClosed</a> ()</td></tr>
<tr class="memdesc:abafe56067c5961d56611271b6fc5a760"><td class="mdescLeft">&#160;</td><td class="mdescRight">Waits until the cache is empty or has been closed. <br/></td></tr>
<tr class="separator:abafe56067c5961d56611271b6fc5a760"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Declaration of class which implements a thread-safe circular buffer. </p>
<p>Definition at line <a class="el" href="../../d3/d19/io__cache_8h_source.html#l00019">19</a> of file <a class="el" href="../../d3/d19/io__cache_8h_source.html">io_cache.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a8033da711e62112877be7a6ac2186622"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t shaka::IoCache::BytesCached </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of bytes in the cache. </p>
<dl class="section return"><dt>Returns</dt><dd>the number of bytes in the cache. </dd></dl>
<p>Definition at line <a class="el" href="../../d4/d37/io__cache_8cc_source.html#l00125">125</a> of file <a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a>.</p>
</div>
</div>
<a class="anchor" id="a744559cbb0a3878027ca6fc2a12555c1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t shaka::IoCache::BytesFree </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of free bytes in the cache. </p>
<dl class="section return"><dt>Returns</dt><dd>the number of free bytes in the cache. </dd></dl>
<p>Definition at line <a class="el" href="../../d4/d37/io__cache_8cc_source.html#l00130">130</a> of file <a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a>.</p>
</div>
</div>
<a class="anchor" id="a1c54ca1d747cf0b0b9ab681babff73e6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void shaka::IoCache::Close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Close the cache. This will call any blocking calls to unblock, and the cache won't be usable until Reopened. </p>
<p>Definition at line <a class="el" href="../../d4/d37/io__cache_8cc_source.html#l00109">109</a> of file <a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a>.</p>
</div>
</div>
<a class="anchor" id="a69c0074123339c9c60dec6a27a5c085c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::IoCache::closed </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">
<dl class="section return"><dt>Returns</dt><dd>true if the cache is closed, false otherwise. </dd></dl>
<p>Definition at line <a class="el" href="../../d3/d19/io__cache_8h_source.html#l00049">49</a> of file <a class="el" href="../../d3/d19/io__cache_8h_source.html">io_cache.h</a>.</p>
</div>
</div>
<a class="anchor" id="a7cc144c2f848725db08b3ca175475fc2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t shaka::IoCache::Read </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read data from the cache. This function may block until there is data in the cache. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>is a buffer into which to read the data from the cache. </td></tr>
<tr><td class="paramname">size</td><td>is the size of <em>buffer</em>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of bytes read into <em>buffer</em>, or 0 if the call unblocked because the cache has been closed and is empty. </dd></dl>
<p>Definition at line <a class="el" href="../../d4/d37/io__cache_8cc_source.html#l00038">38</a> of file <a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a>.</p>
</div>
</div>
<a class="anchor" id="a483277a6c68dd58cebb8dafb5c1dcd21"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t shaka::IoCache::Write </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Write data to the cache. This function may block until there is enough room in the cache. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>is a buffer containing the data to be written to the cache. </td></tr>
<tr><td class="paramname">size</td><td>is the size of the data to be written to the cache. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the amount of data written to the buffer (which will equal <em>data</em>), or 0 if the call unblocked because the cache has been closed. </dd></dl>
<p>Definition at line <a class="el" href="../../d4/d37/io__cache_8cc_source.html#l00066">66</a> of file <a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>packager/file/<a class="el" href="../../d3/d19/io__cache_8h_source.html">io_cache.h</a></li>
<li>packager/file/<a class="el" href="../../d4/d37/io__cache_8cc_source.html">io_cache.cc</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Sep 19 2017 20:22:04 for Shaka Packager SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>