📄 classpsmartpointer.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>PSmartPointer 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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>PSmartPointer Class Reference</h1><code>#include <<a class="el" href="smartptr_8h-source.html">smartptr.h</a>></code><p><p>Inheritance diagram for PSmartPointer:<p><center><img src="classPSmartPointer.png" usemap="#PSmartPointer_map" border="0" alt=""></center><map name="PSmartPointer_map"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,92,24"><area href="classPNotifier.html" alt="PNotifier" shape="rect" coords="0,112,92,136"></map><a href="classPSmartPointer-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> </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z363_0">PSmartPointer</a> (<a class="el" href="classPSmartObject.html">PSmartObject</a> *obj=NULL)</td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z363_1">PSmartPointer</a> (const PSmartPointer &ptr)</td></tr><tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z363_2">~PSmartPointer</a> ()</td></tr><tr><td nowrap align=right valign=top>PSmartPointer & </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z363_3">operator=</a> (const PSmartPointer &ptr)</td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PObject</div></td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPObject.html#z199_0">Comparison</a> </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z365_0">Compare</a> (const <a class="el" href="classPObject.html">PObject</a> &obj) const</td></tr><tr><td colspan="2"><div class="groupHeader">Pointer access functions</div></td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z367_0">IsNULL</a> () const</td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPSmartObject.html">PSmartObject</a> * </td><td valign=bottom><a class="el" href="classPSmartPointer.html#z367_1">GetObject</a> () const</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPSmartObject.html">PSmartObject</a> * </td><td valign=bottom><a class="el" href="classPSmartPointer.html#n0">object</a></td></tr><tr><td> </td><td><font size=-1><em>Object the smart pointer points to.</em> <a href="#n0"></a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This is the class for pointers to objects that use the {\it smart pointer} system. In conjunction with the PSmartObject# class, this class references objects that can have the automatic deletion of the object instance when there are no more smart pointer instances pointing to it.<p>A PSmartPointer carries the pointer to a PSmartObject# instance which contains a reference count. Assigning or copying instances of smart pointers will automatically increment and decrement the reference count. When the last instance that references a PSmartObject# instance is destroyed or overwritten, the PSmartObject# is deleted.<p>A NULL value is possible for a smart pointer. It can be detected via the <a class="el" href="classPSmartPointer.html#z367_0">IsNULL()</a># function. <p><hr><h2>Constructor & Destructor Documentation</h2><a name="z363_0" doxytag="PSmartPointer::PSmartPointer"></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"> PSmartPointer::PSmartPointer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPSmartObject.html">PSmartObject</a> * </td> <td class="mdname1" valign="top" nowrap> <em>obj</em> = NULL </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a new smart pointer instance and have it point to the specified PSmartObject# instance. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>obj</em> </td><td>Smart object to point to. </td></tr></table></dl> </td> </tr></table><a name="z363_1" doxytag="PSmartPointer::PSmartPointer"></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"> PSmartPointer::PSmartPointer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PSmartPointer & </td> <td class="mdname1" valign="top" nowrap> <em>ptr</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a new smart pointer and point it at the data pointed to by the ptr# parameter. The reference count for the object being pointed at is incremented. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ptr</em> </td><td>Smart pointer to make a copy of. </td></tr></table></dl> </td> </tr></table><a name="z363_2" doxytag="PSmartPointer::~PSmartPointer"></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 PSmartPointer::~PSmartPointer </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Destroy the smart pointer and decrement the reference count on the object being pointed to. If there are no more references then the object is deleted. </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="z365_0" doxytag="PSmartPointer::Compare"></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 <a class="el" href="classPObject.html#z199_0">Comparison</a> PSmartPointer::Compare </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classPObject.html">PObject</a> & </td> <td class="mdname1" valign="top" nowrap> <em>obj</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Determine the relative rank of the pointers. This is identical to determining the relative rank of the integer values represented by the memory pointers.<p><dl compact><dt><b>Returns: </b></dt><dd> <a class="el" href="classPObject.html#z199_0s1">EqualTo</a># if objects point to the same object instance, otherwise <a class="el" href="classPObject.html#z199_0s0">LessThan</a># and <a class="el" href="classPObject.html#z199_0s2">GreaterThan</a># may be returned depending on the relative values of the memory pointers. </dl><p>Reimplemented from <a class="el" href="classPObject.html#z199_1">PObject</a>. </td> </tr></table><a name="z367_1" doxytag="PSmartPointer::GetObject"></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"> <a class="el" href="classPSmartObject.html">PSmartObject</a>* PSmartPointer::GetObject </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get the current value if the internal smart object pointer.<p><dl compact><dt><b>Returns: </b></dt><dd> pointer to object instance. </dl> </td> </tr></table><a name="z367_0" doxytag="PSmartPointer::IsNULL"></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 PSmartPointer::IsNULL </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Determine if the smart pointer has been set to point to an actual object instance.<p><dl compact><dt><b>Returns: </b></dt><dd> TRUE if the pointer is NULL. </dl> </td> </tr></table><a name="z363_3" doxytag="PSmartPointer::operator="></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"> PSmartPointer& PSmartPointer::operator= </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PSmartPointer & </td> <td class="mdname1" valign="top" nowrap> <em>ptr</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Assign this pointer to the value specified in the ptr# parameter.<p>The previous object being pointed to has its reference count decremented as this will no longer point to it. If there are no more references then the object is deleted.<p>The new object being pointed to after the assignment has its reference count incremented. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ptr</em> </td><td>Smart pointer to assign. </td></tr></table></dl> </td> </tr></table><hr><h2>Member Data Documentation</h2><a name="n0" doxytag="PSmartPointer::object"></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"> <a class="el" href="classPSmartObject.html">PSmartObject</a>* PSmartPointer::object<code> [protected]</code> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Object the smart pointer points to.<p> </td> </tr></table><hr>The documentation for this class was generated from the following file:<ul><li><a class="el" href="smartptr_8h-source.html">smartptr.h</a></ul><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:19 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 + -