This file is indexed.

/usr/share/doc/libucommon-dev/a00196_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
<!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/mapped.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/mapped.h</h1><a href="a00196.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="l00029"></a>00029 <span class="preprocessor">#ifndef _UCOMMON_MAPPED_H_</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_MAPPED_H_</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a>00032 <span class="preprocessor">#ifndef _UCOMMON_LINKED_H_</span>
<a name="l00033"></a>00033 <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="l00034"></a>00034 <span class="preprocessor">#endif</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span>
<a name="l00036"></a>00036 <span class="preprocessor">#ifndef _UCOMMON_THREAD_H_</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00208.html" title="Thread classes and sychronization objects.">ucommon/thread.h</a>&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#endif</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a>00040 <span class="preprocessor">#ifndef _UCOMMON_STRING_H_</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a00207.html" title="A common string class and character string support functions.">ucommon/string.h</a>&gt;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#endif</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="preprocessor">#ifndef _MSWINDOWS_</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#include &lt;signal.h&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#endif</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span>
<a name="l00048"></a>00048 NAMESPACE_UCOMMON
<a name="l00049"></a>00049 
<a name="l00058"></a><a class="code" href="a00078.html">00058</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 <span class="keyword">private</span>:
<a name="l00061"></a>00061     <span class="keywordtype">size_t</span> mapsize;
<a name="l00062"></a>00062     caddr_t map;
<a name="l00063"></a>00063     fd_t fd;    
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
<a name="l00066"></a>00066     <span class="keywordtype">size_t</span> size, used;
<a name="l00067"></a>00067     <span class="keywordtype">char</span> idname[65];
<a name="l00068"></a>00068     <span class="keywordtype">bool</span> erase;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070     <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>();
<a name="l00071"></a>00071 
<a name="l00078"></a>00078     <span class="keywordtype">void</span> create(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> size = (<span class="keywordtype">size_t</span>)0);
<a name="l00079"></a>00079 
<a name="l00084"></a>00084     <span class="keyword">virtual</span> <span class="keywordtype">void</span> fault(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 <span class="keyword">public</span>:
<a name="l00093"></a>00093     <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> size);
<a name="l00094"></a>00094 
<a name="l00101"></a>00101     <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00102"></a>00102 
<a name="l00106"></a>00106     <span class="keyword">virtual</span> ~<a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>();
<a name="l00107"></a>00107 
<a name="l00111"></a>00111     <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="l00112"></a>00112 
<a name="l00119"></a>00119     <span class="keyword">static</span>  <span class="keywordtype">void</span> <span class="keyword">remove</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00120"></a>00120 
<a name="l00125"></a><a class="code" href="a00078.html#a75f74b77dbe138bef90e253a339328ef">00125</a>     <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span>
<a name="l00126"></a>00126 <span class="keyword">        </span>{<span class="keywordflow">return</span> (size != 0);};
<a name="l00127"></a>00127 
<a name="l00132"></a><a class="code" href="a00078.html#a27b3986e3831ff3c9c1672f6c3299349">00132</a>     <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span>
<a name="l00133"></a>00133 <span class="keyword">        </span>{<span class="keywordflow">return</span> (size == 0);};
<a name="l00134"></a>00134 
<a name="l00142"></a>00142     <span class="keywordtype">void</span> *sbrk(<span class="keywordtype">size_t</span> size);
<a name="l00143"></a>00143 
<a name="l00149"></a>00149     <span class="keywordtype">void</span> *offset(<span class="keywordtype">size_t</span> offset) <span class="keyword">const</span>;
<a name="l00150"></a>00150 
<a name="l00155"></a><a class="code" href="a00078.html#a1750c47e0aff47bfd3e68bc550e1409f">00155</a>     <span class="keyword">inline</span> <span class="keywordtype">size_t</span> len(<span class="keywordtype">void</span>)
<a name="l00156"></a>00156         {<span class="keywordflow">return</span> size;};
<a name="l00157"></a>00157 
<a name="l00162"></a><a class="code" href="a00078.html#a7d017a8edb1ad0909ecc1f521e185006">00162</a>     <span class="keyword">inline</span> caddr_t getStart(<span class="keywordtype">void</span>)
<a name="l00163"></a>00163         {<span class="keywordflow">return</span> map;};
<a name="l00164"></a>00164 
<a name="l00172"></a>00172     <span class="keyword">static</span> <span class="keywordtype">void</span> disable(<span class="keywordtype">void</span>);
<a name="l00173"></a>00173 };
<a name="l00174"></a>00174 
<a name="l00184"></a><a class="code" href="a00079.html">00184</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a> : <span class="keyword">protected</span> <a class="code" href="a00112.html" title="Class for resource bound memory pools between threads.">ReusableAllocator</a>, <span class="keyword">protected</span> <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>
<a name="l00185"></a>00185 {
<a name="l00186"></a>00186 <span class="keyword">private</span>:
<a name="l00187"></a>00187     <span class="keywordtype">unsigned</span> objsize;
<a name="l00188"></a>00188     <span class="keywordtype">unsigned</span> reading;
<a name="l00189"></a>00189     <a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex_t</a> <a class="code" href="a00086.html" title="Generic non-recursive exclusive lock class.">mutex</a>;
<a name="l00190"></a>00190 
<a name="l00191"></a>00191 <span class="keyword">protected</span>:
<a name="l00192"></a>00192     <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a>(<span class="keywordtype">size_t</span> osize);
<a name="l00193"></a>00193 
<a name="l00194"></a>00194     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="a00078.html#a6d853e3912451fd0217547f72fd5a244" title="Supporting function to construct a new or access an existing shared memory segment...">create</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fname, <span class="keywordtype">unsigned</span> count)
<a name="l00195"></a>00195         {MappedMemory::create(fname, count * objsize);};
<a name="l00196"></a>00196 
<a name="l00197"></a>00197 <span class="keyword">public</span>:
<a name="l00210"></a>00210     <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> size, <span class="keywordtype">unsigned</span> count);
<a name="l00211"></a>00211     
<a name="l00216"></a>00216     <span class="keywordtype">bool</span> avail(<span class="keywordtype">void</span>);
<a name="l00217"></a>00217 
<a name="l00222"></a>00222     <a class="code" href="a00113.html" title="Reusable objects for forming private heaps.">ReusableObject</a> *request(<span class="keywordtype">void</span>);
<a name="l00223"></a>00223 
<a name="l00229"></a>00229     <a class="code" href="a00113.html" title="Reusable objects for forming private heaps.">ReusableObject</a> *<span class="keyword">get</span>(void);
<a name="l00230"></a>00230 
<a name="l00238"></a>00238     <a class="code" href="a00113.html" title="Reusable objects for forming private heaps.">ReusableObject</a> *getTimed(<a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout);
<a name="l00239"></a>00239 
<a name="l00245"></a>00245     <a class="code" href="a00113.html" title="Reusable objects for forming private heaps.">ReusableObject</a> *getLocked(<span class="keywordtype">void</span>);
<a name="l00246"></a>00246 
<a name="l00252"></a>00252     <span class="keywordtype">void</span> removeLocked(<a class="code" href="a00113.html" title="Reusable objects for forming private heaps.">ReusableObject</a> *<span class="keywordtype">object</span>);  
<a name="l00253"></a>00253 };
<a name="l00254"></a>00254 
<a name="l00261"></a>00261 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00262"></a><a class="code" href="a00075.html">00262</a> <span class="keyword">class </span><a class="code" href="a00075.html" title="Template class to map typed vector into shared memory.">mapped_array</a> : <span class="keyword">public</span> <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>
<a name="l00263"></a>00263 {
<a name="l00264"></a>00264 <span class="keyword">protected</span>:
<a name="l00265"></a>00265     <span class="keyword">inline</span> <a class="code" href="a00075.html" title="Template class to map typed vector into shared memory.">mapped_array</a>() : <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>() {};
<a name="l00266"></a>00266 
<a name="l00267"></a>00267     <span class="keyword">inline</span> <span class="keywordtype">void</span> create(<span class="keyword">const</span> <span class="keywordtype">char</span> *fn, <span class="keywordtype">unsigned</span> members)
<a name="l00268"></a>00268         {MappedMemory::create(fn, members * <span class="keyword">sizeof</span>(T));};
<a name="l00269"></a>00269 
<a name="l00270"></a>00270 <span class="keyword">public</span>:
<a name="l00279"></a><a class="code" href="a00075.html#af4e1a58e140f7dbca2ccfd633afc36a1">00279</a>     <span class="keyword">inline</span> <a class="code" href="a00075.html" title="Template class to map typed vector into shared memory.">mapped_array</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">unsigned</span> number) : 
<a name="l00280"></a>00280         <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>(name, number * sizeof(T)) {};
<a name="l00281"></a>00281 
<a name="l00286"></a><a class="code" href="a00075.html#a519f8d04d8e405b3b7978157842f56b4">00286</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> initialize(<span class="keywordtype">void</span>)
<a name="l00287"></a>00287         {<span class="keyword">new</span>((caddr_t)offset(0)) T[size / <span class="keyword">sizeof</span>(T)];};
<a name="l00288"></a>00288 
<a name="l00293"></a><a class="code" href="a00075.html#a546d82058180cce2112751571d453c99">00293</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> *addLock(<span class="keywordtype">void</span>)
<a name="l00294"></a>00294         {<span class="keywordflow">return</span> sbrk(<span class="keyword">sizeof</span>(T));};
<a name="l00295"></a>00295     
<a name="l00301"></a><a class="code" href="a00075.html#ab35463984e41b1c3d16d372e4efac2be">00301</a>     <span class="keyword">inline</span> T *operator()(<span class="keywordtype">unsigned</span> member)
<a name="l00302"></a>00302         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(offset(member * <span class="keyword">sizeof</span>(T)));}
<a name="l00303"></a>00303 
<a name="l00308"></a><a class="code" href="a00075.html#af713adf7e693ee11966de77885be1c95">00308</a>     <span class="keyword">inline</span> T *operator()(<span class="keywordtype">void</span>)
<a name="l00309"></a>00309         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(sbrk(<span class="keyword">sizeof</span>(T)));};
<a name="l00310"></a>00310     
<a name="l00316"></a><a class="code" href="a00075.html#a469dd889e025864925f32b96584ef79b">00316</a>     <span class="keyword">inline</span> T&amp; operator[](<span class="keywordtype">unsigned</span> member)
<a name="l00317"></a>00317         {<span class="keywordflow">return</span> *(operator()(member));};
<a name="l00318"></a>00318 
<a name="l00323"></a><a class="code" href="a00075.html#af289fb21fec23590c0b5f296a7fae1b2">00323</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getSize(<span class="keywordtype">void</span>)
<a name="l00324"></a>00324         {<span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span>)(size / <span class="keyword">sizeof</span>(T));};
<a name="l00325"></a>00325 };
<a name="l00326"></a>00326 
<a name="l00334"></a>00334 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00335"></a><a class="code" href="a00076.html">00335</a> <span class="keyword">class </span><a class="code" href="a00076.html" title="Template class to map typed resusble objects into shared memory heap.">mapped_reuse</a> : <span class="keyword">public</span> <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a>
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337 <span class="keyword">protected</span>:
<a name="l00338"></a>00338     <span class="keyword">inline</span> <a class="code" href="a00076.html" title="Template class to map typed resusble objects into shared memory heap.">mapped_reuse</a>() :
<a name="l00339"></a>00339         <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a>(<span class="keyword">sizeof</span>(T)) {};
<a name="l00340"></a>00340 
<a name="l00341"></a>00341 <span class="keyword">public</span>:
<a name="l00349"></a><a class="code" href="a00076.html#a4a633d6ed75c43bac837a0b43e892378">00349</a>     <span class="keyword">inline</span> <a class="code" href="a00076.html" title="Template class to map typed resusble objects into shared memory heap.">mapped_reuse</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">unsigned</span> number) :
<a name="l00350"></a>00350         <a class="code" href="a00079.html" title="Map a reusable allocator over a named shared memory segment.">MappedReuse</a>(name, sizeof(T), number) {};
<a name="l00351"></a>00351 
<a name="l00356"></a><a class="code" href="a00076.html#aff94a6c4b95f4d97b0bc3f8679f27cee">00356</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> initialize(<span class="keywordtype">void</span>)
<a name="l00357"></a>00357         {<span class="keyword">new</span>((caddr_t)pos(0)) T[size / <span class="keyword">sizeof</span>(T)];};
<a name="l00358"></a>00358 
<a name="l00363"></a><a class="code" href="a00076.html#a0f97fd1654b110132c5d7b88fd3d1475">00363</a>     <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span>
<a name="l00364"></a>00364 <span class="keyword">        </span>{<span class="keywordflow">return</span> MappedReuse::avail();};
<a name="l00365"></a>00365 
<a name="l00370"></a><a class="code" href="a00076.html#a718e2aaca553791a031fbe9acb72050f">00370</a>     <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span>
<a name="l00371"></a>00371 <span class="keyword">        </span>{<span class="keywordflow">return</span> !MappedReuse::avail();};
<a name="l00372"></a>00372 
<a name="l00378"></a><a class="code" href="a00076.html#a1cf523f20120b1cbdebdebf9452d249a">00378</a>     <span class="keyword">inline</span> operator T*()
<a name="l00379"></a>00379         {<span class="keywordflow">return</span> mapped_reuse::get();};
<a name="l00380"></a>00380 
<a name="l00386"></a><a class="code" href="a00076.html#ac555906df4cef847ac1143863ebddf65">00386</a>     <span class="keyword">inline</span> T* operator*()
<a name="l00387"></a>00387         {<span class="keywordflow">return</span> mapped_reuse::get();};
<a name="l00388"></a>00388 
<a name="l00394"></a><a class="code" href="a00076.html#a9998f7f5600d29b831e11ffbea8a440a">00394</a>     <span class="keyword">inline</span> T *pos(<span class="keywordtype">size_t</span> member)
<a name="l00395"></a>00395         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(MappedReuse::offset(member * <span class="keyword">sizeof</span>(T)));};
<a name="l00396"></a>00396 
<a name="l00402"></a><a class="code" href="a00076.html#a566b6a02f6d155b0ec209d613de23a79">00402</a>     <span class="keyword">inline</span> T *<span class="keyword">get</span>(void)
<a name="l00403"></a>00403         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(MappedReuse::get());};
<a name="l00404"></a>00404 
<a name="l00412"></a><a class="code" href="a00076.html#a1b56dd1f66a78a6590c2adc0168c38fc">00412</a>     <span class="keyword">inline</span> T *getTimed(<a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout)
<a name="l00413"></a>00413         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(MappedReuse::getTimed(timeout));};
<a name="l00414"></a>00414 
<a name="l00420"></a><a class="code" href="a00076.html#a9a5ef2602129c869b2fedb47ffad72f7">00420</a>     <span class="keyword">inline</span> T *request(<span class="keywordtype">void</span>)
<a name="l00421"></a>00421         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(MappedReuse::request());};
<a name="l00422"></a>00422 
<a name="l00428"></a><a class="code" href="a00076.html#a6bc03d14ae61bcf37bfb79647c7a4812">00428</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> removeLocked(T *<span class="keywordtype">object</span>)
<a name="l00429"></a>00429         {MappedReuse::removeLocked(<span class="keywordtype">object</span>);};
<a name="l00430"></a>00430 
<a name="l00436"></a><a class="code" href="a00076.html#aea181320a0fa012f38e079a665aa3bc7">00436</a>     <span class="keyword">inline</span> T *getLocked(<span class="keywordtype">void</span>)
<a name="l00437"></a>00437         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T*<span class="keyword">&gt;</span>(MappedReuse::getLocked());};
<a name="l00438"></a>00438 
<a name="l00443"></a><a class="code" href="a00076.html#a7ded62fa149b1951b1f45b6aec7284f8">00443</a>     <span class="keyword">inline</span> <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>(T *<span class="keywordtype">object</span>)
<a name="l00444"></a>00444         {<a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&amp;#39;s protocol.">ReusableAllocator::release</a>(<span class="keywordtype">object</span>);};
<a name="l00445"></a>00445 };
<a name="l00446"></a>00446 
<a name="l00453"></a>00453 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00454"></a><a class="code" href="a00077.html">00454</a> <span class="keyword">class </span><a class="code" href="a00077.html" title="Class to access a named mapped segment published from another process.">mapped_view</a> : <span class="keyword">protected</span> <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>
<a name="l00455"></a>00455 {
<a name="l00456"></a>00456 <span class="keyword">public</span>:
<a name="l00462"></a><a class="code" href="a00077.html#ae16b403d74737f765f802e025f9daa3a">00462</a>     <span class="keyword">inline</span> <a class="code" href="a00077.html" title="Class to access a named mapped segment published from another process.">mapped_view</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name) : 
<a name="l00463"></a>00463         <a class="code" href="a00078.html" title="Construct or access a named section of memory.">MappedMemory</a>(name) {};
<a name="l00464"></a>00464     
<a name="l00470"></a><a class="code" href="a00077.html#a508cb83d181e62551f8f1113c8750f30">00470</a>     <span class="keyword">inline</span> <span class="keyword">volatile</span> <span class="keyword">const</span> T *operator()(<span class="keywordtype">unsigned</span> member)
<a name="l00471"></a>00471         {<span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><span class="keyword">const </span>T*<span class="keyword">&gt;</span>(offset(member * <span class="keyword">sizeof</span>(T)));}
<a name="l00472"></a>00472     
<a name="l00478"></a><a class="code" href="a00077.html#aa33c0c9930c82f549bc096e85c59c3d1">00478</a>     <span class="keyword">inline</span> <span class="keyword">volatile</span> <span class="keyword">const</span> T &amp;operator[](<span class="keywordtype">unsigned</span> member)
<a name="l00479"></a>00479         {<span class="keywordflow">return</span> *(operator()(member));};
<a name="l00480"></a>00480 
<a name="l00485"></a><a class="code" href="a00077.html#a865b3e4aff6956ff94a2aa7029fafd0b">00485</a>     <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getCount(<span class="keywordtype">void</span>)
<a name="l00486"></a>00486         {<span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span>)(size / <span class="keyword">sizeof</span>(T));};
<a name="l00487"></a>00487 };
<a name="l00488"></a>00488 
<a name="l00489"></a>00489 END_NAMESPACE
<a name="l00490"></a>00490 
<a name="l00491"></a>00491 <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>