⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tp_reactor.spl

📁 最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.
💻 SPL
字号:
<?xml version="1.0"?>

<!--  Thread Pool Reactor Specializations:
 *  ======================================
 *  Thread Pool reactor is a variation of the Select Reactor.
 *  This specialization includes all of the specializations
 *  that are present in Select_Reactor.spl
 *
 *  @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
 *  $Id: TP_Reactor.spl 80826 2008-03-04 14:51:23Z wotte $
-->

<transform>

<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>

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

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

<add>
 <hook>REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook>
 <data>
//--- How can we devirtualize these methods?
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>

<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>
</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>

<!-- 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>

<!-- Starting below is the specialization for TP_Reactor -->

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

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

<!-- Remove all occurences of the word virtual -->
<remove>virtual</remove>

<!-- 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>

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

</file>

<file name="Reactor.cpp">

<!-- Replace ACE_Reactor_Impl with ACE_TP_Reactor -->
<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

<!-- 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>

<!-- Add the TP_Reactor include file -->
<add>
  <hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</hook>
  <data>#include "ace/TP_Reactor.h"</data>
</add>

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

</file>

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

<!-- Remove all occurances of virtual -->
<remove>virtual</remove>

</file>

<!-- Transformations to TP_Reactor.cpp -->
<file name="TP_Reactor.cpp">

<!-- Comment hook -->
<comment>
 <start-hook>REACTOR_SPL_COMMENT_HOOK_START</start-hook>
 <end-hook>REACTOR_SPL_COMMENT_HOOK_END</end-hook>
</comment>

<!-- Add this function to the -->
<add>
  <hook>REACTOR_SPL_COMMENT_HOOK_END</hook>
  <data>
int
ACE_TP_Reactor::register_handler (int signum,
                                  ACE_Event_Handler *new_sh,
                                  ACE_Sig_Action *new_disp,
                                  ACE_Event_Handler **old_sh,
                                  ACE_Sig_Action *old_disp)
{
  return ACE_Select_Reactor::register_handler (signum,
                                               new_sh,
                                               new_disp,
                                               old_sh,
                                               old_disp);
}
  </data>
</add>

</file>

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

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

<substitute>
 <search>ACE_Select_Reactor</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

<!-- Add the TP_Reactor which is the concrete reactor -->
<add>
 <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
 <data>#include "ace/TP_Reactor.h"</data>
</add>

</file>

<file name="ace.mpc">

<!-- 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 Msg_WFMO_Reactor -->
<substitute>
  <search>Msg_WFMO_Reactor.cpp</search>
  <replace>// Msg_WFMO_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>
<!-- end of Changes to ace -->

<!-- Transformations to TAO module -->
<module name="TAO/tao">

<file name="default_resource.h">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

</file>

<file name="default_resource.cpp">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

</file>

<file name="GUIResource_Factory.cpp">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

</file>

<file name="GUIResource_Factory.h">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</replace>
</substitute>

</file>

</module>

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

<file name="advanced_resource.h">

<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_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/Select_Reactor.h"</remove> -->
<remove>#include "ace/Msg_WFMO_Reactor.h"</remove>

<!-- Substitute ACE_Reactor_Impl with ACE_TP_Reactor -->
<substitute>
 <search>ACE_Reactor_Impl</search>
 <replace>ACE_TP_Reactor</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,
                      ACE_TP_Reactor (ACE::max_handles (),
                                      1,
                                      (ACE_Sig_Handler*)0,
                                      (ACE_Timer_Queue*)0,
                                      this->reactor_mask_signals_,
                                      ACE_Select_Reactor_Token::LIFO),
                       0);
  </data>
</add>

</file>

</module>

</transform>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -