This file is indexed.

/usr/share/doc/libucommon-dev/a00197_source.html is in libucommon-doc 3.2.0-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>UCommon: ucommon/memory.h Source File</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.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>ucommon/memory.h</h1><a href="a00197.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published </span>
<a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00017"></a>00017 
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef _UCOMMON_MEMORY_H_</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_MEMORY_H_</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">#ifndef _UCOMMON_CONFIG_H_</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00201.html" title="Various miscelanous platform specific headers and defines.">ucommon/platform.h</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#endif</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifndef  _UCOMMON_LINKED_H_</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00195.html" title="Linked objects, lists, templates, and containers.">ucommon/linked.h</a>&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 NAMESPACE_UCOMMON
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">class </span>PagerPool;
<a name="l00044"></a>00044 
<a name="l00052"></a><a class="code" href="a00080.html">00052</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00080.html" title="An alternate memory pager private heap manager.">memalloc</a>
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054 <span class="keyword">private</span>:
<a name="l00055"></a>00055     <span class="keywordtype">size_t</span> pagesize, align;
<a name="l00056"></a>00056     <span class="keywordtype">unsigned</span> count;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058     <span class="keyword">typedef</span> <span class="keyword">struct </span>mempage {
<a name="l00059"></a>00059         <span class="keyword">struct </span>mempage *next;
<a name="l00060"></a>00060         <span class="keyword">union </span>{
<a name="l00061"></a>00061             <span class="keywordtype">void</span> *memalign;
<a name="l00062"></a>00062             <span class="keywordtype">unsigned</span> used;      
<a name="l00063"></a>00063         };
<a name="l00064"></a>00064     }   page_t;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066     page_t *page;
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
<a name="l00069"></a>00069     <span class="keywordtype">unsigned</span> limit;
<a name="l00070"></a>00070 
<a name="l00075"></a>00075     page_t *<a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a>(<span class="keywordtype">void</span>);
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="keyword">public</span>:
<a name="l00082"></a>00082     <a class="code" href="a00080.html" title="An alternate memory pager private heap manager.">memalloc</a>(<span class="keywordtype">size_t</span> page = 0);
<a name="l00083"></a>00083 
<a name="l00087"></a>00087     <span class="keyword">virtual</span> ~<a class="code" href="a00080.html" title="An alternate memory pager private heap manager.">memalloc</a>();
<a name="l00088"></a>00088 
<a name="l00093"></a><a class="code" href="a00080.html#a1a312654ab07979eca953a1ee54a55c9">00093</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getPages(<span class="keywordtype">void</span>)
<a name="l00094"></a>00094         {<span class="keywordflow">return</span> count;};
<a name="l00095"></a>00095 
<a name="l00103"></a><a class="code" href="a00080.html#a437ccce5e21fee3a19ce5de11911c59a">00103</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getLimit(<span class="keywordtype">void</span>)
<a name="l00104"></a>00104         {<span class="keywordflow">return</span> limit;};
<a name="l00105"></a>00105 
<a name="l00110"></a><a class="code" href="a00080.html#a2d2c6d0caa2a0da8b743073b10f8d3fc">00110</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getAlloc(<span class="keywordtype">void</span>)
<a name="l00111"></a>00111         {<span class="keywordflow">return</span> pagesize;};
<a name="l00112"></a>00112 
<a name="l00123"></a>00123     <span class="keywordtype">unsigned</span> utilization(<span class="keywordtype">void</span>);
<a name="l00124"></a>00124 
<a name="l00128"></a>00128     <span class="keywordtype">void</span> purge(<span class="keywordtype">void</span>);
<a name="l00129"></a>00129 
<a name="l00136"></a>00136     <span class="keyword">virtual</span> <span class="keywordtype">void</span> *alloc(<span class="keywordtype">size_t</span> size);
<a name="l00137"></a>00137 
<a name="l00145"></a>00145     <span class="keywordtype">void</span> *zalloc(<span class="keywordtype">size_t</span> size);
<a name="l00146"></a>00146 
<a name="l00152"></a>00152     <span class="keywordtype">char</span> *dup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l00153"></a>00153 
<a name="l00160"></a>00160     <span class="keywordtype">void</span> *dup(<span class="keywordtype">void</span> *memory, <span class="keywordtype">size_t</span> size);
<a name="l00161"></a>00161 };
<a name="l00162"></a>00162 
<a name="l00183"></a><a class="code" href="a00081.html">00183</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a> : <span class="keyword">public</span> <a class="code" href="a00080.html" title="An alternate memory pager private heap manager.">memalloc</a>
<a name="l00184"></a>00184 {
<a name="l00185"></a>00185 <span class="keyword">private</span>:
<a name="l00186"></a>00186     pthread_mutex_t <a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex</a>;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188 <span class="keyword">public</span>:
<a name="l00193"></a>00193     <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a>(<span class="keywordtype">size_t</span> page = 0);
<a name="l00194"></a>00194 
<a name="l00198"></a>00198     <span class="keyword">virtual</span> ~<a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a>();
<a name="l00199"></a>00199 
<a name="l00206"></a><a class="code" href="a00081.html#a31551310883b634bdad4fc37ed9eaa92">00206</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00214.html#a72818707e51af1a21b83b8ea39b95daa" title="Convenience function to exclusively lock an object through it&amp;#39;s protocol.">lock</a>(<span class="keywordtype">void</span>)
<a name="l00207"></a>00207         {pthread_mutex_lock(&amp;<a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex</a>);};
<a name="l00208"></a>00208 
<a name="l00212"></a><a class="code" href="a00081.html#a87d2cc2e145455b5e17b1d1def27e90a">00212</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00214.html#a140946704e1b4c4e9c3b14081c1d300d" title="Convenience function to unlock an exclusive object through it&amp;#39;s protocol.">unlock</a>(<span class="keywordtype">void</span>)
<a name="l00213"></a>00213         {pthread_mutex_unlock(&amp;<a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex</a>);};
<a name="l00214"></a>00214 
<a name="l00225"></a>00225     <span class="keywordtype">unsigned</span> <a class="code" href="a00080.html#afe93dc2c37b8f03255e6b71e5bfd6e15" title="Determine fragmentation level of acquired heap pages.">utilization</a>(<span class="keywordtype">void</span>);
<a name="l00226"></a>00226 
<a name="l00230"></a>00230     <span class="keywordtype">void</span> <a class="code" href="a00080.html#a35bd2c59ecc2ab6a04e7bf9d9bd92b24" title="Purge all allocated memory and heap pages immediately.">purge</a>(<span class="keywordtype">void</span>);
<a name="l00231"></a>00231 
<a name="l00239"></a>00239     <span class="keyword">virtual</span> <span class="keywordtype">void</span> dealloc(<span class="keywordtype">void</span> *memory);
<a name="l00240"></a>00240 
<a name="l00248"></a>00248     <span class="keywordtype">void</span> *<a class="code" href="a00080.html#a086ccd141c4e5d57d91c50eb27923612" title="Allocate memory from the pager heap.">alloc</a>(<span class="keywordtype">size_t</span> size);
<a name="l00249"></a>00249 
<a name="l00258"></a>00258     <span class="keywordtype">void</span> *<a class="code" href="a00080.html#a4d46bf82a4c340d10a6e96333e0c9b8b" title="Allocate memory from the pager heap.">zalloc</a>(<span class="keywordtype">size_t</span> size);
<a name="l00259"></a>00259 
<a name="l00266"></a>00266     <span class="keywordtype">char</span> *<a class="code" href="a00080.html#a0790234f08af30a0da6430552fbcdc1d" title="Duplicate NULL terminated string into allocated memory.">dup</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l00267"></a>00267 
<a name="l00275"></a>00275     <span class="keywordtype">void</span> *<a class="code" href="a00080.html#a0790234f08af30a0da6430552fbcdc1d" title="Duplicate NULL terminated string into allocated memory.">dup</a>(<span class="keywordtype">void</span> *memory, <span class="keywordtype">size_t</span> size);
<a name="l00276"></a>00276 };
<a name="l00277"></a>00277 
<a name="l00285"></a><a class="code" href="a00031.html">00285</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00031.html" title="Create a linked list of auto-releasable objects.">autorelease</a>
<a name="l00286"></a>00286 {
<a name="l00287"></a>00287 <span class="keyword">private</span>:
<a name="l00288"></a>00288     <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> *pool;
<a name="l00289"></a>00289 
<a name="l00290"></a>00290 <span class="keyword">public</span>:
<a name="l00294"></a>00294     <a class="code" href="a00031.html" title="Create a linked list of auto-releasable objects.">autorelease</a>();
<a name="l00295"></a>00295 
<a name="l00299"></a>00299     ~<a class="code" href="a00031.html" title="Create a linked list of auto-releasable objects.">autorelease</a>();
<a name="l00300"></a>00300 
<a name="l00306"></a>00306     <span class="keywordtype">void</span> <a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&amp;#39;s protocol.">release</a>(<span class="keywordtype">void</span>);
<a name="l00307"></a>00307 
<a name="l00312"></a>00312     <span class="keywordtype">void</span> operator+=(<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> *<span class="keywordtype">object</span>);
<a name="l00313"></a>00313 };
<a name="l00314"></a>00314 
<a name="l00325"></a><a class="code" href="a00103.html">00325</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00103.html" title="This is a base class for objects that may be created in pager pools.">PagerObject</a> : <span class="keyword">public</span> <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a>, <span class="keyword">public</span> <a class="code" href="a00043.html" title="A base class for reference counted objects.">CountedObject</a>
<a name="l00326"></a>00326 {
<a name="l00327"></a>00327 <span class="keyword">protected</span>:
<a name="l00328"></a>00328     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a>;
<a name="l00329"></a>00329 
<a name="l00330"></a>00330     <a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a> *<a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a>;
<a name="l00331"></a>00331 
<a name="l00335"></a>00335     <a class="code" href="a00103.html" title="This is a base class for objects that may be created in pager pools.">PagerObject</a>();
<a name="l00336"></a>00336 
<a name="l00340"></a>00340     <span class="keywordtype">void</span> <a class="code" href="a00043.html#a682422b0a164087fb29452d1e5011438" title="Decrease reference count when released.">release</a>(<span class="keywordtype">void</span>);
<a name="l00341"></a>00341 
<a name="l00345"></a>00345     <span class="keywordtype">void</span> <a class="code" href="a00043.html#a52cc516039b28a17b2f59cdec577c9c6" title="Dealloc object no longer referenced.">dealloc</a>(<span class="keywordtype">void</span>);
<a name="l00346"></a>00346 };  
<a name="l00347"></a>00347 
<a name="l00353"></a><a class="code" href="a00104.html">00353</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a> 
<a name="l00354"></a>00354 {
<a name="l00355"></a>00355 <span class="keyword">private</span>:
<a name="l00356"></a>00356     <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a> *<a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a>;
<a name="l00357"></a>00357     <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> *freelist;
<a name="l00358"></a>00358     pthread_mutex_t <a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex</a>;
<a name="l00359"></a>00359 
<a name="l00360"></a>00360 <span class="keyword">protected</span>:
<a name="l00361"></a>00361     <a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a>(<a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a> *<a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a>);
<a name="l00362"></a>00362     ~<a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a>();
<a name="l00363"></a>00363 
<a name="l00364"></a>00364     <a class="code" href="a00103.html" title="This is a base class for objects that may be created in pager pools.">PagerObject</a> *<span class="keyword">get</span>(<span class="keywordtype">size_t</span> size);
<a name="l00365"></a>00365 
<a name="l00366"></a>00366 <span class="keyword">public</span>:
<a name="l00371"></a>00371     <span class="keywordtype">void</span> put(<a class="code" href="a00103.html" title="This is a base class for objects that may be created in pager pools.">PagerObject</a> *<span class="keywordtype">object</span>);
<a name="l00372"></a>00372 };
<a name="l00373"></a>00373 
<a name="l00385"></a><a class="code" href="a00059.html">00385</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a> : <span class="keyword">protected</span> <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a>
<a name="l00386"></a>00386 {
<a name="l00387"></a>00387 <span class="keyword">private</span>:
<a name="l00391"></a>00391     <span class="keyword">class </span>__LOCAL keydata : <span class="keyword">public</span> <a class="code" href="a00090.html" title="A linked object base class with members found by name.">NamedObject</a>
<a name="l00392"></a>00392     {
<a name="l00393"></a>00393     <span class="keyword">public</span>:
<a name="l00394"></a>00394         <span class="keywordtype">void</span> *data;
<a name="l00395"></a>00395         <span class="keywordtype">char</span> text[8];
<a name="l00396"></a>00396 
<a name="l00397"></a>00397         keydata(<a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a> *assoc, <span class="keywordtype">char</span> *<span class="keywordtype">id</span>, <span class="keywordtype">unsigned</span> <a class="code" href="a00214.html#a8049d3aa4d2ad2df40e33d0104fe0c05" title="Template for max value of a type.">max</a>, <span class="keywordtype">unsigned</span> bufsize);
<a name="l00398"></a>00398     };
<a name="l00399"></a>00399 
<a name="l00400"></a>00400     <span class="keyword">friend</span> <span class="keyword">class </span>keydata;
<a name="l00401"></a>00401 
<a name="l00402"></a>00402     <span class="keywordtype">unsigned</span> count;
<a name="l00403"></a>00403     <span class="keywordtype">unsigned</span> paths;
<a name="l00404"></a>00404     <span class="keywordtype">size_t</span> keysize;
<a name="l00405"></a>00405     <a class="code" href="a00090.html" title="A linked object base class with members found by name.">NamedObject</a> **root;
<a name="l00406"></a>00406     <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> **list;
<a name="l00407"></a>00407 
<a name="l00408"></a>00408 <span class="keyword">public</span>:
<a name="l00415"></a>00415     <a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a>(<span class="keywordtype">unsigned</span> indexing = 177, <span class="keywordtype">size_t</span> <a class="code" href="a00214.html#a8049d3aa4d2ad2df40e33d0104fe0c05" title="Template for max value of a type.">max</a> = 0, <span class="keywordtype">size_t</span> page = 0);
<a name="l00416"></a>00416 
<a name="l00420"></a>00420     ~<a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a>();
<a name="l00421"></a>00421 
<a name="l00426"></a><a class="code" href="a00059.html#a42c8f55d2152e5a49c6737be2d8c9c55">00426</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getCount(<span class="keywordtype">void</span>)
<a name="l00427"></a>00427         {<span class="keywordflow">return</span> count;};
<a name="l00428"></a>00428 
<a name="l00434"></a><a class="code" href="a00059.html#a6847ae4ffddfaf8fa76d72b2f2232a40">00434</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> *operator()(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00435"></a>00435         {<span class="keywordflow">return</span> locate(name);};
<a name="l00436"></a>00436 
<a name="l00440"></a>00440     <span class="keywordtype">void</span> <a class="code" href="a00081.html#afdc290a1fd291de22503325a498a9b5a" title="Purge all allocated memory and heap pages immediately.">purge</a>(<span class="keywordtype">void</span>);
<a name="l00441"></a>00441 
<a name="l00447"></a>00447     <span class="keywordtype">void</span> *locate(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00448"></a>00448 
<a name="l00456"></a>00456     <span class="keywordtype">bool</span> assign(<span class="keywordtype">char</span> *name, <span class="keywordtype">void</span> *<a class="code" href="a00015.html" title="Typed smart pointer class.">pointer</a>);
<a name="l00457"></a>00457 
<a name="l00464"></a>00464     <span class="keywordtype">bool</span> create(<span class="keywordtype">char</span> *name, <span class="keywordtype">void</span> *<a class="code" href="a00015.html" title="Typed smart pointer class.">pointer</a>);
<a name="l00465"></a>00465 
<a name="l00472"></a>00472     <span class="keywordtype">void</span> *<span class="keyword">remove</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00473"></a>00473 };
<a name="l00474"></a>00474 
<a name="l00482"></a>00482 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T, <span class="keywordtype">unsigned</span> I = 177, <span class="keywordtype">size_t</span> M = 0, <span class="keywordtype">size_t</span> P = 0&gt;
<a name="l00483"></a><a class="code" href="a00019.html">00483</a> <span class="keyword">class </span><a class="code" href="a00019.html" title="A typed template for using a key association with typed objects.">assoc_pointer</a> : <span class="keyword">private</span> <a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a>
<a name="l00484"></a>00484 {
<a name="l00485"></a>00485 <span class="keyword">public</span>:
<a name="l00489"></a><a class="code" href="a00019.html#a6596d4ce88ac09f2a788b16fc54c8f07">00489</a>     <span class="keyword">inline</span> <a class="code" href="a00019.html#a6596d4ce88ac09f2a788b16fc54c8f07" title="Construct an associated pointer hash map based on the class template.">assoc_pointer</a>() : <a class="code" href="a00059.html" title="A class to hold memory pointers referenced by string names.">keyassoc</a>(I, M, P) {};
<a name="l00490"></a>00490 
<a name="l00495"></a><a class="code" href="a00019.html#aa1218cc79f7ab50d33be57a5e0281c0b">00495</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getCount(<span class="keywordtype">void</span>)
<a name="l00496"></a>00496         {<span class="keywordflow">return</span> keyassoc::getCount();};
<a name="l00497"></a>00497 
<a name="l00501"></a><a class="code" href="a00019.html#a5c44dc242e37db396c1da882eed32d10">00501</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> purge(<span class="keywordtype">void</span>)
<a name="l00502"></a>00502         {keyassoc::purge();};
<a name="l00503"></a>00503 
<a name="l00509"></a><a class="code" href="a00019.html#a908bf8d87754dca01b24a64207df668c">00509</a>     <span class="keyword">inline</span> T *locate(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00510"></a>00510         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(keyassoc::locate(name));};
<a name="l00511"></a>00511 
<a name="l00517"></a><a class="code" href="a00019.html#af64f028aa4d590dd62990b4be640cf91">00517</a>     <span class="keyword">inline</span> T *operator()(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00518"></a>00518         {<span class="keywordflow">return</span> locate(name);};
<a name="l00519"></a>00519 
<a name="l00527"></a><a class="code" href="a00019.html#a407393e594321b55e6c134563c51bfe9">00527</a>     <span class="keyword">inline</span> <span class="keywordtype">bool</span> assign(<span class="keywordtype">char</span> *name, T *<a class="code" href="a00015.html" title="Typed smart pointer class.">pointer</a>)
<a name="l00528"></a>00528         {<span class="keywordflow">return</span> keyassoc::assign(name, pointer);};
<a name="l00529"></a>00529 
<a name="l00536"></a><a class="code" href="a00019.html#a6a7b43a74e0c598bf3ebcec408fd7831">00536</a>     <span class="keyword">inline</span> <span class="keywordtype">bool</span> create(<span class="keywordtype">char</span> *name, T *<a class="code" href="a00015.html" title="Typed smart pointer class.">pointer</a>)
<a name="l00537"></a>00537         {<span class="keywordflow">return</span> keyassoc::create(name, pointer);};
<a name="l00538"></a>00538 
<a name="l00544"></a><a class="code" href="a00019.html#a1260bb241fd9a82a92495542515ecc3f">00544</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <span class="keyword">remove</span>(<span class="keywordtype">char</span> *name)
<a name="l00545"></a>00545         {<a class="code" href="a00214.html#a284595fb28be69136211845567e6eeec" title="Convenience function to remove an object from a stack.">keyassoc::remove</a>(name);};
<a name="l00546"></a>00546 
<a name="l00552"></a><a class="code" href="a00019.html#af3c27c6db90fa61408f11faf7c062cb7">00552</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> utilization(<span class="keywordtype">void</span>)
<a name="l00553"></a>00553         {<span class="keywordflow">return</span> mempager::utilization();};
<a name="l00554"></a>00554 
<a name="l00561"></a><a class="code" href="a00019.html#a70512faabc83984d38f8cc6ea00d6791">00561</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getPages(<span class="keywordtype">void</span>)
<a name="l00562"></a>00562         {<span class="keywordflow">return</span> mempager::getPages();};
<a name="l00563"></a>00563 };
<a name="l00564"></a>00564 
<a name="l00571"></a>00571 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00572"></a><a class="code" href="a00102.html">00572</a> <span class="keyword">class </span><a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a> : <span class="keyword">private</span> <a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a>
<a name="l00573"></a>00573 {
<a name="l00574"></a>00574 <span class="keyword">public</span>:
<a name="l00579"></a><a class="code" href="a00102.html#a74bf45316d57d886b75a6d0147e23f80">00579</a>     <span class="keyword">inline</span> <a class="code" href="a00102.html#a74bf45316d57d886b75a6d0147e23f80" title="Construct a pager and optionally assign a private pager heap.">pager</a>(<a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a> *heap = NULL) : <a class="code" href="a00104.html" title="Pager pool base class for managed memory pools.">PagerPool</a>(heap) {};
<a name="l00580"></a>00580 
<a name="l00584"></a><a class="code" href="a00102.html#aa75c8dec0d19ecddc7d47f245e420356">00584</a>     <span class="keyword">inline</span> ~<a class="code" href="a00102.html" title="Mempager managed type factory for pager pool objects.">pager</a>()
<a name="l00585"></a>00585         {mempager::purge();};
<a name="l00586"></a>00586 
<a name="l00591"></a><a class="code" href="a00102.html#a9688d2fba2fde980f69629d2549e0cde">00591</a>     <span class="keyword">inline</span> T *operator()(<span class="keywordtype">void</span>)
<a name="l00592"></a>00592         {<span class="keywordflow">return</span> <span class="keyword">new</span>(<span class="keyword">get</span>(<span class="keyword">sizeof</span>(T))) T;};
<a name="l00593"></a>00593 
<a name="l00598"></a><a class="code" href="a00102.html#aa0b69c4c2bb9fb71bcc579747c455b64">00598</a>     <span class="keyword">inline</span> T *operator*()
<a name="l00599"></a>00599         {<span class="keywordflow">return</span> <span class="keyword">new</span>(<span class="keyword">get</span>(<span class="keyword">sizeof</span>(T))) T;};
<a name="l00600"></a>00600 };
<a name="l00601"></a>00601 
<a name="l00607"></a>00607 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T, <span class="keywordtype">unsigned</span> M = 177&gt;
<a name="l00608"></a><a class="code" href="a00065.html">00608</a> <span class="keyword">class </span><a class="code" href="a00065.html" title="A templated class for a hash pager.">keypager</a> : <span class="keyword">public</span> <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a>
<a name="l00609"></a>00609 {
<a name="l00610"></a>00610 <span class="keyword">private</span>:
<a name="l00611"></a>00611     <a class="code" href="a00090.html" title="A linked object base class with members found by name.">NamedObject</a> *idx[M];
<a name="l00612"></a>00612 
<a name="l00613"></a>00613 <span class="keyword">public</span>:
<a name="l00618"></a><a class="code" href="a00065.html#a90900b5ece13ac922ced71c341c448bb">00618</a>     <span class="keyword">inline</span> <a class="code" href="a00065.html#a90900b5ece13ac922ced71c341c448bb" title="Create the object cache.">keypager</a>(<span class="keywordtype">size_t</span> size) : <a class="code" href="a00081.html" title="A managed private heap for small allocations.">mempager</a>(size) {};
<a name="l00619"></a>00619 
<a name="l00623"></a><a class="code" href="a00065.html#a25ef65a30aad0283668cfb8da0929272">00623</a>     <span class="keyword">inline</span> ~<a class="code" href="a00065.html" title="A templated class for a hash pager.">keypager</a>()
<a name="l00624"></a>00624         {NamedObject::purge(idx, M); mempager::purge();};
<a name="l00625"></a>00625 
<a name="l00632"></a><a class="code" href="a00065.html#a9a8f0d7ca544eec61464223242875ede">00632</a>     <span class="keyword">inline</span> T *<span class="keyword">get</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name) <span class="keyword">const</span> {
<a name="l00633"></a>00633         T *node = (<span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(NamedObject::map(idx, name, M)));
<a name="l00634"></a>00634         <span class="keywordflow">if</span>(!node) {
<a name="l00635"></a>00635             node = init&lt;T&gt;(<span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(mempager::alloc(<span class="keyword">sizeof</span>(T))));
<a name="l00636"></a>00636             node-&gt;NamedObject::add(idx, name, M);
<a name="l00637"></a>00637         }
<a name="l00638"></a>00638         <span class="keywordflow">return</span> node;
<a name="l00639"></a>00639     }
<a name="l00640"></a>00640 
<a name="l00646"></a><a class="code" href="a00065.html#a8189b359cdb29f143164b6a252912400">00646</a>     <span class="keywordtype">bool</span> test(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const</span>
<a name="l00647"></a>00647 <span class="keyword">        </span>{<span class="keywordflow">return</span> NamedObject::map(idx, name, M) != NULL;};
<a name="l00648"></a>00648 
<a name="l00655"></a><a class="code" href="a00065.html#ab91217ef3d0656b92f99bb2a52c0397a">00655</a>     <span class="keyword">inline</span> T *operator[](<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const</span>
<a name="l00656"></a>00656 <span class="keyword">        </span>{<span class="keywordflow">return</span> <span class="keyword">get</span>(name);};
<a name="l00657"></a>00657 
<a name="l00662"></a><a class="code" href="a00065.html#a2b92f3385490cfadefaa9c75ab22b5df">00662</a>     <span class="keyword">inline</span> T *begin(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00663"></a>00663 <span class="keyword">        </span>{<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(NamedObject::skip(idx, NULL, M));};
<a name="l00664"></a>00664 
<a name="l00670"></a><a class="code" href="a00065.html#aaee5108e64a2effdaae8cbdcbf9053e4">00670</a>     <span class="keyword">inline</span> T *next(T *current)<span class="keyword"> const</span>
<a name="l00671"></a>00671 <span class="keyword">        </span>{<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(NamedObject::skip(idx, current, M));};
<a name="l00672"></a>00672 
<a name="l00677"></a><a class="code" href="a00065.html#a3b13989bbee7355812beb9c3635a5e63">00677</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> count(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00678"></a>00678 <span class="keyword">        </span>{<span class="keywordflow">return</span> NamedObject::count(idx, M);};
<a name="l00679"></a>00679 
<a name="l00686"></a><a class="code" href="a00065.html#ad67a7f9405abfc070f44e3897402d34a">00686</a>     <span class="keyword">inline</span> T **index(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00687"></a>00687 <span class="keyword">        </span>{<span class="keywordflow">return</span> NamedObject::index(idx, M);};
<a name="l00688"></a>00688 
<a name="l00695"></a><a class="code" href="a00065.html#adc1b8acf4ad06260904694da93c150a8">00695</a>     <span class="keyword">inline</span> T **sort(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00696"></a>00696 <span class="keyword">        </span>{<span class="keywordflow">return</span> NamedObject::sort(NamedObject::index(idx, M));};
<a name="l00697"></a>00697 }; 
<a name="l00698"></a>00698 
<a name="l00699"></a>00699 END_NAMESPACE
<a name="l00700"></a>00700 
<a name="l00701"></a>00701 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 6 08:22:01 2010 for UCommon by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>