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

📄 classpsafecollection.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>PSafeCollection 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>PSafeCollection Class Reference</h1><code>#include &lt;<a class="el" href="safecoll_8h-source.html">safecoll.h</a>&gt;</code><p><p>Inheritance diagram for PSafeCollection:<p><center><img src="classPSafeCollection.png" usemap="#PSafeCollection_map" border="0" alt=""></center><map name="PSafeCollection_map"><area href="classPObject.html" alt="PObject" shape="rect" coords="957,0,1330,24"><area href="classPSafeColl.html" alt="PSafeColl< Coll, Base >" shape="rect" coords="0,112,373,136"><area href="classPSafeColl.html" alt="PSafeColl< PArray< Base >, Base >" shape="rect" coords="383,112,756,136"><area href="classPSafeColl.html" alt="PSafeColl< PList< Base >, Base >" shape="rect" coords="766,112,1139,136"><area href="classPSafeColl.html" alt="PSafeColl< PSortedList< Base >, Base >" shape="rect" coords="1149,112,1522,136"><area href="classPSafeDictionaryBase.html" alt="PSafeDictionaryBase< Coll, Key, Base >" shape="rect" coords="1532,112,1905,136"><area href="classPSafeDictionaryBase.html" alt="PSafeDictionaryBase< PDictionary< Key, Base >, Key, Base >" shape="rect" coords="1915,112,2288,136"><area href="classPSafeArray.html" alt="PSafeArray< Base >" shape="rect" coords="383,168,756,192"><area href="classPSafeList.html" alt="PSafeList< Base >" shape="rect" coords="766,168,1139,192"><area href="classPSafeSortedList.html" alt="PSafeSortedList< Base >" shape="rect" coords="1149,168,1522,192"><area href="classPSafeDictionary.html" alt="PSafeDictionary< Key, Base >" shape="rect" coords="1915,168,2288,192"></map><a href="classPSafeCollection-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Operations</h2></td></tr><tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_0">RemoveAll</a> ()</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_1">AllowDeleteObjects</a> (BOOL yes=TRUE)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_2">DisallowDeleteObjects</a> ()</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_3">DeleteObjectsToBeRemoved</a> ()</td></tr><tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_4">DeleteObject</a> (<a class="el" href="classPObject.html">PObject</a> *object) const</td></tr><tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_5">SetAutoDeleteObjects</a> ()</td></tr><tr><td nowrap align=right valign=top>PINDEX&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_6">GetSize</a> () const</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_7">IsEmpty</a> () const</td></tr><tr><td nowrap align=right valign=top>const <a class="el" href="classPMutex.html">PMutex</a> &amp;&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_8">GetMutex</a> () const</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_9">SafeRemove</a> (<a class="el" href="classPSafeObject.html">PSafeObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z325_10">SafeRemoveAt</a> (PINDEX idx)</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="classPSafeCollection.html#z323_0">PSafeCollection</a> (<a class="el" href="classPCollection.html">PCollection</a> *<a class="el" href="classPSafeCollection.html#n0">collection</a>)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#z323_1">~PSafeCollection</a> ()</td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#b0">SafeRemoveObject</a> (<a class="el" href="classPSafeObject.html">PSafeObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#b1">PDECLARE_NOTIFIER</a> (<a class="el" href="classPTimer.html">PTimer</a>, PSafeCollection, DeleteObjectsTimeout)</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPCollection.html">PCollection</a> *&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n0">collection</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPMutex.html">PMutex</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n1">collectionMutex</a></td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n2">deleteObjects</a></td></tr><tr><td nowrap align=right valign=top>PList&lt; <a class="el" href="classPSafeObject.html">PSafeObject</a> &gt;&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n3">toBeRemoved</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPMutex.html">PMutex</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n4">removalMutex</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPTimer.html">PTimer</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#n5">deleteObjectsTimer</a></td></tr><tr><td colspan=2><br><h2>Friends</h2></td></tr><tr><td nowrap align=right valign=top>class&nbsp;</td><td valign=bottom><a class="el" href="classPSafeCollection.html#l0">PSafePtrBase</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class defines a thread-safe collection of objects. This class is a wrapper around a standard <a class="el" href="classPCollection.html">PCollection</a> class which allows only safe, mutexed, access to the collection.<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="z323_0" doxytag="PSafeCollection::PSafeCollection"></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" nowrap valign="top"> PSafeCollection::PSafeCollection </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classPCollection.html">PCollection</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>collection</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a thread safe collection of objects. Note the collection is automatically deleted on destruction. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>collection</em>&nbsp;</td><td>Actual collection of objects </td></tr></table></dl>    </td>  </tr></table><a name="z323_1" doxytag="PSafeCollection::~PSafeCollection"></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" nowrap valign="top"> PSafeCollection::~PSafeCollection </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></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Destroy the thread safe collection. The will delete the collection object provided in the constructor.     </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="z325_1" doxytag="PSafeCollection::AllowDeleteObjects"></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" nowrap valign="top"> void PSafeCollection::AllowDeleteObjects </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">BOOL&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>yes</em> = TRUE          </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>Disallow the automatic delete any objects that have been removed. Objects are simply removed from the collection and not marked for deletion using <a class="el" href="classPSafeObject.html#z321_6">PSafeObject::SafeRemove()</a> and <a class="el" href="classPSafeCollection.html#z325_4">DeleteObject()</a>. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>yes</em>&nbsp;</td><td>New value for flag for deleting objects </td></tr></table></dl>    </td>  </tr></table><a name="z325_4" doxytag="PSafeCollection::DeleteObject"></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" nowrap valign="top"> virtual void PSafeCollection::DeleteObject </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classPObject.html">PObject</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>object</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const<code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Delete an objects that has been removed.     </td>  </tr></table><a name="z325_3" doxytag="PSafeCollection::DeleteObjectsToBeRemoved"></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" nowrap valign="top"> virtual BOOL PSafeCollection::DeleteObjectsToBeRemoved </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> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Delete any objects that have been removed. Returns TRUE if all objects in the collection have been removed and their pending deletions carried out.     </td>  </tr></table><a name="z325_2" doxytag="PSafeCollection::DisallowDeleteObjects"></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" nowrap valign="top"> void PSafeCollection::DisallowDeleteObjects </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>Disallow the automatic delete any objects that have been removed. Objects are simply removed from the collection and not marked for deletion using <a class="el" href="classPSafeObject.html#z321_6">PSafeObject::SafeRemove()</a> and <a class="el" href="classPSafeCollection.html#z325_4">DeleteObject()</a>.     </td>  </tr></table><a name="z325_8" doxytag="PSafeCollection::GetMutex"></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" nowrap valign="top"> const <a class="el" href="classPMutex.html">PMutex</a>&amp; PSafeCollection::GetMutex </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> const<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the mutex for the collection.     </td>  </tr></table><a name="z325_6" doxytag="PSafeCollection::GetSize"></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" nowrap valign="top"> PINDEX PSafeCollection::GetSize </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></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get the current size of the collection. Note that usefulness of this function is limited as it is merely an instantaneous snapshot of the state of the collection.     </td>  </tr></table><a name="z325_7" doxytag="PSafeCollection::IsEmpty"></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" nowrap valign="top"> BOOL PSafeCollection::IsEmpty </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> const<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Determine if the collection is empty. Note that usefulness of this function is limited as it is merely an instantaneous snapshot of the state of the collection.     </td>  </tr></table><a name="b1" doxytag="PSafeCollection::PDECLARE_NOTIFIER"></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" nowrap valign="top"> PSafeCollection::PDECLARE_NOTIFIER </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classPTimer.html">PTimer</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp;, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>PSafeCollection&nbsp;</td>          <td class="mdname" nowrap>&nbsp;, </td>        </tr>        <tr>

⌨️ 快捷键说明

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