summaryrefslogtreecommitdiff
path: root/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_ST.spl
blob: 145136455a28cf432442455c37c814b23894184c (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
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<?xml version="1.0"?>

<!-- Select Reactor Specializations:
 *   ===============================
 *   Details all the specialization transformations necessary
 *   to specialize the Reactor framework when the target reactor
 *   is a select reactor.
 *
 *   @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
 *   $Id$
-->

<transform>

<!-- Define the module where there are multiple files -->
<module name="ace">

<!-- File where the transformations happen -->
<file name="Select_Reactor_Base.h">

<!-- Add the following lines based on a hook -->
<add>
  <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
  <data>class ACE_Sig_Handler;</data>
  <data>class ACE_Sig_Action;</data>
  <data>class ACE_Sig_Set;</data>
</add>

<add>
 <hook>REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook>
 <data>
//These methods needs to be virtual as they are used by
//Select_Reactor_Notify classes which use the base class
virtual ~ACE_Select_Reactor_Impl () {}

virtual int notify (ACE_Event_Handler *event_handler = 0,
                    ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
                    ACE_Time_Value * = 0) =0;

virtual int remove_handler (ACE_Event_Handler *eh,
                            ACE_Reactor_Mask mask) =0;

virtual int register_handler (ACE_HANDLE handle,
                              ACE_Event_Handler *eh,
                              ACE_Reactor_Mask mask) =0;
  </data>
</add>

<!-- Remove what ever is present in the tag from the file -->
<remove>virtual</remove>
<remove>: public ACE_Reactor_Impl</remove>
<remove>#include "ace/Reactor_Impl.h"</remove>

<!-- Replace a with b -->
<substitute>
  <search>public ACE_Reactor_Notify</search>
  <replace>public ACE_Event_Handler</replace>
</substitute>

<!-- Replace the generic versions with the Select specialized versions -->
<substitute>
  <search>ACE_Reactor_Notify</search>
  <replace>ACE_Select_Reactor_Notify</replace>
</substitute>

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor_Impl</replace>
</substitute>

<!-- After the specialization, the following functions are still virtual -->
<substitute>
 <search>void renew</search>
 <replace>virtual void renew</replace>
</substitute>
<substitute>
 <search>int is_suspended_i</search>
 <replace>virtual int is_suspended_i</replace>
</substitute>
<substitute>
 <search>void clear_dispatch_mask</search>
 <replace>virtual void clear_dispatch_mask</replace>
</substitute>

</file>

<file name="Select_Reactor_Base.cpp">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor_Impl</replace>
</substitute>

</file>

<file name="Select_Reactor_Base.inl">

<remove>#include "ace/Reactor.h"</remove>

</file>

<file name="Select_Reactor_T.h">

<add>
<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>class ACE_Sig_Handler;</data>
<data>class ACE_Sig_Action;</data>
<data>class ACE_Sig_Set;</data>
</add>

<substitute>
 <search>ACE_Reactor_Notify</search>
 <replace>ACE_Select_Reactor_Notify</replace>
</substitute>

<remove>virtual</remove>

</file>

<file name="Select_Reactor_T.cpp">

<add>
 <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
 <data>#include "ace/Countdown_Time.h"</data>
</add>

<substitute>
  <search>ACE_Reactor_Notify</search>
  <replace>ACE_Select_Reactor_Notify</replace>
</substitute>

</file>

<!-- 
<file name="Select_Reactor_T.inl">

<remove>#include "ace/Reactor.h"</remove>

</file>
-->

<!-- Transformations to Reactor_Token_T.h -->
<file name="Reactor_Token_T.h">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor_Impl</replace>
</substitute>

<substitute match-line="yes">
 <search>#include "ace/Reactor_Impl.h"</search>
 <replace>#include "ace/Select_Reactor_Base.h"</replace>
</substitute>

</file>

<file name="Reactor_Token_T.cpp">

<!-- Search for ACE_Reactor_Impl and replace it with
     ACE_Select_Reactor_Impl -->
<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor_Impl</replace>
</substitute>

</file>

<file name="Reactor.h">

<add>
<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>#include "ace/Select_Reactor.h"</data>
</add>

<remove>class ACE_Reactor_Impl;</remove>
<remove>virtual</remove>

<substitute>
<search>ACE_Reactor_Impl</search>
<replace>ACE_Select_Reactor</replace>
</substitute>

<!-- Remove the Reactor_Timer interface include -->
<remove>: public ACE_Reactor_Timer_Interface</remove>
<remove>#include "ace/Reactor_Timer_Interface.h"</remove>

</file>

<file name="Event_Handler.h">

<!-- remove the ACE_Event_Handler forware declaration -->
<remove>class ACE_Reactor_Timer_Interface;</remove>

<!-- substitute ACE_Reactor_Timer operations with ACE_Reactor -->
<substitute>
 <search>ACE_Reactor_Timer_Interface</search>
 <replace>ACE_Reactor</replace>
</substitute>
</file>

<file name="Event_Handler.cpp">
 <substitute>
  <search>ACE_Reactor_Timer_Interface</search>
  <replace>ACE_Reactor</replace>
 </substitute>
</file>

<file name="Timer_Queue_T.cpp">

<!-- Remove the Reactor_Timer_Interface include -->
<remove>#include "ace/Reactor_Timer_Interface.h"</remove>

</file>

<file name="Reactor.cpp">

<!-- Comment the conditional includes in the file -->
<comment>
 <start-hook>REACTOR_SPL_COMMENT_INCLUDE_START_HOOK</start-hook>
 <end-hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</end-hook>
</comment>

<!-- Comment out conditional includes files in the Reactor's
     constructor
-->
<comment>
  <start-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START</start-hook>
  <end-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</end-hook>
</comment>

<!-- Within the constructor now create the right Reactor -->
<add>
 <hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</hook>
 <data>
    ACE_NEW (impl,
             ACE_Select_Reactor);
 </data>
</add>

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor</replace>
</substitute>

</file>

<file name="Reactor.inl">

<add>
 <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
 <data>
// Check if this is necessary
#include "ace/Select_Reactor.h"
 </data>
</add>

</file>

<file name="Select_Reactor.h">

<!-- comment out the lock based select reactor, which is a select_mt -->
<comment>
  <start-hook>TAO_REACTOR_SPL_COMMENT_HOOK_START</start-hook>
  <end-hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</end-hook>
</comment>

<add>
  <hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</hook>
  <data>
  typedef ACE_Select_Reactor_T &lt;ACE_Reactor_Token_T &lt; ACE_Noop_Token &gt; &gt; ACE_Select_Reactor;
  </data>
</add>
</file>

<!-- Do not build the other reactors than the Select Reactor! -->
<file name="ace.mpc">

<!-- Here is where regular expressions can come handy. Such
     a capability is not currently provided
 -->
<substitute>
  <search>TP_Reactor.h</search>
  <replace>// TP_Reactor.h </replace>
</substitute>
<substitute>
  <search>TP_Reactor.cpp</search>
  <replace>// TP_Reactor.cpp</replace>
</substitute>

<!-- Do not build the Msg_WFMO_Reactor -->
<substitute>
  <search>Msg_WFMO_Reactor.cpp</search>
  <replace>// Msg_WFMO_Reactor.cpp</replace>
</substitute>

<!-- Do not build the WFMO Reactor -->
<substitute>
  <search>WFMO_Reactor.cpp</search>
  <replace>// WFMO_Reactor.cpp</replace>
</substitute>

<!-- Do not build the Reactor Impl -->
<substitute>
  <search>Reactor_Impl.cpp</search>
  <replace>// Reactor_Impl.cpp</replace>
</substitute>
<substitute>
  <search>Reactor_Impl.h</search>
  <replace>// Reactor_Impl.h</replace>
</substitute>

<!-- Do not build the Dev Poll Reactor -->
<substitute>
  <search>Dev_Poll_Reactor.cpp</search>
  <replace>// Dev_Poll_Reactor.cpp</replace>
</substitute>

<!-- Do not build the priority Reactor -->
<substitute>
  <search>Priority_Reactor.cpp</search>
  <replace>// Priority_Reactor.cpp</replace>
</substitute>

<!-- Do not build the Reactor_Timer_Interface -->
<substitute>
 <search>Reactor_Timer_Interface.h</search>
 <replace>// Reactor_Timer_Interface.h</replace>
</substitute>
<substitute>
 <search>Reactor_Timer_Interface.cpp</search>
 <replace>// Reactor_Timer_Interface.cpp </replace>
</substitute>

</file>

</module>

<!-- transformations required in TAO to work with a select reactor -->
<module name="TAO/tao">

<!-- Changes to default_resource.h -->
<file name="default_resource.h">

<!-- Remove the forward declaration of ACE_Reactor_Impl -->
<substitute match-line="yes">
<search>class ACE_Reactor_Impl;</search>
<replace>#include "ace/Reactor.h"</replace>
</substitute>

<!-- Replace all occurences of ACE_Reactor_Impl with
     ACE_Select_Reactor -->
<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor</replace>
</substitute>

</file>

<!-- Changes to default_resource.cpp -->
<file name="default_resource.cpp">

<!-- Remove the occurence of TP_Reactor -->
<remove>#include "ace/TP_Reactor.h"</remove>

<!-- Replace all occurences of ACE_Reactor_Impl with
     ACE_Select_Reactor -->
<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_Select_Reactor</replace>
</substitute>

<!-- Comment out the code that creates TP_Reactor -->
<comment>
 <start-hook>TAO_REACTOR_SPL_COMMENT_HOOK_START</start-hook>
 <end-hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</end-hook>
</comment>

<!-- Add hook to add code that creates the select reactor
     component -->
<add>
 <!-- We use the same hook that signifies where the comment code
      ended to add the concrete Reactor type -->
 <hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</hook>
 <data>
  ACE_NEW_RETURN (impl,
                  TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0,
                                         (ACE_Timer_Queue*)0,
                                         0,
                                         (ACE_Select_Reactor_Notify*)0,
                                         this->reactor_mask_signals_),
                  0);
 </data>
</add>
</file>

<!-- changes to tao.mpc -->
<file name="tao.mpc">
 <substitute>
  <search>GUIResource_Factory.cpp</search>
  <replace>// GUIResource_Factory.cpp</replace>
 </substitute>
 <substitute>
  <search>GUIResource_Factory.h</search>
  <replace>// GUIResource_Factory.h</replace>
 </substitute>
</file>

</module>

<module name="TAO/tao/Strategies">

<file name="advanced_resource.h">

<!-- Replace all occurances of ACE_Reactor_Impl with
     Select_Reactor
  -->
<substitute>
  <search>ACE_Reactor_Impl</search>
  <replace>ACE_Select_Reactor</replace>
</substitute>

</file>

<file name="advanced_resource.cpp">

<!-- Comment out all other reactor includes -->
<remove>#include "ace/FlReactor.h"</remove>
<remove>#include "ace/TkReactor.h"</remove>
<remove>#include "ace/WFMO_Reactor.h"</remove>
<remove>#include "ace/TP_Reactor.h"</remove>
<remove>#include "ace/Msg_WFMO_Reactor.h"</remove>

<substitute>
  <search>ACE_Reactor_Impl</search>
  <replace>ACE_Select_Reactor</replace>
</substitute>

<!-- Replace Select_Reactor.h with Reactor.h -->
<substitute>
 <search>ace/Select_Reactor.h</search>
 <replace>ace/Reactor.h</replace>
</substitute>

<!-- Comment out creation code for all other reactors -->
<comment>
 <start-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START</start-hook>
 <end-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</end-hook>
</comment>

<!-- Use the end hook to insert code that will create right reactor -->
<add>
  <hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</hook>
  <data>
     ACE_NEW_RETURN (impl,
                     TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0,
                                            (ACE_Timer_Queue*)0,
                                             0,
                                            (ACE_Select_Reactor_Notify*)0,
                                            this->reactor_mask_signals_),
                      0);
  </data>
</add>

</file>

</module>

</transform>