<!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"/> <title>RAUL: Raul::SRSWQueue< T > Class Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</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> </ul> </div> <div class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"> <ul> <li><b>Raul</b> </li> <li><a class="el" href="classRaul_1_1SRSWQueue.html">Raul::SRSWQueue< T ></a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <h1>Raul::SRSWQueue< T > Class Template Reference</h1> </div> </div> <div class="contents"> <!-- doxytag: class="Raul::SRSWQueue" --> <p>Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer). <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="SRSWQueue_8hpp_source.html">SRSWQueue.hpp</a>></code></p> <p><a href="classRaul_1_1SRSWQueue-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#a119674f27fabe84da5dd0452184c62e6">SRSWQueue</a> (size_t size)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a43d866d18cf922a8458d53e9325171a1"></a><!-- doxytag: member="Raul::SRSWQueue::capacity" ref="a43d866d18cf922a8458d53e9325171a1" args="() const " --> size_t </td><td class="memItemRight" valign="bottom"><b>capacity</b> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7604393d79badac198f56ddb3864f12f"></a><!-- doxytag: member="Raul::SRSWQueue::full" ref="a7604393d79badac198f56ddb3864f12f" args="() const " --> bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#a7604393d79badac198f56ddb3864f12f">full</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return whether or not the queue is full. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#a5d045a1f3a8e554de0d34b48fd9c7091">push</a> (const T &obj)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Push an item onto the back of the <a class="el" href="classRaul_1_1SRSWQueue.html" title="Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer).">SRSWQueue</a> - realtime-safe, not thread-safe. <a href="#a5d045a1f3a8e554de0d34b48fd9c7091"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af77ab183e8b5dcfdb77171ab8e658fa4"></a><!-- doxytag: member="Raul::SRSWQueue::empty" ref="af77ab183e8b5dcfdb77171ab8e658fa4" args="() const " --> bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#af77ab183e8b5dcfdb77171ab8e658fa4">empty</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return whether or not the queue is empty. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a34d0cfff052a2dee155686913e3ed003"></a><!-- doxytag: member="Raul::SRSWQueue::front" ref="a34d0cfff052a2dee155686913e3ed003" args="() const " --> T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#a34d0cfff052a2dee155686913e3ed003">front</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the element at the front of the queue without removing it. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classRaul_1_1SRSWQueue.html#a7bb21f8920cee9611cdc1019a9c50524">pop</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Pop an item off the front of the queue - realtime-safe, not thread-safe. <a href="#a7bb21f8920cee9611cdc1019a9c50524"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <h3>template<typename T><br/> class Raul::SRSWQueue< T ></h3> <p>Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer). </p> <p>This is appropriate for a cross-thread queue of fixed size object. If you need to do variable sized reads and writes, use <a class="el" href="classRaul_1_1RingBuffer.html" title="A lock-free RingBuffer.">Raul::RingBuffer</a> instead.</p> <p>Implemented as a dequeue in a fixed array. This is read/write thread-safe, pushing and popping may occur simultaneously by seperate threads, but the push and pop operations themselves are not thread-safe (ie. there can be at most 1 read and at most 1 writer thread). </p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a119674f27fabe84da5dd0452184c62e6"></a><!-- doxytag: member="Raul::SRSWQueue::SRSWQueue" ref="a119674f27fabe84da5dd0452184c62e6" args="(size_t size)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T > </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="classRaul_1_1SRSWQueue.html">Raul::SRSWQueue</a>< T >::<a class="el" href="classRaul_1_1SRSWQueue.html">SRSWQueue</a> </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"> <em>size</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>Size in number of elements </td></tr> </table> </dd> </dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a5d045a1f3a8e554de0d34b48fd9c7091"></a><!-- doxytag: member="Raul::SRSWQueue::push" ref="a5d045a1f3a8e554de0d34b48fd9c7091" args="(const T &obj)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T> </div> <table class="memname"> <tr> <td class="memname">bool <a class="el" href="classRaul_1_1SRSWQueue.html">Raul::SRSWQueue</a>< T >::push </td> <td>(</td> <td class="paramtype">const T & </td> <td class="paramname"> <em>elem</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Push an item onto the back of the <a class="el" href="classRaul_1_1SRSWQueue.html" title="Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer).">SRSWQueue</a> - realtime-safe, not thread-safe. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>true if <em>elem</em> was successfully pushed onto the queue, false otherwise (queue is full). </dd></dl> <p>References <a class="el" href="classRaul_1_1SRSWQueue.html#a7604393d79badac198f56ddb3864f12f">Raul::SRSWQueue< T >::full()</a>.</p> <p>Referenced by <a class="el" href="classRaul_1_1Maid.html#a0bbfa3552c0c96792d301267b92e28ce">Raul::Maid::push()</a>.</p> </div> </div> <a class="anchor" id="a7bb21f8920cee9611cdc1019a9c50524"></a><!-- doxytag: member="Raul::SRSWQueue::pop" ref="a7bb21f8920cee9611cdc1019a9c50524" args="()" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T > </div> <table class="memname"> <tr> <td class="memname">void <a class="el" href="classRaul_1_1SRSWQueue.html">Raul::SRSWQueue</a>< T >::pop </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Pop an item off the front of the queue - realtime-safe, not thread-safe. </p> <p>It is a fatal error to call <a class="el" href="classRaul_1_1SRSWQueue.html#a7bb21f8920cee9611cdc1019a9c50524" title="Pop an item off the front of the queue - realtime-safe, not thread-safe.">pop()</a> when the queue is empty.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>the element popped. </dd></dl> <p>References <a class="el" href="classRaul_1_1SRSWQueue.html#af77ab183e8b5dcfdb77171ab8e658fa4">Raul::SRSWQueue< T >::empty()</a>.</p> <p>Referenced by <a class="el" href="classRaul_1_1Maid.html#a83d64bae9f6838d05e6ae8f9740b4dae">Raul::Maid::cleanup()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="SRSWQueue_8hpp_source.html">SRSWQueue.hpp</a></li> </ul> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Oct 6 2010 for RAUL by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address> </body> </html>