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

📄 classpsafeptrbase.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>PSafePtrBase 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>PSafePtrBase Class Reference</h1><code>#include &lt;<a class="el" href="safecoll_8h-source.html">safecoll.h</a>&gt;</code><p><p>Inheritance diagram for PSafePtrBase:<p><center><img src="classPSafePtrBase.png" usemap="#PSafePtrBase_map" border="0" alt=""></center><map name="PSafePtrBase_map"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,93,24"><area href="classPSafePtr.html" alt="PSafePtr< T >" shape="rect" coords="0,112,93,136"></map><a href="classPSafePtrBase-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Construction</h2></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z327_0">~PSafePtrBase</a> ()</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z327_1">PSafePtrBase</a> (<a class="el" href="classPSafeObject.html">PSafeObject</a> *obj=NULL, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode=PSafeReference)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z327_2">PSafePtrBase</a> (const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> &amp;safeCollection, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode, PINDEX idx)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z327_3">PSafePtrBase</a> (const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> &amp;safeCollection, <a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode, <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="classPSafePtrBase.html#z327_4">PSafePtrBase</a> (const PSafePtrBase &amp;enumerator)</td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PObject</div></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPObject.html#z199_0">Comparison</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z329_0">Compare</a> (const <a class="el" href="classPObject.html">PObject</a> &amp;obj) const</td></tr><tr><td colspan="2"><div class="groupHeader">Operations</div></td></tr><tr><td nowrap align=right valign=top><a class="el" href="safecoll_8h.html#a4">PSafetyMode</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z331_0">GetSafetyMode</a> () const</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#z331_1">SetSafetyMode</a> (<a class="el" href="safecoll_8h.html#a4">PSafetyMode</a> mode)</td></tr><tr><td colspan=2><br><h2>Protected Types</h2></td></tr><tr><td nowrap align=right valign=top>enum &nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#t4">EnterSafetyModeOption</a> { <a class="el" href="classPSafePtrBase.html#t4t0">WithReference</a>, <a class="el" href="classPSafePtrBase.html#t4t1">AlreadyReferenced</a> }</td></tr><tr><td nowrap align=right valign=top>enum &nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#t5">ExitSafetyModeOption</a> { <a class="el" href="classPSafePtrBase.html#t5t2">WithDereference</a>, <a class="el" href="classPSafePtrBase.html#t5t3">NoDereference</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="classPSafePtrBase.html#b0">Assign</a> (const PSafePtrBase &amp;ptr)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b1">Assign</a> (const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> &amp;safeCollection)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b2">Assign</a> (<a class="el" href="classPSafeObject.html">PSafeObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b3">Assign</a> (PINDEX idx)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b4">Next</a> ()</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b5">Previous</a> ()</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b6">EnterSafetyMode</a> (<a class="el" href="classPSafePtrBase.html#t4">EnterSafetyModeOption</a> ref)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#b7">ExitSafetyMode</a> (<a class="el" href="classPSafePtrBase.html#t5">ExitSafetyModeOption</a> ref)</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top>const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> *&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#n0">collection</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPSafeObject.html">PSafeObject</a> *&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#n1">currentObject</a></td></tr><tr><td nowrap align=right valign=top><a class="el" href="safecoll_8h.html#a4">PSafetyMode</a>&nbsp;</td><td valign=bottom><a class="el" href="classPSafePtrBase.html#n2">lockMode</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class defines a base class for thread-safe pointer to an object.<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>NOTE: the <a class="el" href="classPSafePtr.html">PSafePtr</a> will allow safe and mutexed access to objects but is not thread safe itself! You should not share <a class="el" href="classPSafePtr.html">PSafePtr</a> instances across threads. You can assign a <a class="el" href="classPSafePtr.html">PSafePtr</a> to another instance across a thread boundary provided it is on a reference and no read only or read/write locks are present.<p>See the <a class="el" href="classPSafeObject.html">PSafeObject</a> class for more details. <p><hr><h2>Member Enumeration Documentation</h2><a name="t4" doxytag="PSafePtrBase::EnterSafetyModeOption"></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"> enum PSafePtrBase::EnterSafetyModeOption<code> [protected]</code>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="t4t0" doxytag="WithReference"></a><em>WithReference</em></em>&nbsp;</td><td></td></tr><tr><td valign=top><em><a name="t4t1" doxytag="AlreadyReferenced"></a><em>AlreadyReferenced</em></em>&nbsp;</td><td></td></tr></table></dl>    </td>  </tr></table><a name="t5" doxytag="PSafePtrBase::ExitSafetyModeOption"></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"> enum PSafePtrBase::ExitSafetyModeOption<code> [protected]</code>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="t5t2" doxytag="WithDereference"></a><em>WithDereference</em></em>&nbsp;</td><td></td></tr><tr><td valign=top><em><a name="t5t3" doxytag="NoDereference"></a><em>NoDereference</em></em>&nbsp;</td><td></td></tr></table></dl>    </td>  </tr></table><hr><h2>Constructor &amp; Destructor Documentation</h2><a name="z327_1" doxytag="PSafePtrBase::PSafePtrBase"></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"> PSafePtrBase::PSafePtrBase </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classPSafeObject.html">PSafeObject</a> *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>obj</em> = NULL, </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> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pointer to a <a class="el" href="classPSafeObject.html">PSafeObject</a>. An optional locking mode may be provided to lock the object for reading or writing and automatically unlock it on destruction.<p>Note that this version is not associated with a collection so the ++ and -- operators will not work. <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>Physical object to point to. Locking mode for the object </td></tr></table></dl>    </td>  </tr></table><a name="z327_2" doxytag="PSafePtrBase::PSafePtrBase"></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"> PSafePtrBase::PSafePtrBase </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>safeCollection</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>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>PINDEX&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>idx</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pointer to a <a class="el" href="classPSafeObject.html">PSafeObject</a>. An optional locking mode may be provided to lock the object for reading or writing and automatically unlock it on destruction.<p>The idx'th entry of the collection is pointed to by this object. If the idx is beyond the size of the collection, the pointer is NULL. <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>Collection pointer will enumerate </td></tr><tr><td valign=top><em>idx</em>&nbsp;</td><td>Locking mode for the object Index into collection to point to </td></tr></table></dl>    </td>  </tr></table><a name="z327_3" doxytag="PSafePtrBase::PSafePtrBase"></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"> PSafePtrBase::PSafePtrBase </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPSafeCollection.html">PSafeCollection</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>safeCollection</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>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classPSafeObject.html">PSafeObject</a> *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>obj</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pointer to a <a class="el" href="classPSafeObject.html">PSafeObject</a>. An optional locking mode may be provided to lock the object for reading or writing and automatically unlock it on destruction.<p>The obj parameter is only set if it contained in the collection, otherwise the pointer is NULL. <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>Collection pointer will enumerate </td></tr><tr><td valign=top><em>obj</em>&nbsp;</td><td>Locking mode for the object Inital object in collection to point to </td></tr></table></dl>    </td>  </tr></table><a name="z327_4" doxytag="PSafePtrBase::PSafePtrBase"></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"> PSafePtrBase::PSafePtrBase </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const PSafePtrBase &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>enumerator</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Copy the pointer to the <a class="el" href="classPSafeObject.html">PSafeObject</a>. This will create a copy of the pointer with the same locking mode and lock on the <a class="el" href="classPSafeObject.html">PSafeObject</a>. It will also increment the reference count on the <a class="el" href="classPSafeObject.html">PSafeObject</a> as well. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>enumerator</em>&nbsp;</td><td>Pointer to copy </td></tr></table></dl>    </td>  </tr></table><a name="z327_0" doxytag="PSafePtrBase::~PSafePtrBase"></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"> PSafePtrBase::~PSafePtrBase </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>Unlock and dereference the <a class="el" href="classPSafeObject.html">PSafeObject</a> this is pointing to.     </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="b3" doxytag="PSafePtrBase::Assign"></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 PSafePtrBase::Assign </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> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><a name="b2" doxytag="PSafePtrBase::Assign"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">

⌨️ 快捷键说明

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