<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>sc::RefCount class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:17:33 2002 --> <center> <a class="qindex" href="index.html">Main Page</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="pages.html">Related Pages</a> </center> <hr><h1>sc::RefCount Class Reference</h1>The base class for all reference counted objects. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="ref_h-source.html">ref.h</a>></code> <p> Inheritance diagram for sc::RefCount<p><center><img src="class_sc__RefCount_inherit_graph.gif" border="0" usemap="#sc::RefCount_inherit_map" alt="Inheritance graph"></center> <map name="sc::RefCount_inherit_map"> <area href="class_sc__CorrelationTable.html" shape="rect" coords="297,3,419,22"> <area href="class_sc__DescribedClass.html" shape="rect" coords="301,46,415,64"> <area href="class_sc__Int1eV3.html" shape="rect" coords="321,259,395,278"> <area href="class_sc__Int2eV3.html" shape="rect" coords="321,302,395,320"> <area href="class_sc__KeyVal.html" shape="rect" coords="322,344,394,363"> <area href="class_sc__NonlinearTransform.html" shape="rect" coords="287,430,429,448"> <area href="class_sc__OneBodyDerivInt.html" shape="rect" coords="294,472,422,491"> <area href="class_sc__OneBodyInt.html" shape="rect" coords="310,515,406,534"> <area href="class_sc__PsiFile11.html" shape="rect" coords="317,728,399,747"> <area href="class_sc__PsiInput.html" shape="rect" coords="321,771,395,790"> <area href="class_sc__SCMatrixSubblockIter.html" shape="rect" coords="282,814,434,832"> <area href="class_sc__SOBasis.html" shape="rect" coords="319,899,397,918"> <area href="class_sc__ThreadLock.html" shape="rect" coords="310,942,406,960"> <area href="class_sc__TwoBodyDerivInt.html" shape="rect" coords="293,1070,423,1088"> <area href="class_sc__TwoBodyInt.html" shape="rect" coords="309,1112,407,1131"> <area href="class_sc__Identity.html" shape="rect" coords="26,622,98,640"> </map> <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for sc::RefCount:<p><center><img src="class_sc__RefCount_coll_graph.gif" border="0" usemap="#sc::RefCount_coll_map" alt="Collaboration graph"></center> <map name="sc::RefCount_coll_map"> <area href="class_sc__Identity.html" shape="rect" coords="19,14,91,33"> </map> <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="class_sc__RefCount-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Public Methods</h2></td></tr> <tr><td nowrap align=right valign=top><a name="a0" doxytag="sc::RefCount::~RefCount"></a> virtual </td><td valign=bottom><b>~RefCount</b> ()</td></tr> <tr><td nowrap align=right valign=top><a name="a1" doxytag="sc::RefCount::lock_ptr"></a> int </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a1">lock_ptr</a> () const</td></tr> <tr><td> </td><td><font size=-1><em>Lock this object.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a2" doxytag="sc::RefCount::unlock_ptr"></a> int </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a2">unlock_ptr</a> () const</td></tr> <tr><td> </td><td><font size=-1><em>Unlock this object.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a3" doxytag="sc::RefCount::use_locks"></a> void </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a3">use_locks</a> (bool inVal)</td></tr> <tr><td> </td><td><font size=-1><em>start and stop using locks on this object.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a4" doxytag="sc::RefCount::nreference"></a> refcount_t </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a4">nreference</a> () const</td></tr> <tr><td> </td><td><font size=-1><em>Return the reference count.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a5" doxytag="sc::RefCount::reference"></a> refcount_t </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a5">reference</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Increment the reference count and return the new count.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a6" doxytag="sc::RefCount::dereference"></a> refcount_t </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a6">dereference</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Decrement the reference count and return the new count.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a7" doxytag="sc::RefCount::managed"></a> int </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a7">managed</a> () const</td></tr> <tr><td> </td><td><font size=-1><em>Return 1 if the object is managed. Otherwise return 0.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a8">unmanage</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Turn off the reference counting mechanism for this object.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a name="a9" doxytag="sc::RefCount::managed"></a> int </td><td valign=bottom><a class="el" href="class_sc__RefCount.html#a9">managed</a> () const</td></tr> <tr><td> </td><td><font size=-1><em>Return 1 if the object is managed. Otherwise return 0.</em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Protected Methods</h2></td></tr> <tr><td nowrap align=right valign=top><a name="b0" doxytag="sc::RefCount::RefCount"></a> </td><td valign=bottom><b>RefCount</b> ()</td></tr> <tr><td nowrap align=right valign=top><a name="b1" doxytag="sc::RefCount::RefCount"></a> </td><td valign=bottom><b>RefCount</b> (const RefCount &)</td></tr> <tr><td nowrap align=right valign=top><a name="b2" doxytag="sc::RefCount::operator="></a> RefCount& </td><td valign=bottom><b>operator=</b> (const RefCount &)</td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> The base class for all reference counted objects. <p> If multiple inheritance is used, <a class="el" href="class_sc__RefCount.html">RefCount</a> must be virtually inherited from, otherwise references to invalid memory will likely result. <p> Reference counting information is usually maintained by smart pointer classes <a class="el" href="class_sc__Ref.html">Ref</a>, however this mechanism can be supplemented or replaced by directly using the public interface to <a class="el" href="class_sc__RefCount.html">RefCount</a>. <p> The <a class="el" href="class_sc__RefCount.html#a8">unmanage</a>() member is only needed for special cases where memory management must be turned off. For example, if a reference counted object is created on the stack, memory management mechanisms based on reference counting must be prohibited from deleting it. The <a class="el" href="class_sc__RefCount.html#a8">unmanage</a>() member accomplishes this, but a better solution would be to allocate the object on the heap with new and let a smart pointer manage the memory for the object. <p> When using a debugger to look at reference counted objects the count is maintained in the _reference_count_ member. However, this member is encoded so that memory overwrites can be sometimes detected. Thus, interpretation of _reference_count_ is not always straightforward. <p> <hr><h2>Member Function Documentation</h2> <a name="a8" doxytag="sc::RefCount::unmanage"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void sc::RefCount::unmanage ( </b></td> <td valign="bottom"><b> )<code> [inline]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Turn off the reference counting mechanism for this object. <p> The value returned by <a class="el" href="class_sc__RefCount.html#a4">nreference</a>() will always be 1 after this is called. The ability to <a class="el" href="class_sc__RefCount.html#a8">unmanage</a>() objects must be turned on at compile time by defining REF_MANAGE. There is a slight performance penalty. </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="ref_h-source.html">ref.h</a></ul> <hr> <address> <small> Generated at Mon Oct 14 14:17:34 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>