Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > bfea28f33e7373c31a33dc7387b2a0be > files > 6

loki-lib-doc-0.1.7-2.fc12.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loki: Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="a00192.html">Loki</a>::<a class="el" href="a00002.html">AllocatorSingleton</a>
  </div>
</div>
<div class="contents">
<h1>Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt; Class Template Reference<br>
<small>
[<a class="el" href="a00217.html">Internals</a>]</small>
</h1><!-- doxytag: class="Loki::AllocatorSingleton" --><!-- doxytag: inherits="Loki::SmallObjAllocator" --><code>#include &lt;SmallObj.h&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>
<div class="dynheader">
Collaboration diagram for Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="a00397.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="47fa2a9f8348fc8ce749221f7bfa7245"></a><!-- doxytag: member="Loki::AllocatorSingleton::MyAllocator" ref="47fa2a9f8348fc8ce749221f7bfa7245" args="" -->
typedef <a class="el" href="a00002.html">AllocatorSingleton</a><br class="typebreak">
&lt; ThreadingModel, chunkSize, <br class="typebreak">
maxSmallObjectSize, <br class="typebreak">
objectAlignSize, <br class="typebreak">
LifetimePolicy &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#47fa2a9f8348fc8ce749221f7bfa7245">MyAllocator</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Defines type of allocator. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c9fde708e2ee0bf990c3eaa34422ca25"></a><!-- doxytag: member="Loki::AllocatorSingleton::MyThreadingModel" ref="c9fde708e2ee0bf990c3eaa34422ca25" args="" -->
typedef ThreadingModel<br class="typebreak">
&lt; <a class="el" href="a00002.html">MyAllocator</a>, MutexPolicy &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#c9fde708e2ee0bf990c3eaa34422ca25">MyThreadingModel</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Defines type for thread-safety locking mechanism. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="74b23f8327ce4f3d795aa20240deb99e"></a><!-- doxytag: member="Loki::AllocatorSingleton::MyAllocatorSingleton" ref="74b23f8327ce4f3d795aa20240deb99e" args="" -->
typedef <a class="el" href="a00124.html">Loki::SingletonHolder</a><br class="typebreak">
&lt; <a class="el" href="a00002.html">MyAllocator</a>, <br class="typebreak">
<a class="el" href="a00030.html">Loki::CreateStatic</a>, <br class="typebreak">
LifetimePolicy, ThreadingModel &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#74b23f8327ce4f3d795aa20240deb99e">MyAllocatorSingleton</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Defines singleton made from allocator. <br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c1ce92a825643f114d555fea170e2a99"></a><!-- doxytag: member="Loki::AllocatorSingleton::AllocatorSingleton" ref="c1ce92a825643f114d555fea170e2a99" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#c1ce92a825643f114d555fea170e2a99">AllocatorSingleton</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The default constructor is not meant to be called directly. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f4248c104f7c04f4dbef16543083be53"></a><!-- doxytag: member="Loki::AllocatorSingleton::~AllocatorSingleton" ref="f4248c104f7c04f4dbef16543083be53" args="(void)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#f4248c104f7c04f4dbef16543083be53">~AllocatorSingleton</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The destructor is not meant to be called directly. <br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0de7839b1e888e11ff44bc50b78ca7d7"></a><!-- doxytag: member="Loki::AllocatorSingleton::Instance" ref="0de7839b1e888e11ff44bc50b78ca7d7" args="(void)" -->
static <a class="el" href="a00002.html">AllocatorSingleton</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#0de7839b1e888e11ff44bc50b78ca7d7">Instance</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns reference to the singleton. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#082b4ba1c6574c5bed916c55ecf46e82">ClearExtraMemory</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#033978d127f16d2da0fd79d31ee75713">IsCorrupted</a> (void)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;template&lt; class, class &gt; class ThreadingModel = ::Loki::SingleThreaded, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template&lt; class &gt; class LifetimePolicy = ::Loki::LongevityLifetime::DieAsSmallObjectParent, class MutexPolicy = ::Loki::Mutex&gt;<br>
 class Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;</h3>

This template class is derived from <a class="el" href="a00127.html">SmallObjAllocator</a> in order to pass template arguments into it, and still have a default constructor for the singleton. Each instance is a unique combination of all the template parameters, and hence is singleton only with respect to those parameters. The template parameters have default values and the class has typedefs identical to both <a class="el" href="a00128.html">SmallObject</a> and <a class="el" href="a00130.html">SmallValueObject</a> so that this class can be used directly instead of going through <a class="el" href="a00128.html">SmallObject</a> or <a class="el" href="a00130.html">SmallValueObject</a>. That design feature allows clients to use the new_handler without having the name of the new_handler function show up in classes derived from <a class="el" href="a00128.html">SmallObject</a> or <a class="el" href="a00130.html">SmallValueObject</a>. Thus, the only functions in the allocator which show up in <a class="el" href="a00128.html">SmallObject</a> or <a class="el" href="a00130.html">SmallValueObject</a> inheritance hierarchies are the new and delete operators. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="082b4ba1c6574c5bed916c55ecf46e82"></a><!-- doxytag: member="Loki::AllocatorSingleton::ClearExtraMemory" ref="082b4ba1c6574c5bed916c55ecf46e82" args="(void)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;template&lt; class, class &gt; class T, std::size_t C, std::size_t M, std::size_t O, template&lt; class &gt; class L, class X &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="a00002.html">Loki::AllocatorSingleton</a>&lt; T, C, M, O, L, X &gt;::ClearExtraMemory           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Clears any excess memory used by the allocator. Complexity is O(F + C) where F is the count of FixedAllocator's in the pool, and C is the number of Chunks in all FixedAllocator's. This never throws. <dl class="note" compact><dt><b>Note:</b></dt><dd>This function can be used as a new_handler when <a class="el" href="a00192.html">Loki</a> and other memory allocators can no longer allocate. Although the C++ Standard allows new_handler functions to terminate the program when they can not release any memory, this will not do so. </dd></dl>

<p>References <a class="el" href="a00262.html#l00238">Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;::Instance()</a>, and <a class="el" href="a00261.html#l01088">Loki::SmallObjAllocator::TrimExcessMemory()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<a class="anchor" name="033978d127f16d2da0fd79d31ee75713"></a><!-- doxytag: member="Loki::AllocatorSingleton::IsCorrupted" ref="033978d127f16d2da0fd79d31ee75713" args="(void)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;template&lt; class, class &gt; class T, std::size_t C, std::size_t M, std::size_t O, template&lt; class &gt; class L, class X &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="a00002.html">Loki::AllocatorSingleton</a>&lt; T, C, M, O, L, X &gt;::IsCorrupted           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns true if anything in implementation is corrupt. Complexity is O(F + C + B) where F is the count of FixedAllocator's in the pool, C is the number of Chunks in all FixedAllocator's, and B is the number of blocks in all Chunks. If it determines any data is corrupted, this will return true in release version, but assert in debug version at the line where it detects the corrupted data. If it does not detect any corrupted data, it returns false. 
<p>References <a class="el" href="a00262.html#l00238">Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;::Instance()</a>, and <a class="el" href="a00261.html#l01199">Loki::SmallObjAllocator::IsCorrupt()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>SmallObj.h</ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 29 18:51:45 2009 for Loki by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>