<!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: ucommon::SharedPointer Class 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.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.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 class="tabs"> <ul> <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="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Data Fields</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="a00208.html">ucommon</a>::<a class="el" href="a00127.html">SharedPointer</a> </div> </div> <div class="contents"> <h1>ucommon::SharedPointer Class Reference</h1><!-- doxytag: class="ucommon::SharedPointer" --><!-- doxytag: inherits="ucommon::ConditionalAccess" --> <p>The shared pointer is used to manage a singleton instance of shared object. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="a00202_source.html">thread.h</a>></code></p> <div class="dynheader"> Inheritance diagram for ucommon::SharedPointer:</div> <div class="dynsection"> <div class="center"><img src="a00504.png" border="0" usemap="#ucommon_1_1_shared_pointer_inherit__map" alt="Inheritance graph"/></div> <map name="ucommon_1_1_shared_pointer_inherit__map" id="ucommon_1_1_shared_pointer_inherit__map"> <area shape="rect" id="node7" href="a00124.html" title="Templated shared pointer for singleton shared objects of specific type." alt="" coords="5,229,307,256"/><area shape="rect" id="node2" href="a00037.html" title="The conditional rw seperates scheduling for optizming behavior or rw locks." alt="" coords="15,80,297,107"/><area shape="rect" id="node4" href="a00036.html" title="The conditional is a common base for other thread synchronizing classes." alt="" coords="45,5,267,32"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <div class="dynheader"> Collaboration diagram for ucommon::SharedPointer:</div> <div class="dynsection"> <div class="center"><img src="a00505.png" border="0" usemap="#ucommon_1_1_shared_pointer_coll__map" alt="Collaboration graph"/></div> <map name="ucommon_1_1_shared_pointer_coll__map" id="ucommon_1_1_shared_pointer_coll__map"> <area shape="rect" id="node2" href="a00037.html" title="The conditional rw seperates scheduling for optizming behavior or rw locks." alt="" coords="5,83,288,109"/><area shape="rect" id="node4" href="a00036.html" title="The conditional is a common base for other thread synchronizing classes." alt="" coords="36,5,257,32"/><area shape="rect" id="node6" href="a00126.html" title="Shared singleton object." alt="" coords="312,83,544,109"/></map> <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#add36578de6952dad473414629c683bab">replace</a> (<a class="el" href="a00126.html">SharedObject</a> *object)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Replace existing singleton instance with new one. <a href="#add36578de6952dad473414629c683bab"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00126.html">SharedObject</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#a9e1b5759c8774d9d18bd5408bc6ef33b">share</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Acquire a shared reference to the singleton object. <a href="#a9e1b5759c8774d9d18bd5408bc6ef33b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#aa2e0d24a4f50270deb95c60a43595513">SharedPointer</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Created shared locking for pointer. <a href="#aa2e0d24a4f50270deb95c60a43595513"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab2c3f84f49c3c0e2ebfa08bcf0f39e6d"></a><!-- doxytag: member="ucommon::SharedPointer::~SharedPointer" ref="ab2c3f84f49c3c0e2ebfa08bcf0f39e6d" args="()" --> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#ab2c3f84f49c3c0e2ebfa08bcf0f39e6d">~SharedPointer</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destroy lock and release any blocked threads. <br/></td></tr> <tr><td colspan="2"><h2>Friends</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afbd871e5d3ad2617ec3288e3e2eabda4"></a><!-- doxytag: member="ucommon::SharedPointer::shared_release" ref="afbd871e5d3ad2617ec3288e3e2eabda4" args="" --> class </td><td class="memItemRight" valign="bottom"><b>shared_release</b></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>The shared pointer is used to manage a singleton instance of shared object. </p> <p>This class is used to support the templated <a class="el" href="a00124.html" title="Templated shared pointer for singleton shared objects of specific type.">shared_pointer</a> class and the <a class="el" href="a00125.html" title="Auto-pointer support class for shared singleton objects.">shared_release</a> class, and is not meant to be used directly or as a base for anything else. One or more threads may aquire a shared lock to the singleton object through this pointer, and it can only be replaced with a new singleton instance when no threads reference it. The conditional lock is used to manage shared access for use and exclusive access when modified. </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="a00202_source.html#l01441">1441</a> of file <a class="el" href="a00202_source.html">thread.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="aa2e0d24a4f50270deb95c60a43595513"></a><!-- doxytag: member="ucommon::SharedPointer::SharedPointer" ref="aa2e0d24a4f50270deb95c60a43595513" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ucommon::SharedPointer::SharedPointer </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Created shared locking for pointer. </p> <p>Must be assigned by replace. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="add36578de6952dad473414629c683bab"></a><!-- doxytag: member="ucommon::SharedPointer::replace" ref="add36578de6952dad473414629c683bab" args="(SharedObject *object)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucommon::SharedPointer::replace </td> <td>(</td> <td class="paramtype"><a class="el" href="a00126.html">SharedObject</a> * </td> <td class="paramname"> <em>object</em></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Replace existing singleton instance with new one. </p> <p>This happens during exclusive locking, and the commit method of the object will be called. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>object</em> </td><td>being set. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a9e1b5759c8774d9d18bd5408bc6ef33b"></a><!-- doxytag: member="ucommon::SharedPointer::share" ref="a9e1b5759c8774d9d18bd5408bc6ef33b" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00126.html">SharedObject</a>* ucommon::SharedPointer::share </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Acquire a shared reference to the singleton object. </p> <p>This is a form of shared access lock. Derived classes and templates access "release" when the shared pointer is no longer needed. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>shared object. </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>ucommon/<a class="el" href="a00202_source.html">thread.h</a></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Jul 14 16:39:58 2011 for ucommon by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>