aboutsummaryrefslogtreecommitdiff
path: root/doc/oscl_html/oscl__error_8h_source.html
blob: 90e2660002446a180e15584243b1f3ccf186f332 (plain)
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
<!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>oscl: oscl_error.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="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</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>
    </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>oscl_error.h</h1><a href="oscl__error_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- c++ -*-</span>
<a name="l00002"></a>00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 <span class="comment">//               O S C L _ E R R O R</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
<a name="l00007"></a>00007 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef OSCL_ERROR_H_INCLUDED</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_ERROR_H_INCLUDED</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef OSCL_HEAPBASE_H_INCLUDED</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__heapbase_8h.html" title="OSCL Heap Base include file.">oscl_heapbase.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#endif</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef OSCL_DEFALLOC_H_INCLUDED</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__defalloc_8h.html" title="The file defines simple default memory allocator classes. These allocators are used...">oscl_defalloc.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#endif</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#ifndef OSCL_ERROR_CODES_H_INCLUDED</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__error__codes_8h.html" title="Defines basic error and leave codes.">oscl_error_codes.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#endif</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00036"></a>00036 <span class="keyword">class </span><a class="code" href="classOsclErrorTrapImp.html">OsclErrorTrapImp</a>;
<a name="l00037"></a><a class="code" href="classOsclErrorTrap.html">00037</a> <span class="keyword">class </span><a class="code" href="classOsclErrorTrap.html">OsclErrorTrap</a>
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039     <span class="keyword">public</span>:
<a name="l00047"></a>00047         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> int32 <a class="code" href="classOsclErrorTrap.html#aac4335d5ad09084f8e3bc0afeb89b99d">Init</a>(<a class="code" href="classOscl__DefAlloc.html">Oscl_DefAlloc</a> *aAlloc = <a class="code" href="group__osclbase.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="The NULL_TERM_CHAR is used to terminate c-style strings.">NULL</a>);
<a name="l00053"></a>00053         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> int32 <a class="code" href="classOsclErrorTrap.html#a82dfa0158b111d45e44088dd68ce344a">Cleanup</a>();
<a name="l00058"></a>00058         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <a class="code" href="classOsclErrorTrapImp.html">OsclErrorTrapImp</a>* <a class="code" href="classOsclErrorTrap.html#a8b918988ea9562ad968e1d07da1c82e5">GetErrorTrapImp</a>();
<a name="l00059"></a>00059 };
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 
<a name="l00065"></a><a class="code" href="classOsclError.html">00065</a> <span class="keyword">class </span><a class="code" href="classOsclError.html">OsclError</a>
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067     <span class="keyword">public</span>:
<a name="l00074"></a>00074         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#aa0d9d84289548fdef477f696cd9cc1da">PushL</a>(<a class="code" href="class__OsclHeapBase.html">_OsclHeapBase</a> * aPtr);
<a name="l00075"></a>00075 
<a name="l00078"></a>00078         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#aa0d9d84289548fdef477f696cd9cc1da">PushL</a>(<a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* aPtr);
<a name="l00079"></a>00079 
<a name="l00082"></a>00082         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#aa0d9d84289548fdef477f696cd9cc1da">PushL</a>(<a class="code" href="classOsclTrapItem.html">OsclTrapItem</a> anItem);
<a name="l00083"></a>00083 
<a name="l00086"></a>00086         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#a65e6df30d79da9f782563b746c9c2998">Pop</a>();
<a name="l00087"></a>00087 
<a name="l00090"></a>00090         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#a65e6df30d79da9f782563b746c9c2998">Pop</a>(int32 aCount);
<a name="l00091"></a>00091 
<a name="l00095"></a>00095         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#a2247984e17aedfdf9f31915f557c1b21">PopDealloc</a>();
<a name="l00096"></a>00096 
<a name="l00099"></a>00099         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#a2247984e17aedfdf9f31915f557c1b21">PopDealloc</a>(int32 aCount);
<a name="l00100"></a>00100 
<a name="l00106"></a>00106         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">Leave</a>(int32 aReason);
<a name="l00107"></a>00107 
<a name="l00111"></a>00111         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#aca9829cfcc11ff580338353602c38e0d">LeaveIfNull</a>(<a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a> *a);
<a name="l00112"></a>00112 
<a name="l00117"></a>00117         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclError.html#aeb9445d2343978b4ee741cc05f72e49c">LeaveIfError</a>(int32 aReason);
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 };
<a name="l00120"></a>00120 
<a name="l00123"></a><a class="code" href="group__osclerror.html#gae01170db0d7fb3487e9c5a0f1b3eaf1e">00123</a> <span class="preprocessor">#define OSCL_TRAPSTACK_PUSH(a) OsclError::PushL(a)</span>
<a name="l00124"></a><a class="code" href="group__osclerror.html#gab6585cdd87919a26ee1b278e7460e366">00124</a> <span class="preprocessor"></span><span class="preprocessor">#define OSCL_TRAPSTACK_POP() OsclError::Pop()</span>
<a name="l00125"></a><a class="code" href="group__osclerror.html#ga1da933ef82ad4db0b09c073b003867b9">00125</a> <span class="preprocessor"></span><span class="preprocessor">#define OSCL_TRAPSTACK_POPDEALLOC() OsclError::PopDealloc()</span>
<a name="l00126"></a>00126 <span class="preprocessor"></span>
<a name="l00131"></a>00131 <span class="comment">//Map TPVBaseErrorEnum return codes to Oscl Error leave codes</span>
<a name="l00132"></a>00132 <span class="comment">//Some of these codes indicate failure to init Oscl layer, in</span>
<a name="l00133"></a>00133 <span class="comment">//that case they map to zero and assert.</span>
<a name="l00134"></a>00134 <span class="keyword">static</span> <span class="keyword">const</span> int32 _OsclBaseToErrorMap[] =
<a name="l00135"></a>00135 {
<a name="l00136"></a>00136     <span class="comment">/*0*/</span><a class="code" href="group__osclerror.html#ga96f5e301fd9e1950323f679e44a9ee29">OsclErrGeneral</a>
<a name="l00137"></a>00137     ,<span class="comment">/*EPVErrorBaseNotInstalled=1*/</span>0
<a name="l00138"></a>00138     ,<span class="comment">/*EPVErrorBaseAlreadyInstalled=2*/</span><a class="code" href="group__osclerror.html#ga6197024068672f31bd905f884c90b159">OsclErrAlreadyInstalled</a>
<a name="l00139"></a>00139     ,<span class="comment">/*EPVErrorBaseOutOfMemory=3*/</span><a class="code" href="group__osclerror.html#gab097a121e7d86a999ae6a0e2576d95bb">OsclErrNoMemory</a>
<a name="l00140"></a>00140     ,<span class="comment">/*EPVErrorBaseSystemCallFailed=4*/</span><a class="code" href="group__osclerror.html#ga4fbcef840a5ac11610de69d04092022d">OsclErrSystemCallFailed</a>
<a name="l00141"></a>00141     ,<span class="comment">/*EPVErrorBaseTooManyThreads=5*/</span>0
<a name="l00142"></a>00142     ,<span class="comment">/*EPVErrorBaseNotSupported=6*/</span><a class="code" href="group__osclerror.html#gaad4b3499e8844b020d22b8b6fa00e4e1">OsclErrNotSupported</a>
<a name="l00143"></a>00143     ,<span class="comment">/*EPVErrorBaseNotReady=7*/</span><a class="code" href="group__osclerror.html#gae1b3db9a6efb21c63e16340de156ddd3">OsclErrNotReady</a>
<a name="l00144"></a>00144 };
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 <span class="preprocessor">#include &quot;<a class="code" href="oscl__singleton_8h.html" title="This file defines the OsclSingleton class. This class provides a container which...">oscl_singleton.h</a>&quot;</span>
<a name="l00147"></a>00147 <span class="preprocessor">#include &quot;<a class="code" href="oscl__assert_8h.html" title="The file oscl_assert.h provides an OSCL_ASSERT macro to document assumptions and...">oscl_assert.h</a>&quot;</span>
<a name="l00148"></a>00148 <span class="preprocessor">#if(OSCL_HAS_SINGLETON_SUPPORT)</span>
<a name="l00149"></a><a class="code" href="classOsclSingletonRegistryEx.html">00149</a> <span class="preprocessor"></span><span class="keyword">class </span><a class="code" href="classOsclSingletonRegistryEx.html">OsclSingletonRegistryEx</a>
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151     <span class="keyword">public</span>:
<a name="l00152"></a>00152         <span class="comment">/*</span>
<a name="l00153"></a>00153 <span class="comment">        ** Get an entry</span>
<a name="l00154"></a>00154 <span class="comment">        ** @param ID: identifier</span>
<a name="l00155"></a>00155 <span class="comment">        ** @returns: the entry value</span>
<a name="l00156"></a>00156 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00157"></a>00157 <span class="comment">        */</span>
<a name="l00158"></a><a class="code" href="classOsclSingletonRegistryEx.html#a375b73faf698e9ba82b8682a3784ae0a">00158</a>         <span class="keyword">static</span> <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* <a class="code" href="classOsclSingletonRegistryEx.html#a375b73faf698e9ba82b8682a3784ae0a">getInstance</a>(uint32 ID)
<a name="l00159"></a>00159         {
<a name="l00160"></a>00160             int32 error;
<a name="l00161"></a>00161             <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* val = <a class="code" href="classOsclSingletonRegistryEx.html#a375b73faf698e9ba82b8682a3784ae0a">OsclSingletonRegistry::getInstance</a>(ID, error);
<a name="l00162"></a>00162             <span class="keywordflow">if</span> (error)
<a name="l00163"></a>00163             {
<a name="l00164"></a>00164                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00165"></a>00165                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00166"></a>00166             }
<a name="l00167"></a>00167             <span class="keywordflow">return</span> val;
<a name="l00168"></a>00168         }
<a name="l00169"></a>00169 
<a name="l00170"></a>00170         <span class="comment">/*</span>
<a name="l00171"></a>00171 <span class="comment">        ** Set an entry</span>
<a name="l00172"></a>00172 <span class="comment">        ** @param ID: identifier</span>
<a name="l00173"></a>00173 <span class="comment">        ** @returns: the entry value</span>
<a name="l00174"></a>00174 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00175"></a>00175 <span class="comment">        */</span>
<a name="l00176"></a><a class="code" href="classOsclSingletonRegistryEx.html#ae1243cbd8f7b5f2ea80aba148aed66c6">00176</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclSingletonRegistryEx.html#ae1243cbd8f7b5f2ea80aba148aed66c6">registerInstance</a>(<a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* ptr, uint32 ID)
<a name="l00177"></a>00177         {
<a name="l00178"></a>00178             int32 error;
<a name="l00179"></a>00179             <a class="code" href="classOsclSingletonRegistryEx.html#ae1243cbd8f7b5f2ea80aba148aed66c6">OsclSingletonRegistry::registerInstance</a>(ptr, ID, error);
<a name="l00180"></a>00180             <span class="keywordflow">if</span> (error)
<a name="l00181"></a>00181             {
<a name="l00182"></a>00182                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00183"></a>00183                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00184"></a>00184             }
<a name="l00185"></a>00185         }
<a name="l00186"></a>00186 
<a name="l00187"></a>00187         <span class="comment">/*</span>
<a name="l00188"></a>00188 <span class="comment">        //These two APIs can be used to do &quot;test and set&quot; operations on a singleton.</span>
<a name="l00189"></a>00189 <span class="comment">        //Be sure to always call both APIs to avoid deadlock.</span>
<a name="l00190"></a>00190 <span class="comment">        */</span>
<a name="l00191"></a>00191 
<a name="l00192"></a>00192         <span class="comment">/*</span>
<a name="l00193"></a>00193 <span class="comment">        * Return the current value of the singleton and leave the singleton table locked</span>
<a name="l00194"></a>00194 <span class="comment">        * on return.</span>
<a name="l00195"></a>00195 <span class="comment">        * @param ID the singleton ID</span>
<a name="l00196"></a>00196 <span class="comment">        * @returns the singleton value.</span>
<a name="l00197"></a>00197 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00198"></a>00198 <span class="comment">        */</span>
<a name="l00199"></a><a class="code" href="classOsclSingletonRegistryEx.html#aef4d941dfe0f6e61f0401559a1474988">00199</a>         <span class="keyword">static</span> <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* <a class="code" href="classOsclSingletonRegistryEx.html#aef4d941dfe0f6e61f0401559a1474988">lockAndGetInstance</a>(uint32 ID)
<a name="l00200"></a>00200         {
<a name="l00201"></a>00201             int32 error;
<a name="l00202"></a>00202             <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* val = <a class="code" href="classOsclSingletonRegistryEx.html#aef4d941dfe0f6e61f0401559a1474988">OsclSingletonRegistry::lockAndGetInstance</a>(ID, error);
<a name="l00203"></a>00203             <span class="keywordflow">if</span> (error)
<a name="l00204"></a>00204             {
<a name="l00205"></a>00205                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00206"></a>00206                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00207"></a>00207             }
<a name="l00208"></a>00208             <span class="keywordflow">return</span> val;
<a name="l00209"></a>00209         }
<a name="l00210"></a>00210 
<a name="l00211"></a>00211         <span class="comment">/*</span>
<a name="l00212"></a>00212 <span class="comment">        * Set the value of the singleton.  Assume the singleton table is locked on entry.</span>
<a name="l00213"></a>00213 <span class="comment">        * @param ptr the singleton value</span>
<a name="l00214"></a>00214 <span class="comment">        * @param ID the singleton ID</span>
<a name="l00215"></a>00215 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00216"></a>00216 <span class="comment">        */</span>
<a name="l00217"></a><a class="code" href="classOsclSingletonRegistryEx.html#a49b8815ea56392359e16f98dc73e5701">00217</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclSingletonRegistryEx.html#a49b8815ea56392359e16f98dc73e5701">registerInstanceAndUnlock</a>(<a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* ptr, uint32 ID)
<a name="l00218"></a>00218         {
<a name="l00219"></a>00219             int32 error;
<a name="l00220"></a>00220             <a class="code" href="classOsclSingletonRegistryEx.html#a49b8815ea56392359e16f98dc73e5701">OsclSingletonRegistry::registerInstanceAndUnlock</a>(ptr, ID, error);
<a name="l00221"></a>00221             <span class="keywordflow">if</span> (error)
<a name="l00222"></a>00222             {
<a name="l00223"></a>00223                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00224"></a>00224                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00225"></a>00225             }
<a name="l00226"></a>00226         }
<a name="l00227"></a>00227 };
<a name="l00228"></a>00228 
<a name="l00229"></a><a class="code" href="classOsclSingletonEx.html">00229</a> <span class="keyword">template</span> &lt; <span class="keyword">class</span> T, u<span class="keywordtype">int</span>32 ID, <span class="keyword">class</span> Registry = OsclSingletonRegistryEx &gt; <span class="keyword">class </span><a class="code" href="classOsclSingletonEx.html">OsclSingletonEx</a>
<a name="l00230"></a>00230 {
<a name="l00231"></a>00231     <span class="keyword">private</span>:
<a name="l00232"></a>00232         <span class="comment">// make the copy constructor and assignment operator private</span>
<a name="l00233"></a>00233         <a class="code" href="classOsclSingletonEx.html">OsclSingletonEx</a>&amp; operator=(<a class="code" href="classOsclSingletonEx.html">OsclSingletonEx</a>&amp; _Y)
<a name="l00234"></a>00234         {
<a name="l00235"></a>00235             <span class="keywordflow">return</span>(*<span class="keyword">this</span>);
<a name="l00236"></a>00236         }
<a name="l00237"></a>00237 
<a name="l00238"></a>00238     <span class="keyword">protected</span>:
<a name="l00239"></a><a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">00239</a>         T* <a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a>;
<a name="l00240"></a>00240 
<a name="l00241"></a>00241     <span class="keyword">public</span>:
<a name="l00242"></a><a class="code" href="classOsclSingletonEx.html#a370113bd96a6797a93e1d791aee082e2">00242</a>         <a class="code" href="classOsclSingletonEx.html#a370113bd96a6797a93e1d791aee082e2">OsclSingletonEx</a>(): <a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a>(<a class="code" href="group__osclbase.html#ga6872259ca6fd7080c6299210e4b13a6f">OSCL_STATIC_CAST</a>(T*, Registry::getInstance(ID))) {};
<a name="l00243"></a>00243 
<a name="l00244"></a><a class="code" href="classOsclSingletonEx.html#a6ef08a46232d594ce7ef1abeb71755ba">00244</a>         <a class="code" href="classOsclSingletonEx.html#a6ef08a46232d594ce7ef1abeb71755ba">~OsclSingletonEx</a>() {};
<a name="l00245"></a>00245 
<a name="l00253"></a><a class="code" href="classOsclSingletonEx.html#af9b2e60d6d9729cc648d0b7311910890">00253</a>         T&amp; <a class="code" href="classOsclSingletonEx.html#af9b2e60d6d9729cc648d0b7311910890" title="The indirection operator (*) accesses a value indirectly, through a pointer.">operator*</a>()<span class="keyword"> const</span>
<a name="l00254"></a>00254 <span class="keyword">        </span>{
<a name="l00255"></a>00255             <span class="keywordflow">return</span>(*<a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a>);
<a name="l00256"></a>00256         }
<a name="l00257"></a>00257 
<a name="l00265"></a><a class="code" href="classOsclSingletonEx.html#ad0dc76eeb132851b25658c92f708e632">00265</a>         T *<a class="code" href="classOsclSingletonEx.html#ad0dc76eeb132851b25658c92f708e632" title="The indirection operator (-&amp;gt;) accesses a value indirectly, through a pointer.">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00266"></a>00266 <span class="keyword">        </span>{
<a name="l00267"></a>00267             <span class="keywordflow">return</span>(<a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a>);
<a name="l00268"></a>00268         }
<a name="l00269"></a>00269 
<a name="l00270"></a>00270 
<a name="l00277"></a><a class="code" href="classOsclSingletonEx.html#a467fb4238112ea1cbfcf328b0ec97900">00277</a>         <span class="keywordtype">bool</span> <span class="keyword">set</span>()
<a name="l00278"></a>00278         {
<a name="l00279"></a>00279             <a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a> = <a class="code" href="group__osclbase.html#ga6872259ca6fd7080c6299210e4b13a6f">OSCL_STATIC_CAST</a>(T*, Registry::getInstance(ID));
<a name="l00280"></a>00280             <span class="keywordflow">return</span> (<a class="code" href="classOsclSingletonEx.html#aafb27e3135dedcd886770c7abbaeb182">_Ptr</a> ? <span class="keyword">true</span> : <span class="keyword">false</span>);
<a name="l00281"></a>00281         }
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 };
<a name="l00284"></a>00284 <span class="preprocessor">#endif //OSCL_HAS_SINGLETON_SUPPORT</span>
<a name="l00285"></a>00285 <span class="preprocessor"></span>
<a name="l00286"></a>00286 <span class="preprocessor">#include &quot;<a class="code" href="oscl__tls_8h.html">oscl_tls.h</a>&quot;</span>
<a name="l00287"></a>00287 <span class="preprocessor">#include &quot;<a class="code" href="oscl__assert_8h.html" title="The file oscl_assert.h provides an OSCL_ASSERT macro to document assumptions and...">oscl_assert.h</a>&quot;</span>
<a name="l00288"></a><a class="code" href="classOsclTLSRegistryEx.html">00288</a> <span class="keyword">class </span><a class="code" href="classOsclTLSRegistryEx.html">OsclTLSRegistryEx</a>
<a name="l00289"></a>00289 {
<a name="l00290"></a>00290     <span class="keyword">public</span>:
<a name="l00291"></a>00291         <span class="comment">/*</span>
<a name="l00292"></a>00292 <span class="comment">        ** Get an entry</span>
<a name="l00293"></a>00293 <span class="comment">        ** @param ID: identifier</span>
<a name="l00294"></a>00294 <span class="comment">        ** @returns: the entry value</span>
<a name="l00295"></a>00295 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00296"></a>00296 <span class="comment">        */</span>
<a name="l00297"></a><a class="code" href="classOsclTLSRegistryEx.html#a1e96771f68b6069f077654bd1d96c320">00297</a>         <span class="keyword">static</span> <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* <a class="code" href="classOsclTLSRegistryEx.html#a1e96771f68b6069f077654bd1d96c320">getInstance</a>(uint32 ID)
<a name="l00298"></a>00298         {
<a name="l00299"></a>00299             int32 error;
<a name="l00300"></a>00300             <a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* val = <a class="code" href="classOsclTLSRegistryEx.html#a1e96771f68b6069f077654bd1d96c320">OsclTLSRegistry::getInstance</a>(ID, error);
<a name="l00301"></a>00301             <span class="keywordflow">if</span> (error)
<a name="l00302"></a>00302             {
<a name="l00303"></a>00303                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00304"></a>00304                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00305"></a>00305             }
<a name="l00306"></a>00306             <span class="keywordflow">return</span> val;
<a name="l00307"></a>00307         }
<a name="l00308"></a>00308         <span class="comment">/*</span>
<a name="l00309"></a>00309 <span class="comment">        ** Set an entry</span>
<a name="l00310"></a>00310 <span class="comment">        ** @param ID: identifier</span>
<a name="l00311"></a>00311 <span class="comment">        ** @returns: the entry value</span>
<a name="l00312"></a>00312 <span class="comment">        ** @exception: leaves on error.</span>
<a name="l00313"></a>00313 <span class="comment">        */</span>
<a name="l00314"></a><a class="code" href="classOsclTLSRegistryEx.html#a525827ec760d20fd34f3ef3519ad1b0e">00314</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTLSRegistryEx.html#a525827ec760d20fd34f3ef3519ad1b0e">registerInstance</a>(<a class="code" href="group__osclbase.html#ga3bac54662348f5e6c08b97ca97066b89" title="The OsclAny is meant to be used the context of a generic pointer (i.e., no specific...">OsclAny</a>* ptr, uint32 ID)
<a name="l00315"></a>00315         {
<a name="l00316"></a>00316             int32 error;
<a name="l00317"></a>00317             <a class="code" href="classOsclTLSRegistryEx.html#a525827ec760d20fd34f3ef3519ad1b0e">OsclTLSRegistry::registerInstance</a>(ptr, ID, error);
<a name="l00318"></a>00318             <span class="keywordflow">if</span> (error)
<a name="l00319"></a>00319             {
<a name="l00320"></a>00320                 <a class="code" href="group__osclbase.html#gaf7c21e5b6e4fee4247225dd31f89c8ca">OSCL_ASSERT</a>(_OsclBaseToErrorMap[error]);
<a name="l00321"></a>00321                 <a class="code" href="classOsclError.html#a652293eaffb0691632c7b5e360a8e5f8">OsclError::Leave</a>(_OsclBaseToErrorMap[error]);
<a name="l00322"></a>00322             }
<a name="l00323"></a>00323         }
<a name="l00324"></a>00324 };
<a name="l00325"></a>00325 
<a name="l00326"></a><a class="code" href="classOsclTLSEx.html">00326</a> <span class="keyword">template</span> &lt; <span class="keyword">class</span> T, u<span class="keywordtype">int</span>32 ID, <span class="keyword">class</span> Registry = OsclTLSRegistryEx &gt; <span class="keyword">class </span><a class="code" href="classOsclTLSEx.html">OsclTLSEx</a>
<a name="l00327"></a>00327 {
<a name="l00328"></a>00328     <span class="keyword">private</span>:
<a name="l00329"></a>00329         <span class="comment">// make the copy constructor and assignment operator private</span>
<a name="l00330"></a>00330         <a class="code" href="classOsclTLSEx.html">OsclTLSEx</a>&amp; operator=(<a class="code" href="classOsclTLSEx.html">OsclTLSEx</a>&amp; _Y)
<a name="l00331"></a>00331         {
<a name="l00332"></a>00332             <span class="keywordflow">return</span>(*<span class="keyword">this</span>);
<a name="l00333"></a>00333         }
<a name="l00334"></a>00334 
<a name="l00335"></a>00335     <span class="keyword">protected</span>:
<a name="l00336"></a><a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">00336</a>         T* <a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a>;
<a name="l00337"></a>00337 
<a name="l00338"></a>00338     <span class="keyword">public</span>:
<a name="l00339"></a><a class="code" href="classOsclTLSEx.html#ae21a0aca64c4d1ac525b14fbd94d0856">00339</a>         <a class="code" href="classOsclTLSEx.html#ae21a0aca64c4d1ac525b14fbd94d0856">OsclTLSEx</a>(): <a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a>(<a class="code" href="group__osclbase.html#ga6872259ca6fd7080c6299210e4b13a6f">OSCL_STATIC_CAST</a>(T*, Registry::getInstance(ID))) {};
<a name="l00340"></a>00340 
<a name="l00341"></a><a class="code" href="classOsclTLSEx.html#a0f04a6a82261d5087851e2e2e1dabe41">00341</a>         <a class="code" href="classOsclTLSEx.html#a0f04a6a82261d5087851e2e2e1dabe41">~OsclTLSEx</a>() {};
<a name="l00342"></a>00342 
<a name="l00350"></a><a class="code" href="classOsclTLSEx.html#a1511d62ed7d57a020d4b45f820c6771f">00350</a>         T&amp; <a class="code" href="classOsclTLSEx.html#a1511d62ed7d57a020d4b45f820c6771f" title="The indirection operator (*) accesses a value indirectly, through a pointer.">operator*</a>()<span class="keyword"> const</span>
<a name="l00351"></a>00351 <span class="keyword">        </span>{
<a name="l00352"></a>00352             <span class="keywordflow">return</span>(*<a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a>);
<a name="l00353"></a>00353         }
<a name="l00354"></a>00354 
<a name="l00362"></a><a class="code" href="classOsclTLSEx.html#afd6a6f549d8b0b8bb813e02910d48383">00362</a>         T *<a class="code" href="classOsclTLSEx.html#afd6a6f549d8b0b8bb813e02910d48383" title="The indirection operator (-&amp;gt;) accesses a value indirectly, through a pointer.">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00363"></a>00363 <span class="keyword">        </span>{
<a name="l00364"></a>00364             <span class="keywordflow">return</span>(<a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a>);
<a name="l00365"></a>00365         }
<a name="l00366"></a>00366 
<a name="l00367"></a>00367 
<a name="l00374"></a><a class="code" href="classOsclTLSEx.html#ac45cbbc9ac06d533c77f71cccbdafb12">00374</a>         <span class="keywordtype">bool</span> <span class="keyword">set</span>()
<a name="l00375"></a>00375         {
<a name="l00376"></a>00376             <a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a> = <a class="code" href="group__osclbase.html#ga6872259ca6fd7080c6299210e4b13a6f">OSCL_STATIC_CAST</a>(T*, Registry::getInstance(ID));
<a name="l00377"></a>00377             <span class="keywordflow">return</span> (<a class="code" href="classOsclTLSEx.html#a934f6a221a789268257b02d1056f5b68">_Ptr</a> ? <span class="keyword">true</span> : <span class="keyword">false</span>);
<a name="l00378"></a>00378         }
<a name="l00379"></a>00379 
<a name="l00380"></a>00380 };
<a name="l00381"></a>00381 
<a name="l00382"></a>00382 <span class="preprocessor">#endif</span>
<a name="l00383"></a>00383 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: CORE_9.004.1.1 </small>
</small></address>
</body>
</html>