File: a00635.html

package info (click to toggle)
libloki 0.1.5-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,888 kB
  • ctags: 5,535
  • sloc: cpp: 22,174; ansic: 1,955; makefile: 359; php: 316; perl: 108
file content (137 lines) | stat: -rwxr-xr-x 11,754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Loki: Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt; Class Template Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<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 id="current"><a href="classes.html"><span>Classes</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="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</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="nav">
<a class="el" href="a00764.html">Loki</a>::<a class="el" href="a00635.html">AllocatorSingleton</a></div>
<h1>Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt; Class Template Reference<br>
<small>
[<a class="el" href="a00780.html">Internals</a>]</small>
</h1><!-- doxytag: class="Loki::AllocatorSingleton" --><!-- doxytag: inherits="Loki::SmallObjAllocator" --><code>#include &lt;SmallObj.h&gt;</code>
<p>
Inheritance diagram for Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;:<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for Loki::AllocatorSingleton&lt; ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy &gt;:<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center><a href="a00215.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="a00635.html">AllocatorSingleton</a>&lt;<br>
 ThreadingModel, chunkSize,<br>
 maxSmallObjectSize, objectAlignSize,<br>
 LifetimePolicy &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00635.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&lt; <a class="el" href="a00635.html">MyAllocator</a>,<br>
 MutexPolicy &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00635.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="a00712.html">Loki::SingletonHolder</a>&lt;<br>
 <a class="el" href="a00635.html">MyAllocator</a>, <a class="el" href="a00651.html">Loki::CreateStatic</a>,<br>
 LifetimePolicy, ThreadingModel &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00635.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="a00635.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="a00635.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="a00635.html">AllocatorSingleton</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00635.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="a00635.html#889a196a9f29f8b1fb707e72bd3c1602">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="a00635.html#cb2d554afe7e64996e813cd3b8219c23">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 = 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="a00714.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="a00715.html">SmallObject</a> and <a class="el" href="a00717.html">SmallValueObject</a> so that this class can be used directly instead of going through <a class="el" href="a00715.html">SmallObject</a> or <a class="el" href="a00717.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="a00715.html">SmallObject</a> or <a class="el" href="a00717.html">SmallValueObject</a>. Thus, the only functions in the allocator which show up in <a class="el" href="a00715.html">SmallObject</a> or <a class="el" href="a00717.html">SmallValueObject</a> inheritance hierarchies are the new and delete operators. 
<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="889a196a9f29f8b1fb707e72bd3c1602"></a><!-- doxytag: member="Loki::AllocatorSingleton::ClearExtraMemory" ref="889a196a9f29f8b1fb707e72bd3c1602" args="(void)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;template&lt; class, class &gt; class TM, std::size_t CS, std::size_t MSOS, std::size_t OAS, template&lt; class &gt; class LP, class MX&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="a00635.html">Loki::AllocatorSingleton</a>&lt; TM, CS, MSOS, OAS, LP, MX &gt;::ClearExtraMemory           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [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 compact><dt><b>Note:</b></dt><dd>This function can be used as a new_handler when <a class="el" href="a00764.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>

</div>
</div><p>
<a class="anchor" name="cb2d554afe7e64996e813cd3b8219c23"></a><!-- doxytag: member="Loki::AllocatorSingleton::IsCorrupted" ref="cb2d554afe7e64996e813cd3b8219c23" args="(void)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;template&lt; class, class &gt; class TM, std::size_t CS, std::size_t MSOS, std::size_t OAS, template&lt; class &gt; class LP, class MX&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="a00635.html">Loki::AllocatorSingleton</a>&lt; TM, CS, MSOS, OAS, LP, MX &gt;::IsCorrupted           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [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. 
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>SmallObj.h</ul>
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 19 15:14:44 2006 for Loki by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>