File: a00152.html

package info (click to toggle)
omnievents 2.6.1-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,228 kB
  • ctags: 2,538
  • sloc: cpp: 7,346; sh: 2,568; python: 2,171; xml: 2,057; java: 1,407; makefile: 304; ansic: 9
file content (363 lines) | stat: -rw-r--r-- 23,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>EventChannel.cc Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>EventChannel.cc</h1><a href="a00092.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">//                            Package   : omniEvents</font>
00002 <font class="comment">// EventChannel.cc            Created   : 2003/12/04</font>
00003 <font class="comment">//                            Author    : Alex Tingle</font>
00004 <font class="comment">//</font>
00005 <font class="comment">//    Copyright (C) 2003 Alex Tingle.</font>
00006 <font class="comment">//</font>
00007 <font class="comment">//    This file is part of the omniEvents application.</font>
00008 <font class="comment">//</font>
00009 <font class="comment">//    omniEvents is free software; you can redistribute it and/or</font>
00010 <font class="comment">//    modify it under the terms of the GNU Lesser General Public</font>
00011 <font class="comment">//    License as published by the Free Software Foundation; either</font>
00012 <font class="comment">//    version 2.1 of the License, or (at your option) any later version.</font>
00013 <font class="comment">//</font>
00014 <font class="comment">//    omniEvents is distributed in the hope that it will be useful,</font>
00015 <font class="comment">//    but WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00016 <font class="comment">//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</font>
00017 <font class="comment">//    Lesser General Public License for more details.</font>
00018 <font class="comment">//</font>
00019 <font class="comment">//    You should have received a copy of the GNU Lesser General Public</font>
00020 <font class="comment">//    License along with this library; if not, write to the Free Software</font>
00021 <font class="comment">//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</font>
00022 <font class="comment">//</font>
00023 
00024 <font class="preprocessor">#include "<a class="code" href="a00093.html">EventChannel.h</a>"</font>
00025 <font class="preprocessor">#include "<a class="code" href="a00084.html">ConsumerAdmin.h</a>"</font>
00026 <font class="preprocessor">#include "<a class="code" href="a00137.html">SupplierAdmin.h</a>"</font>
00027 <font class="preprocessor">#include "<a class="code" href="a00113.html">omniEventsLog.h</a>"</font>
00028 <font class="preprocessor">#include "<a class="code" href="a00115.html">Orb.h</a>"</font>
00029 
00030 <font class="preprocessor">#include &lt;list&gt;</font>
00031 
00032 <font class="keyword">namespace </font>OmniEvents {
00033 
00034 <font class="comment">// CORBA interface methods</font>
<a name="l00035"></a><a class="code" href="a00046.html#a0">00035</a> CosEventChannelAdmin::ConsumerAdmin_ptr EventChannel_i::for_consumers()
00036 {
00037   <font class="keywordflow">if</font>(!<a class="code" href="a00046.html#o2">_consumerAdmin</a> || <a class="code" href="a00046.html#o4">_shutdownRequested</a>)
00038       <font class="keywordflow">throw</font> CORBA::OBJECT_NOT_EXIST();
00039   <font class="keywordflow">return</font> <a class="code" href="a00046.html#o2">_consumerAdmin</a>-&gt;_this();
00040 }
00041 
00042 
<a name="l00043"></a><a class="code" href="a00046.html#a1">00043</a> CosEventChannelAdmin::SupplierAdmin_ptr EventChannel_i::for_suppliers()
00044 {
00045   <font class="keywordflow">if</font>(!<a class="code" href="a00046.html#o1">_supplierAdmin</a> || <a class="code" href="a00046.html#o4">_shutdownRequested</a>)
00046       <font class="keywordflow">throw</font> CORBA::OBJECT_NOT_EXIST();
00047   <font class="keywordflow">return</font> <a class="code" href="a00046.html#o1">_supplierAdmin</a>-&gt;_this();
00048 }
00049 
00050 
<a name="l00051"></a><a class="code" href="a00046.html#a2">00051</a> <font class="keywordtype">void</font> EventChannel_i::destroy()
00052 {
00053   <font class="keywordflow">if</font>(_shutdownRequested)
00054       <font class="keywordflow">throw</font> CORBA::OBJECT_NOT_EXIST();
00055 
00056   <font class="comment">// Send disconnect messages to connected clients.</font>
00057   <font class="comment">// (Admins might be NULL if destroy() is somehow called before activate.)</font>
00058   <font class="keywordflow">if</font>(_consumerAdmin)
00059      <a class="code" href="a00046.html#o2">_consumerAdmin</a>-&gt;<a class="code" href="a00043.html#a6">disconnect</a>();
00060   <font class="keywordflow">if</font>(_supplierAdmin)
00061      <a class="code" href="a00046.html#o1">_supplierAdmin</a>-&gt;<a class="code" href="a00076.html#a5">disconnect</a>();
00062   <font class="keywordflow">if</font>(_mapper)
00063      <a class="code" href="a00046.html#o6">_mapper</a>-&gt;<a class="code" href="a00054.html#a2">destroy</a>();
00064 
00065   <font class="comment">// Terminate the thread.</font>
00066   <a class="code" href="a00046.html#o4">_shutdownRequested</a>=<font class="keyword">true</font>;
00067   
00068   <font class="comment">//?? There is some danger that new connections will be established between now</font>
00069   <font class="comment">//?? and channel shutdown, These connections should be rejected.</font>
00070 }
00071 
00072 
<a name="l00073"></a><a class="code" href="a00046.html#a4">00073</a> EventChannel_i::EventChannel_i(<a class="code" href="a00048.html">EventChannelStore</a>* store)
00074 : <a class="code" href="a00073.html">Servant</a>(PortableServer::POA::_nil()),
00075   _eventChannelStore(store),
00076   _consumerAdmin(NULL),
00077   _supplierAdmin(NULL),
00078   _poaManager(),
00079   _shutdownRequested(false),
00080   _properties(),
00081   _mapper(NULL)
00082 {}
00083 
00084 
<a name="l00085"></a><a class="code" href="a00046.html#a6">00085</a> <font class="keywordtype">void</font> EventChannel_i::activate(
00086   <font class="keyword">const</font> <font class="keywordtype">char</font>*        channelName,
00087   <font class="keyword">const</font> <a class="code" href="a00060.html">PersistNode</a>* node
00088 )
00089 {
00090   <font class="comment">// The order of these various initialization methods is very important.</font>
00091   <font class="comment">// I've documented dependencies as 'REQUIRES' comments.</font>
00092 
00093   <a class="code" href="a00046.html#c1">createPoa</a>(channelName);
00094 
00095   <font class="keywordflow">if</font>(node)
00096       <a class="code" href="a00046.html#o5">_properties</a>.<a class="code" href="a00060.html#m1">_attr</a>=node-&gt;<a class="code" href="a00060.html#m1">_attr</a>;
00097 
00098   <font class="comment">// REQUIRES: _properties</font>
00099   <a class="code" href="a00046.html#o2">_consumerAdmin</a>=<font class="keyword">new</font> <a class="code" href="a00043.html">ConsumerAdmin_i</a>(*<font class="keyword">this</font>,<a class="code" href="a00073.html#n0">_poa</a>);
00100 
00101   <font class="comment">// REQUIRES: _consumerAdmin, _properties</font>
00102   <a class="code" href="a00046.html#o1">_supplierAdmin</a>=<font class="keyword">new</font> <a class="code" href="a00076.html">SupplierAdmin_i</a>(*<font class="keyword">this</font>,<a class="code" href="a00073.html#n0">_poa</a>);
00103 
00104   <font class="keywordflow">if</font>(node)
00105   {
00106     <a class="code" href="a00060.html">PersistNode</a>* saNode =node-&gt;<a class="code" href="a00060.html#a13">child</a>(<font class="stringliteral">"SupplierAdmin"</font>);
00107     <font class="keywordflow">if</font>(saNode)
00108         <a class="code" href="a00046.html#o1">_supplierAdmin</a>-&gt;<a class="code" href="a00076.html#a6">reincarnate</a>(*saNode);
00109 
00110     <a class="code" href="a00060.html">PersistNode</a>* caNode =node-&gt;<a class="code" href="a00060.html#a13">child</a>(<font class="stringliteral">"ConsumerAdmin"</font>);
00111     <font class="keywordflow">if</font>(caNode)
00112         <a class="code" href="a00046.html#o2">_consumerAdmin</a>-&gt;<a class="code" href="a00043.html#a7">reincarnate</a>(*caNode);
00113   }
00114 
00115   <a class="code" href="a00073.html#b1">activateObjectWithId</a>(<font class="stringliteral">"EventChannel"</font>);
00116 
00117   <font class="comment">// REQUIRES: activate() ...since it uses _this().</font>
00118   <a class="code" href="a00046.html#c0">setInsName</a>(<a class="code" href="a00046.html#o5">_properties</a>.<a class="code" href="a00060.html#a11">attrString</a>(<font class="stringliteral">"InsName"</font>));
00119 }
00120 
00121 
<a name="l00122"></a><a class="code" href="a00046.html#a5">00122</a> EventChannel_i::~EventChannel_i()
00123 {
00124   <font class="keywordflow">if</font>(CORBA::is_nil(<a class="code" href="a00073.html#n0">_poa</a>))
00125   {
00126     <a class="code" href="a00115.html#a2">DB</a>(20,<font class="stringliteral">"~EventChannel_i()"</font>)
00127   }
00128   <font class="keywordflow">else</font>
00129   {
00130     <a class="code" href="a00115.html#a2">DB</a>(20,<font class="stringliteral">"~EventChannel_i() - destroying POA"</font>)
00131     <font class="keywordflow">try</font> {
00132       <a class="code" href="a00073.html#n0">_poa</a>-&gt;destroy(
00133         CORBA::Boolean(1) <font class="comment">/* etherealize_objects */</font>,
00134         CORBA::Boolean(0) <font class="comment">/* wait_for_completion */</font>
00135       );
00136     }
00137     <font class="keywordflow">catch</font>(...) {
00138       <a class="code" href="a00115.html#a2">DB</a>(2,<font class="stringliteral">"~EventChannel_i() - ERROR destroying POA"</font>)
00139     }
00140     <a class="code" href="a00073.html#n0">_poa</a>=PortableServer::POA::_nil();
00141   }
00142 }
00143 
00144 
<a name="l00145"></a><a class="code" href="a00046.html#a7">00145</a> <font class="keywordtype">void</font> EventChannel_i::run(<font class="keywordtype">void</font>* arg)
00146 {
00147   <font class="comment">// Ensure that activate() is called before start()/run().</font>
00148   assert(!CORBA::is_nil(<a class="code" href="a00073.html#n0">_poa</a>));
00149 
00150   <font class="keywordflow">try</font>
00151   {
00152     <font class="comment">// Add this object to the store.</font>
00153     <font class="keywordflow">if</font>(_eventChannelStore)
00154     {
00155       <a class="code" href="a00046.html#o0">_eventChannelStore</a>-&gt;<a class="code" href="a00048.html#a2">insert</a>(<font class="keyword">this</font>);
00156       <a class="code" href="a00046.html#a9">output</a>(<a class="code" href="a00080.html">WriteLock</a>().os);
00157     }
00158 
00159     <font class="comment">// Process events until the channel is destroyed.</font>
00160     <a class="code" href="a00046.html#a8">mainLoop</a>();
00161 
00162     <font class="comment">// Remove this object from the store.</font>
00163     <font class="keywordflow">if</font>(_eventChannelStore)
00164     {
00165       <a class="code" href="a00046.html#o0">_eventChannelStore</a>-&gt;<a class="code" href="a00048.html#a3">erase</a>(<font class="keyword">this</font>);
00166       CORBA::String_var poaName =<a class="code" href="a00073.html#n0">_poa</a>-&gt;the_name();
00167       <a class="code" href="a00080.html">WriteLock</a> log;
00168       log.<a class="code" href="a00080.html#m0">os</a>&lt;&lt;<font class="stringliteral">"-ecf/"</font>&lt;&lt;poaName.in()&lt;&lt;<font class="charliteral">'\n'</font>;
00169     }
00170 
00171     <a class="code" href="a00073.html#n0">_poa</a>-&gt;destroy(
00172       CORBA::Boolean(1) <font class="comment">/* etherealize_objects */</font>,
00173       CORBA::Boolean(1) <font class="comment">/* wait_for_completion */</font>
00174     );
00175     <a class="code" href="a00046.html#o3">_poaManager</a>-&gt;deactivate(
00176       CORBA::Boolean(1) <font class="comment">/* etherealize_objects */</font>,
00177       CORBA::Boolean(1) <font class="comment">/* wait_for_completion */</font>
00178     );
00179     <a class="code" href="a00073.html#n0">_poa</a>=PortableServer::POA::_nil();
00180 
00181   }
00182   <font class="keywordflow">catch</font>(PortableServer::POAManager::AdapterInactive&amp; ex)
00183   {
00184     <a class="code" href="a00115.html#a2">DB</a>(0,<font class="stringliteral">"EventChannel_i::run() - POA deactivated from the outside."</font>)
00185     Orb::inst().reportObjectFailure(HERE,_this(),&amp;ex);
00186   }
00187   <font class="keywordflow">catch</font> (CORBA::Exception&amp; ex) {
00188     Orb::inst().reportObjectFailure(HERE,_this(),&amp;ex);
00189   }
00190   <font class="keywordflow">catch</font>(...)
00191   {
00192     Orb::inst().reportObjectFailure(HERE,_this(),NULL);
00193   }
00194 
00195   <font class="comment">// Thread now exits, and this object is deleted.</font>
00196   <font class="comment">// Contents are cleaned up by the destructor.</font>
00197 }
00198 
00199 
<a name="l00200"></a><a class="code" href="a00046.html#a8">00200</a> <font class="keywordtype">void</font> EventChannel_i::mainLoop()
00201 {
00202   <a class="code" href="a00046.html#o3">_poaManager</a>-&gt;activate();
00203   <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> localCyclePeriod_ns=<a class="code" href="a00046.html#a15">cyclePeriod_ns</a>();
00204   <font class="keywordflow">while</font>(!<a class="code" href="a00046.html#o4">_shutdownRequested</a>)
00205   {
00206     <font class="comment">//</font>
00207     <font class="comment">// TRANSFER PHASE - transfer events from SupplierAdmin to ConsumerAdmin.</font>
00208     <a class="code" href="a00046.html#o3">_poaManager</a>-&gt;hold_requests(CORBA::Boolean(1) <font class="comment">/* wait_for_completion */</font>);
00209 
00210     list&lt;CORBA::Any*&gt; events;
00211     <a class="code" href="a00046.html#o1">_supplierAdmin</a>-&gt;<a class="code" href="a00076.html#a4">collect</a>(events);
00212     <a class="code" href="a00046.html#o2">_consumerAdmin</a>-&gt;<a class="code" href="a00043.html#a4">send</a>(events);
00213     assert(events.empty());
00214 
00215     <a class="code" href="a00046.html#o3">_poaManager</a>-&gt;activate();
00216     
00217     <font class="comment">//</font>
00218     <font class="comment">// COMMUNICATION PHASE - talk with clients' suppliers &amp; consumers.</font>
00219     <font class="comment">// Note: On Linux the resolution of nanosleep is a huge 10ms.</font>
00220     omni_thread::sleep(0,localCyclePeriod_ns);
00221   }
00222 }
00223 
00224 
<a name="l00225"></a><a class="code" href="a00046.html#a9">00225</a> <font class="keywordtype">void</font> EventChannel_i::output(ostream&amp; os)
00226 {
00227   CORBA::String_var poaName =<a class="code" href="a00073.html#n0">_poa</a>-&gt;the_name();
00228   string name =string(<font class="stringliteral">"ecf/"</font>)+poaName.in();
00229   <a class="code" href="a00046.html#o5">_properties</a>.<a class="code" href="a00060.html#a3">output</a>(os,name);
00230   <font class="keywordflow">if</font>(_supplierAdmin)
00231      <a class="code" href="a00046.html#o1">_supplierAdmin</a>-&gt;<a class="code" href="a00076.html#a7">output</a>(os);
00232   <font class="keywordflow">if</font>(_consumerAdmin)
00233      <a class="code" href="a00046.html#o2">_consumerAdmin</a>-&gt;<a class="code" href="a00043.html#a8">output</a>(os);
00234 }
00235 
00236 
<a name="l00237"></a><a class="code" href="a00046.html#c0">00237</a> <font class="keywordtype">void</font> EventChannel_i::setInsName(<font class="keyword">const</font> string v)
00238 {
00239   <a class="code" href="a00054.html">Mapper</a>* newMapper =NULL;
00240   <font class="keywordflow">try</font>
00241   {
00242 
00243     <font class="comment">// If _insName is set, then create a mapper object to allow clients to</font>
00244     <font class="comment">// find this object with a `corbaloc' string.</font>
00245     <font class="keywordflow">if</font>(!v.empty())
00246     {
00247       <font class="comment">// !! Throws when there is already an object named 'v' in the INSPOA.</font>
00248       newMapper=<font class="keyword">new</font> <a class="code" href="a00054.html">Mapper</a>(v.c_str(),_this());
00249     }
00250     <font class="comment">// Deactivate the old _mapper object.</font>
00251     <font class="keywordflow">if</font>(_mapper)
00252        <a class="code" href="a00046.html#o6">_mapper</a>-&gt;<a class="code" href="a00054.html#a2">destroy</a>();
00253     <a class="code" href="a00046.html#o6">_mapper</a>=newMapper;
00254 
00255   }
00256   <font class="keywordflow">catch</font>(...)
00257   {
00258     <font class="comment">// Can't use an auto_ptr, because MS VC++ 6 has no auto_ptr::reset()</font>
00259     <font class="keyword">delete</font> newMapper;
00260     <font class="keywordflow">throw</font>;
00261   }
00262 }
00263 
00264 
<a name="l00265"></a><a class="code" href="a00046.html#c1">00265</a> <font class="keywordtype">void</font> EventChannel_i::createPoa(<font class="keyword">const</font> <font class="keywordtype">char</font>* channelName)
00266 {
00267   <font class="keyword">using</font> <font class="keyword">namespace </font>PortableServer;
00268   POA_ptr p=Orb::inst()._RootPOA.in();
00269   <font class="keywordflow">try</font>
00270   {
00271     <font class="comment">// POLICIES:</font>
00272     <font class="comment">//  Lifespan          =PERSISTENT             // we can persist</font>
00273     <font class="comment">//  Assignment        =USER_ID                // write our own oid</font>
00274     <font class="comment">//  Uniqueness        =[default] UNIQUE_ID    // one servant per object</font>
00275     <font class="comment">//  ImplicitActivation=[default] IMPLICIT_ACTIVATION // auto activation</font>
00276     <font class="comment">//  RequestProcessing =[default] USE_ACTIVE_OBJECT_MAP_ONLY</font>
00277     <font class="comment">//  ServantRetention  =[default] RETAIN       // stateless POA</font>
00278     <font class="comment">//  Thread            =SINGLE_THREAD_MODEL    // keep it simple</font>
00279 
00280     CORBA::PolicyList policies;
00281     policies.length(3);
00282     policies[0]=p-&gt;create_lifespan_policy(PERSISTENT);
00283     policies[1]=p-&gt;create_id_assignment_policy(USER_ID);
00284     policies[2]=p-&gt;create_thread_policy(SINGLE_THREAD_MODEL);
00285 
00286     <font class="comment">// Create a new POA (and new POAManager) for this channel.</font>
00287     <font class="comment">// The POAManager will be used for all of this channel's POAs.</font>
00288     <a class="code" href="a00073.html#n0">_poa</a>=p-&gt;create_POA(channelName,POAManager::_nil(),policies);
00289     <a class="code" href="a00046.html#o3">_poaManager</a>=<a class="code" href="a00073.html#n0">_poa</a>-&gt;the_POAManager();
00290   }
00291   <font class="keywordflow">catch</font>(POA::AdapterAlreadyExists&amp; ex) <font class="comment">// create_POA</font>
00292   {
00293     <a class="code" href="a00115.html#a2">DB</a>(0,<font class="stringliteral">"EventChannel_i::createPoa() - POA::AdapterAlreadyExists"</font>)
00294     <font class="keywordflow">throw</font>;
00295   }
00296   <font class="keywordflow">catch</font>(POA::InvalidPolicy&amp; ex) <font class="comment">// create_POA</font>
00297   {
00298     <a class="code" href="a00115.html#a2">DB</a>(0,<font class="stringliteral">"EventChannel_i::createPoa() - POA::InvalidPolicy: "</font>&lt;&lt;ex.index)
00299     <font class="keywordflow">throw</font>;
00300   }
00301 }
00302 
00303 
00304 <font class="comment">//</font>
00305 <font class="comment">// class EventChannelStore</font>
00306 <font class="comment">//</font>
00307 
00308 
<a name="l00309"></a><a class="code" href="a00048.html#a0">00309</a> EventChannelStore::EventChannelStore()
00310 :_channels(),_lock()
00311 {}
00312 
<a name="l00313"></a><a class="code" href="a00048.html#a1">00313</a> EventChannelStore::~EventChannelStore()
00314 {
00315   <font class="comment">// ?? IMPLEMENT ME</font>
00316 }
00317 
<a name="l00318"></a><a class="code" href="a00048.html#a2">00318</a> <font class="keywordtype">void</font> EventChannelStore::insert(<a class="code" href="a00046.html">EventChannel_i</a>* channel)
00319 {
00320   omni_mutex_lock l(<a class="code" href="a00048.html#o1">_lock</a>);
00321   <font class="keywordtype">bool</font> insertOK =<a class="code" href="a00048.html#o0">_channels</a>.insert(channel).second;
00322   <font class="keywordflow">if</font>(!insertOK)
00323       <a class="code" href="a00115.html#a2">DB</a>(2,<font class="stringliteral">"Attempted to store an EventChannel, when it is already stored."</font>);
00324 }
00325 
<a name="l00326"></a><a class="code" href="a00048.html#a3">00326</a> <font class="keywordtype">void</font> EventChannelStore::erase(<a class="code" href="a00046.html">EventChannel_i</a>* channel)
00327 {
00328   omni_mutex_lock l(<a class="code" href="a00048.html#o1">_lock</a>);
00329   set&lt;EventChannel_i*&gt;::iterator pos =<a class="code" href="a00048.html#o0">_channels</a>.find(channel);
00330   <font class="keywordflow">if</font>(pos==<a class="code" href="a00048.html#o0">_channels</a>.end())
00331       <a class="code" href="a00115.html#a2">DB</a>(2,<font class="stringliteral">"Failed to erase unknown EventChannel."</font>)
00332   <font class="keywordflow">else</font>
00333       <a class="code" href="a00048.html#o0">_channels</a>.erase(pos);
00334 }
00335 
<a name="l00336"></a><a class="code" href="a00048.html#a4">00336</a> <font class="keywordtype">void</font> EventChannelStore::output(ostream &amp;os)
00337 {
00338   omni_mutex_lock l(<a class="code" href="a00048.html#o1">_lock</a>);
00339   <font class="keywordflow">for</font>(set&lt;EventChannel_i*&gt;::iterator i=<a class="code" href="a00048.html#o0">_channels</a>.begin();
00340       i!=<a class="code" href="a00048.html#o0">_channels</a>.end();
00341       ++i)
00342   {
00343     (*i)-&gt;output(os);
00344   }
00345 }
00346 
00347 
00348 }; <font class="comment">// end namespace OmniEvents</font>
00349 
</pre></div><hr><address align="right"><small>Generated on Fri Nov 19 17:42:20 2004 for OmniEvents by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>