<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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00028">28</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<tdclass="memname"><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::<aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a></td>
<tr><tdclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00138">138</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::<aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a></td>
<p>Create a <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> starting from indicated position. </p>
<tr><tdclass="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><tdclass="paramname">starting_pos</td><td>is the starting head position. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00147">147</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<tdclass="memname">bool <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Empty </td>
<dlclass="section return"><dt>Returns</dt><dd>true if there are no elements in the queue. </dd></dl>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00088">88</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::HeadPos </td>
<dlclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00101">101</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">Status <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Peek </td>
<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>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir"></td><tdclass="paramname">pos</td><td>refers to the element position. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">element</td><td>receives the peeked element. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="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>
<dlclass="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 < Head(), TIME_OUT if times out, OK otherwise. </dd></dl>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00252">252</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">Status <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Pop </td>
<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>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">element</td><td>receives the popped element. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="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>
<dlclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00210">210</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">Status <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Push </td>
<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>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">element</td><td>refers the element to be pushed. </td></tr>
<tr><tdclass="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>
<dlclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00161">161</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Size </td>
<dlclass="section return"><dt>Returns</dt><dd>The number of elements in the queue. </dd></dl>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00094">94</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">void <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Stop </td>
<p>Terminate Pop and Peek requests once the queue drains entirely. Also terminate all waiting and future Push requests immediately. Stop cannot stall. </p>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00079">79</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">bool <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Stopped </td>
<dlclass="section return"><dt>Returns</dt><dd>true if the queue has been stopped using <aclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00115">115</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::TailPos </td>
<dlclass="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>
<p>Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00108">108</a> of file <aclass="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>