<html> <head> <title>class SimpleReferenceObject</title> <link rel="stylesheet" type="text/css" href="../../cpp.css"> </head> <body> <div id="adc-cppref"> <a name="_top_"> </a><table class="navimain" border="0" cellpadding="1" cellspacing="0"> <tr align="center" valign="top"> <td class="navimain"> <a href="../../index.html">Overview</a> </td> <td class="navimain"> <a href="index.html">Namespace</a> </td> <td class="navimainself"> Class </td> <td class="navimain"> <a href="../../index-files/index-1.html">Index</a> </td> <td class="navimain"> <a href="../../help.html">Help</a> </td> </tr> </table> <table class="navisub" cellpadding="0" cellspacing="3"> <tr> <td width="20%"><font size="-2">PUBLIC MEMBERS:</font></td> <td> <font size="-2">CLASSES</font> | <font size="-2">STRUCTS</font> | <font size="-2">UNIONS</font> | <font size="-2">ENUMS</font> | <font size="-2">TYPEDEFS</font> | <a href="#publ_ops"><font size="-2"><b>METHODS</b></font></a> | <a href="#publ_static_ops"><font size="-2"><b>STATIC METHODS</b></font></a> | <font size="-2">DATA</font> | <font size="-2">STATIC DATA</font></td> </tr> <tr> <td width="20%"><font size="-2">PROTECTED MEMBERS:</font></td> <td> <font size="-2">CLASSES</font> | <font size="-2">STRUCTS</font> | <font size="-2">UNIONS</font> | <font size="-2">ENUMS</font> | <font size="-2">TYPEDEFS</font> | <a href="#prot_ops"><font size="-2"><b>METHODS</b></font></a> | <font size="-2">STATIC METHODS</font> | <font size="-2">DATA</font> | <font size="-2">STATIC DATA</font></td> </tr> <tr> <td width="20%"><font size="-2">PRIVATE MEMBERS:</font></td> <td> <font size="-2">CLASSES</font> | <font size="-2">STRUCTS</font> | <font size="-2">UNIONS</font> | <font size="-2">ENUMS</font> | <font size="-2">TYPEDEFS</font> | <font size="-2">METHODS</font> | <font size="-2">STATIC METHODS</font> | <a href="#priv_vars"><font size="-2"><b>DATA</b></font></a> | <font size="-2">STATIC DATA</font></td> </tr> </table> <hr> <a href="../../names/index.html" alt="Global Namespace in C++"><font size="+1"><b>::</b></font></a> <a href="index.html" alt="namespace"><font size="+1"><b>salhelper</b></font></a><font size="+1"> :: </font><div class="title"><h2>class SimpleReferenceObject</h2> </div><hr> <dl> <dt>Base Classes</dt> <dd>None.</dd> </dl> <dl> <dt>Known Derived Classes</dt> <dd>None.</dd> </dl> <br> <table class="flag-table" border="1" cellspacing="0"> <tr> <td width="25%" class="flagname">virtual</td> <td width="25%" class="flagname">abstract</td> <td width="25%" class="flagname">interface</td> <td width="25%" class="flagname">template</td> </tr> <tr> <td class="flagyes">YES</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> </tr> </table> <dl> <dt>Summary</dt> <dd>A simple base implementation for reference-counted objects. </dd> <dt>Description</dt> <dd> Classes that want to implement a reference-counting mechanism based on the acquire()/release() interface should derive from this class. The reason to have class local operators new and delete here is technical. Imagine a class D derived from SimpleReferenceObject, but implemented in another shared library that happens to use different global operators new and delete from those used in this shared library (which, sadly, seems to be possible with shared libraries). Now, without the class local operators new and delete here, a code sequence like "new D" would use the global operator new as found in the other shared library, while the code sequence "delete this" in release() would use the global operator delete as found in this shared library---and these two operators would not be guaranteed to match. There are no overloaded operators new and delete for placement new here, because it is felt that the concept of placement new does not work well with the concept of reference-counted objects; so it seems best to simply leave those operators out. The same problem as with operators new and delete would also be there with operators new[] and delete[]. But since arrays of reference-counted objects are of no use, anyway, it seems best to simply declare and not define (private) operators new[] and delete[]. </dd> </dl> <dl> <dt>File</dt> <dd>simplereferenceobject.hxx</dd> </dl> <hr> <dl> <dt class="subtitle"><a name="publ_"><h3>Public Members</h3> </a></dt> <dd><a name="publ_ops"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%"> <tr class="subtitle"> <td colspan="2"><h4>Methods</h4> </td> </tr> <tr> <td> <br> <a href="SimpleReferenceObject/o.html#SimpleReferenceObject-4462">SimpleReferenceObject</a>( ) throw( );</td> <td width="50%"> </td> </tr> <tr> <td>void <br> <a href="SimpleReferenceObject/o.html#acquire-4463">acquire</a>( ) throw( );</td> <td width="50%"> </td> </tr> <tr> <td>void <br> <a href="SimpleReferenceObject/o.html#release-4464">release</a>( ) throw( );</td> <td width="50%"> </td> </tr> </table> <hr> <a name="publ_static_ops"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%"> <tr class="subtitle"> <td colspan="2"><h4>Static Methods</h4> </td> </tr> <tr> <td>static void * <br> <a href="SimpleReferenceObject/o.html#operator new-4465">operator new</a>( std::size_t nSize ) throw( std::bad_alloc );</td> <td width="50%"> see general class documentation </td> </tr> <tr> <td>static void * <br> <a href="SimpleReferenceObject/o.html#operator new-4466">operator new</a>( std::size_t nSize, const std::nothrow_t & rNothrow ) throw( );</td> <td width="50%"> see general class documentation </td> </tr> <tr> <td>static void <br> <a href="SimpleReferenceObject/o.html#operator delete-4467">operator delete</a>( void * pPtr ) throw( );</td> <td width="50%"> see general class documentation </td> </tr> <tr> <td>static void <br> <a href="SimpleReferenceObject/o.html#operator delete-4468">operator delete</a>( void * pPtr, const std::nothrow_t & rNothrow ) throw( );</td> <td width="50%"> see general class documentation </td> </tr> </table> <hr> </dd> </dl> <dl> <dt class="subtitle"><a name="prot_"><h3>Protected Members</h3> </a></dt> <dd><a name="prot_ops"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%"> <tr class="subtitle"> <td colspan="2"><h4>Methods</h4> </td> </tr> <tr> <td>virtual <br> <a href="SimpleReferenceObject/o.html#~SimpleReferenceObject-4469">~SimpleReferenceObject</a>( ) throw( );</td> <td width="50%"> </td> </tr> </table> <hr> </dd> </dl> <dl> <dt class="subtitle"><a name="priv_"><h3>Private Members</h3> </a></dt> <dd><a name="priv_vars"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%"> <tr class="subtitle"> <td colspan="2"><h4>Data</h4> </td> </tr> <tr bgcolor="white"> <td><a href="../t-oslInterlockedCount.html">oslInterlockedCount</a> <a href="SimpleReferenceObject/d.html#m_nCount"><strong>m_nCount;</strong></a></td> <td/></tr> </table> <hr> </dd> </dl> <a href="#_top_" class="objchapter">Top of Page</a><hr size="3"><p class="copyright" align="center">Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.</p> </div> <!-- id="adc-cppref" --> </body> </html>