shaka-packager/docs/d5/d33/classshaka_1_1media_1_1Prod...

506 lines
27 KiB
HTML
Raw Permalink Normal View History

<!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"/>
2021-06-22 00:16:40 +00:00
<meta name="generator" content="Doxygen 1.8.17"/>
2018-02-10 23:37:42 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Shaka Packager SDK: shaka::media::ProducerConsumerQueue&lt; T &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"/>
2018-02-10 23:37:42 +00:00
<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;">
2018-02-10 23:37:42 +00:00
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Shaka Packager SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
2021-06-22 00:16:40 +00:00
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2021-06-22 00:16:40 +00:00
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
2018-02-10 23:37:42 +00:00
<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 */
2018-02-10 23:37:42 +00:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
2018-02-10 23:37:42 +00:00
<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)">
2018-02-10 23:37:42 +00:00
</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"><b>media</b></li><li class="navelem"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../dd/dc4/classshaka_1_1media_1_1ProducerConsumerQueue-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">shaka::media::ProducerConsumerQueue&lt; T &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.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:ad7ccb149baa88e5f8356be18344d2baf"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ad7ccb149baa88e5f8356be18344d2baf">ProducerConsumerQueue</a> (size_t capacity)</td></tr>
<tr class="separator:ad7ccb149baa88e5f8356be18344d2baf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80ff75afdbbf7f567dcb57a755542ffc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a80ff75afdbbf7f567dcb57a755542ffc">ProducerConsumerQueue</a> (size_t capacity, size_t starting_pos)</td></tr>
<tr class="separator:a80ff75afdbbf7f567dcb57a755542ffc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6eaf80daa8c96b0157f5fcd9763dbec1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a6eaf80daa8c96b0157f5fcd9763dbec1">Push</a> (const T &amp;element, int64_t timeout_ms)</td></tr>
<tr class="separator:a6eaf80daa8c96b0157f5fcd9763dbec1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a935e9ddee232be82d224c9b81b3b4f88"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a935e9ddee232be82d224c9b81b3b4f88">Pop</a> (T *element, int64_t timeout_ms)</td></tr>
<tr class="separator:a935e9ddee232be82d224c9b81b3b4f88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a92d6cca0ecfb54f6edf9a0408305e9cd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a92d6cca0ecfb54f6edf9a0408305e9cd">Peek</a> (size_t pos, T *element, int64_t timeout_ms)</td></tr>
<tr class="separator:a92d6cca0ecfb54f6edf9a0408305e9cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac600977b708381facf07f87e36b43d79"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ac600977b708381facf07f87e36b43d79">Stop</a> ()</td></tr>
<tr class="separator:ac600977b708381facf07f87e36b43d79"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a19881dbe30e5ace8b9844b81b1f33350"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a19881dbe30e5ace8b9844b81b1f33350">Empty</a> () const</td></tr>
<tr class="separator:a19881dbe30e5ace8b9844b81b1f33350"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a12f9de3067fe5cf43fd002b56a9811a4"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a12f9de3067fe5cf43fd002b56a9811a4">Size</a> () const</td></tr>
<tr class="separator:a12f9de3067fe5cf43fd002b56a9811a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ad0ff1e27d529820e27656581a8542b"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a3ad0ff1e27d529820e27656581a8542b">HeadPos</a> () const</td></tr>
<tr class="separator:a3ad0ff1e27d529820e27656581a8542b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d92eabaee0d6a862e759a154e1e5df6"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a7d92eabaee0d6a862e759a154e1e5df6">TailPos</a> () const</td></tr>
<tr class="separator:a7d92eabaee0d6a862e759a154e1e5df6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a83045f2ceb8b6ce77b66dddef00d93be"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#a83045f2ceb8b6ce77b66dddef00d93be">Stopped</a> () const</td></tr>
<tr class="separator:a83045f2ceb8b6ce77b66dddef00d93be"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
2018-02-10 23:37:42 +00:00
<div class="textblock"><h3>template&lt;class T&gt;<br />
class shaka::media::ProducerConsumerQueue&lt; T &gt;</h3>
<p>A thread safe producer consumer queue implementation. It allows the standard push and pop operations. It also maintains a monotonically-increasing element position and allows peeking at the element at certain position. </p>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00028">28</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
2018-02-10 23:37:42 +00:00
<a id="ad7ccb149baa88e5f8356be18344d2baf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7ccb149baa88e5f8356be18344d2baf">&#9670;&nbsp;</a></span>ProducerConsumerQueue() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::<a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>capacity</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Create a <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> starting from position 0. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">capacity</td><td>is the maximum number of elements that the queue can hold at once. A value of zero means unlimited capacity. </td></tr>
</table>
</dd>
</dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00138">138</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a80ff75afdbbf7f567dcb57a755542ffc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80ff75afdbbf7f567dcb57a755542ffc">&#9670;&nbsp;</a></span>ProducerConsumerQueue() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::<a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>capacity</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>starting_pos</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Create a <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> starting from indicated position. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">capacity</td><td>is the maximum number of elements that the queue can hold at once. A value of zero means unlimited capacity. </td></tr>
<tr><td class="paramname">starting_pos</td><td>is the starting head position. </td></tr>
</table>
</dd>
</dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00147">147</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
2018-02-10 23:37:42 +00:00
<a id="a19881dbe30e5ace8b9844b81b1f33350"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a19881dbe30e5ace8b9844b81b1f33350">&#9670;&nbsp;</a></span>Empty()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Empty </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">
<dl class="section return"><dt>Returns</dt><dd>true if there are no elements in the queue. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00088">88</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a3ad0ff1e27d529820e27656581a8542b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ad0ff1e27d529820e27656581a8542b">&#9670;&nbsp;</a></span>HeadPos()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::HeadPos </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">
<dl class="section return"><dt>Returns</dt><dd>The position of the head element in the queue. Note that the returned value may be meaningless if the queue is empty. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00101">101</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a92d6cca0ecfb54f6edf9a0408305e9cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a92d6cca0ecfb54f6edf9a0408305e9cd">&#9670;&nbsp;</a></span>Peek()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a> <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Peek </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>pos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">T *&#160;</td>
<td class="paramname"><em>element</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t&#160;</td>
<td class="paramname"><em>timeout_ms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Peek at the element at the specified position from the queue. If the element is not available yet, block until it to be available or time out or stopped. NOTE: Elements before (pos - capacity/2) will be removed from the queue after Peek operation. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir"></td><td class="paramname">pos</td><td>refers to the element position. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">element</td><td>receives the peeked element. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>STOPPED if Stop has been called and <em>pos</em> is out of range, INVALID_ARGUMENT if the pos &lt; Head(), TIME_OUT if times out, OK otherwise. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00252">252</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a935e9ddee232be82d224c9b81b3b4f88"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a935e9ddee232be82d224c9b81b3b4f88">&#9670;&nbsp;</a></span>Pop()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a> <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Pop </td>
<td>(</td>
<td class="paramtype">T *&#160;</td>
<td class="paramname"><em>element</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t&#160;</td>
<td class="paramname"><em>timeout_ms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Pop an element from the front of the queue. If the queue is empty, block for an element to be available to be consumed or time out or stopped. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">element</td><td>receives the popped element. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>STOPPED if Stop has been called and the queue is completely empty, TIME_OUT if times out, OK otherwise. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00210">210</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a6eaf80daa8c96b0157f5fcd9763dbec1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6eaf80daa8c96b0157f5fcd9763dbec1">&#9670;&nbsp;</a></span>Push()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d2/d20/classshaka_1_1Status.html">Status</a> <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Push </td>
<td>(</td>
<td class="paramtype">const T &amp;&#160;</td>
<td class="paramname"><em>element</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t&#160;</td>
<td class="paramname"><em>timeout_ms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Push an element to the back of the queue. If the queue has reached its capacity limit, block until spare capacity is available or time out or stopped. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">element</td><td>refers the element to be pushed. </td></tr>
<tr><td class="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>OK if the element was pushed successfully, STOPPED if Stop has has been called, TIME_OUT if times out. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00161">161</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a12f9de3067fe5cf43fd002b56a9811a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a12f9de3067fe5cf43fd002b56a9811a4">&#9670;&nbsp;</a></span>Size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Size </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">
<dl class="section return"><dt>Returns</dt><dd>The number of elements in the queue. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00094">94</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ac600977b708381facf07f87e36b43d79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac600977b708381facf07f87e36b43d79">&#9670;&nbsp;</a></span>Stop()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Stop </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Terminate Pop and Peek requests once the queue drains entirely. Also terminate all waiting and future Push requests immediately. Stop cannot stall. </p>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00079">79</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a83045f2ceb8b6ce77b66dddef00d93be"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a83045f2ceb8b6ce77b66dddef00d93be">&#9670;&nbsp;</a></span>Stopped()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::Stopped </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">
<dl class="section return"><dt>Returns</dt><dd>true if the queue has been stopped using <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ac600977b708381facf07f87e36b43d79">Stop()</a>. This allows producers to check if they can add new elements to the queue. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00115">115</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a7d92eabaee0d6a862e759a154e1e5df6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d92eabaee0d6a862e759a154e1e5df6">&#9670;&nbsp;</a></span>TailPos()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t <a class="el" href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>&lt; T &gt;::TailPos </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">
<dl class="section return"><dt>Returns</dt><dd>The position of the tail element in the queue. Note that the returned value may be meaningless if the queue is empty. </dd></dl>
2018-02-10 23:37:42 +00:00
<p class="definition">Definition at line <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html#l00108">108</a> of file <a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>packager/media/base/<a class="el" href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
2021-06-22 00:16:40 +00:00
Generated on Tue Jun 22 2021 00:16:05 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.17
</small></address>
</body>
</html>