⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classpsafecoll.html

📁 pwlib开发文档
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title> TemplatePSafeColl&lt; Coll, Base &gt; class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>PSafeColl&lt; Coll, Base &gt; Class Template Reference</h1><code>#include &lt;<a class="el" href="safecoll_8h-source.html">safecoll.h</a>&gt;</code><p><p>Inheritance diagram for PSafeColl&lt; Coll, Base &gt;:<p><center><img src="classPSafeColl.png" usemap="#PSafeColl< Coll, Base >_map" border="0" alt=""></center><map name="PSafeColl< Coll, Base >_map"><area href="classPSafeCollection.html" alt="PSafeCollection" shape="rect" coords="0,56,151,80"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,151,24"></map><a href="classPSafeColl-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Construction</div></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z337_0">PSafeColl</a> ()</td></tr><tr><td colspan="2"><div class="groupHeader">Operations</div></td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt; Base &gt;&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z339_0">Append</a> (Base *obj, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode=PSafeReference)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z339_1">Remove</a> (Base *obj)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z339_2">RemoveAt</a> (PINDEX idx)</td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt; Base &gt;&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z339_3">GetAt</a> (PINDEX idx, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode=PSafeReadWrite)</td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt; Base &gt;&nbsp;</td><td valign=bottom><a class="el" href="classPSafeColl.html#z339_4">FindWithLock</a> (const Base &amp;value, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode=PSafeReadWrite)</td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2><h3>template&lt;class Coll, class Base&gt;<br> class PSafeColl&lt; Coll, Base &gt;</h3>This class defines a thread-safe collection of objects.<p>This is part of a set of classes to solve the general problem of a collection (eg a PList or PDictionary) of objects that needs to be a made thread safe. Any thread can add, read, write or remove an object with both the object and the database of objects itself kept thread safe.<p>See the <a class="el" href="classPSafeObject.html">PSafeObject</a> class for more details. Especially in regard to enumeration of collections. <p><hr><h2>Constructor &amp; Destructor Documentation</h2><a name="z337_0" doxytag="PSafeColl::PSafeColl"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> PSafeColl&lt; Coll, Base &gt;::PSafeColl </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a safe list collection wrapper around the real collection.     </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="z339_0" doxytag="PSafeColl::Append"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt;Base&gt; PSafeColl&lt; Coll, Base &gt;::Append </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">Base *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>obj</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="safecoll_8h.html#a4">PSafetyMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = PSafeReference</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Add an object to the collection. This uses the <a class="el" href="classPCollection.html#z75_0">PCollection::Append()</a> function to add the object to the collection, with full mutual exclusion locking on the collection. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>mode</em>&nbsp;</td><td>Object to add to safe collection. </td></tr></table></dl>    </td>  </tr></table><a name="z339_4" doxytag="PSafeColl::FindWithLock"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt;Base&gt; PSafeColl&lt; Coll, Base &gt;::FindWithLock </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const Base &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>value</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="safecoll_8h.html#a4">PSafetyMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = PSafeReadWrite</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Find the instance in the collection of an object with the same value. The returned safe pointer will increment the reference count on the <a class="el" href="classPSafeObject.html">PSafeObject</a> and lock to the object in the mode specified. The lock will remain until the <a class="el" href="classPSafePtr.html">PSafePtr</a> goes out of scope.     </td>  </tr></table><a name="z339_3" doxytag="PSafeColl::GetAt"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual <a class="el" href="classPSafePtr.html">PSafePtr</a>&lt;Base&gt; PSafeColl&lt; Coll, Base &gt;::GetAt </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>idx</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="safecoll_8h.html#a4">PSafetyMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = PSafeReadWrite</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the instance in the collection of the index. The returned safe pointer will increment the reference count on the <a class="el" href="classPSafeObject.html">PSafeObject</a> and lock to the object in the mode specified. The lock will remain until the <a class="el" href="classPSafePtr.html">PSafePtr</a> goes out of scope.     </td>  </tr></table><a name="z339_1" doxytag="PSafeColl::Remove"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual BOOL PSafeColl&lt; Coll, Base &gt;::Remove </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">Base *&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>obj</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Remove an object to the collection. This function removes the object from the collection itself, but does not actually delete the object. It simply moves the object to a list of objects to be garbage collected at a later time.<p>As for <a class="el" href="classPSafeColl.html#z339_0">Append()</a> full mutual exclusion locking on the collection itself is maintained. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>obj</em>&nbsp;</td><td>Object to remove from safe collection </td></tr></table></dl>    </td>  </tr></table><a name="z339_2" doxytag="PSafeColl::RemoveAt"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" colspan="4">template&lt;class Coll, class Base&gt; </td>        </tr>        <tr>          <td class="md" nowrap valign="top"> virtual BOOL PSafeColl&lt; Coll, Base &gt;::RemoveAt </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">PINDEX&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>idx</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Remove an object to the collection. This function removes the object from the collection itself, but does not actually delete the object. It simply moves the object to a list of objects to be garbage collected at a later time.<p>As for <a class="el" href="classPSafeColl.html#z339_0">Append()</a> full mutual exclusion locking on the collection itself is maintained. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>idx</em>&nbsp;</td><td>Index to remove </td></tr></table></dl>    </td>  </tr></table><hr>The documentation for this class was generated from the following file:<ul><li><a class="el" href="safecoll_8h-source.html">safecoll.h</a></ul><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:18 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -