<!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>ucommon: stackof< T > Class Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">ucommon</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="classes.html"><span>Data Structure Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Data Fields</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('a00148.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <h1>stackof< T > Class Template Reference</h1> </div> </div> <div class="contents"> <!-- doxytag: class="stackof" --><!-- doxytag: inherits="stack" --> <p>A templated typed class for thread-safe stack of object pointers. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="a00180_source.html">containers.h</a>></code></p> <div class="dynheader"> Inheritance diagram for stackof< T >:</div> <div class="dyncontent"> <div class="center"><img src="a00472.png" border="0" usemap="#stackof_3_01_t_01_4_inherit__map" alt="Inheritance graph"/></div> <map name="stackof_3_01_t_01_4_inherit__map" id="stackof_3_01_t_01_4_inherit__map"> <area shape="rect" id="node2" href="a00147.html" title="Manage a thread-safe stack of objects through reference pointers." alt="" coords="40,80,112,107"/><area shape="rect" id="node4" href="a00034.html" title="The conditional is a common base for other thread synchronizing classes." alt="" coords="11,5,141,32"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <div class="dynheader"> Collaboration diagram for stackof< T >:</div> <div class="dyncontent"> <div class="center"><img src="a00473.png" border="0" usemap="#stackof_3_01_t_01_4_coll__map" alt="Collaboration graph"/></div> <map name="stackof_3_01_t_01_4_coll__map" id="stackof_3_01_t_01_4_coll__map"> <area shape="rect" id="node2" href="a00147.html" title="Manage a thread-safe stack of objects through reference pointers." alt="" coords="175,280,247,307"/><area shape="rect" id="node4" href="a00034.html" title="The conditional is a common base for other thread synchronizing classes." alt="" coords="5,168,136,195"/><area shape="rect" id="node6" href="a00079.html" title="A managed private heap for small allocations." alt="" coords="160,168,261,195"/><area shape="rect" id="node8" href="a00077.html" title="A memory protocol pager for private heap manager." alt="" coords="160,83,261,109"/><area shape="rect" id="node10" href="a00071.html" title="Common locking protocol." alt="" coords="125,5,296,32"/><area shape="rect" id="node12" href="a00065.html" title="Common base class for all objects that can be formed into a linked list." alt="" coords="285,168,427,195"/><area shape="rect" id="node14" href="a00091.html" title="A common base class for all managed objects." alt="" coords="315,83,397,109"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <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">T * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#a7495273f0fec8a499f401574ef78237b">pull</a> (<a class="el" href="a00193.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout=0)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get and remove last typed object posted to the stack. <a href="#a7495273f0fec8a499f401574ef78237b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#affb6a1f6d2fde1769d1a06c3e61b8ff3">push</a> (T *object, <a class="el" href="a00193.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout=0)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Push a typed object into the stack by it's pointer. <a href="#affb6a1f6d2fde1769d1a06c3e61b8ff3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#a162ec43cebe97926f80a097243137a3f">remove</a> (T *object)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Remove a specific typed object pointer for the stack. <a href="#a162ec43cebe97926f80a097243137a3f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#a92e8491f6eae84f69a1d6b009d65a43d">stackof</a> (<a class="el" href="a00079.html">mempager</a> *memory, size_t size=0)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create templated stack of typed objects. <a href="#a92e8491f6eae84f69a1d6b009d65a43d"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><h3>template<class T><br/> class stackof< T ></h3> <p>A templated typed class for thread-safe stack of object pointers. </p> <p>This allows one to use the stack class in a typesafe manner for a specific object type derived from <a class="el" href="a00091.html" title="A common base class for all managed objects.">Object</a> rather than generically for any derived object class. </p> <dl class="author"><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@gnutelephony.org">dyfet@gnutelephony.org</a>> </dd></dl> <p>Definition at line <a class="el" href="a00180_source.html#l00552">552</a> of file <a class="el" href="a00180_source.html">containers.h</a>.</p> </div><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a92e8491f6eae84f69a1d6b009d65a43d"></a><!-- doxytag: member="stackof::stackof" ref="a92e8491f6eae84f69a1d6b009d65a43d" args="(mempager *memory, size_t size=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00148.html">stackof</a>< T >::<a class="el" href="a00148.html">stackof</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="a00079.html">mempager</a> * </td> <td class="paramname"><em>memory</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>size</em> = <code>0</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Create templated stack of typed objects. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">memory</td><td>pool for internal use of stack. </td></tr> <tr><td class="paramname">size</td><td>of stack to construct. Uses 0 if no size limit. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="a00180_source.html#l00560">560</a> of file <a class="el" href="a00180_source.html">containers.h</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a7495273f0fec8a499f401574ef78237b"></a><!-- doxytag: member="stackof::pull" ref="a7495273f0fec8a499f401574ef78237b" args="(timeout_t timeout=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="memname"> <tr> <td class="memname">T* <a class="el" href="a00148.html">stackof</a>< T >::pull </td> <td>(</td> <td class="paramtype"><a class="el" href="a00193.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> </td> <td class="paramname"><em>timeout</em> = <code>0</code></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Get and remove last typed object posted to the stack. </p> <p>This can wait for a specified timeout of the stack is empty. The object is still retained and must be released or deleted by the receiving function. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">timeout</td><td>to wait if empty in milliseconds. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>object from queue or NULL if empty and timed out. </dd></dl> <p>Reimplemented from <a class="el" href="a00147.html#ae4e21b3a7a753a08a8d73c1b5a6a4e70">stack</a>.</p> <p>Definition at line <a class="el" href="a00180_source.html#l00590">590</a> of file <a class="el" href="a00180_source.html">containers.h</a>.</p> </div> </div> <a class="anchor" id="affb6a1f6d2fde1769d1a06c3e61b8ff3"></a><!-- doxytag: member="stackof::push" ref="affb6a1f6d2fde1769d1a06c3e61b8ff3" args="(T *object, timeout_t timeout=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="memname"> <tr> <td class="memname">bool <a class="el" href="a00148.html">stackof</a>< T >::push </td> <td>(</td> <td class="paramtype">T * </td> <td class="paramname"><em>object</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="a00193.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> </td> <td class="paramname"><em>timeout</em> = <code>0</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Push a typed object into the stack by it's pointer. </p> <p>This can wait for a specified timeout if the queue is full, for example, for another thread to remove an object pointer. This retains the object. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">object</td><td>to push. </td></tr> <tr><td class="paramname">timeout</td><td>to wait if queue is full in milliseconds. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if object pushed, false if queue full and timeout expired. </dd></dl> <p>Definition at line <a class="el" href="a00180_source.html#l00580">580</a> of file <a class="el" href="a00180_source.html">containers.h</a>.</p> </div> </div> <a class="anchor" id="a162ec43cebe97926f80a097243137a3f"></a><!-- doxytag: member="stackof::remove" ref="a162ec43cebe97926f80a097243137a3f" args="(T *object)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="memname"> <tr> <td class="memname">bool <a class="el" href="a00148.html">stackof</a>< T >::remove </td> <td>(</td> <td class="paramtype">T * </td> <td class="paramname"><em>object</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Remove a specific typed object pointer for the stack. </p> <p>This can remove a member from any location in the stack, whether beginning, end, or somewhere in the middle. This releases the object. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">object</td><td>to remove. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if object was removed, false if not found. </dd></dl> <p>Definition at line <a class="el" href="a00180_source.html#l00569">569</a> of file <a class="el" href="a00180_source.html">containers.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>ucommon/<a class="el" href="a00180_source.html">containers.h</a></li> </ul> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="a00148.html">stackof</a> </li> <li class="footer">Generated on Wed Apr 13 2011 22:39:48 for ucommon by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>