<?xml version="1.0"?>

<!-- Leader Follower Flushing Strategy Specializations
 *   =================================================
 *   Details all the specialization transformations necessary
 *   to specialize the Flushing Strategy with the concrete
 *   Leader_Follower flushing strategy.
 *
 *   @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
-->

<transform>

<module name="TAO/tao">

<!-- Transformations to L/F Flushing Strategy -->
<file name="Leader_Follower_Flushing_Strategy.h">

<!-- Comment out Flushing_Strategy include -->
<remove>#include "Flushing_Strategy.h"</remove>

<!-- Add the forward declarations -->
<add>
 <hook>FLUSHING_STRATEGY_SPL_INCLUDE_ADD_HOOK</hook>
 <data>
class TAO_Transport;
class TAO_Queued_Message;
class ACE_Time_Value;

#include "TAO_Export.h"
 </data>
</add>

<!-- Remove all virtual key words -->
<remove>virtual</remove>

<!-- Remove inheritance from Flushing strategy -->
<remove>: public TAO_Flushing_Strategy</remove>

</file>

<!-- Do not build other Flushing Strategies -->
<file name="tao.mpc">

 <substitute>
  <search>Flushing_Strategy.h</search>
  <replace>// Flushing_Strategy.h</replace>
 </substitute>
 <substitute>
  <search>Flushing_Strategy.cpp</search>
  <replace>// Flushing_Strategy.cpp</replace>
 </substitute>

 <substitute>
  <search>Block_Flushing_Strategy.h</search>
  <replace>// Block_Flushing_Strategy.h</replace>
 </substitute>
 <substitute>
  <search>Block_Flushing_Strategy.cpp</search>
  <replace>// Block_Flushing_Strategy.cpp</replace>
 </substitute>

 <substitute>
  <search>Reactive_Flushing_Strategy.h</search>
  <replace>// Reactive_Flushing_Strategy.h</replace>
 </substitute>
 <substitute>
  <search>Reactive_Flushing_Strategy.cpp</search>
  <replace>// Reactive_Flushing_Strategy.cpp</replace>
 </substitute>

</file>

<file name="default_resource.cpp">

<substitute match-line="yes">
 <search>#include "tao/Reactive_Flushing_Strategy.h"</search>
 <replace> // #include "tao/Reactive_Flushing_Strategy.h"</replace>
</substitute>

<substitute match-line="yes">
 <search>#include "tao/Block_Flushing_Strategy.h"</search>
 <replace>// #include "tao/Block_Flushing_Strategy.h"</replace>
</substitute>

<!-- Replace all occurences of Flushing_Strategy with
     L/F Flushing Strategy -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_Strategy</replace>
</substitute>

<!-- Comment out region specified by comment hooks -->
<comment>
 <start-hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_START</start-hook>
 <end-hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END</end-hook>
</comment>

<!-- Add the L/F specialization after the hook -->
<add>
 <hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END</end-hook>
 <data>this->flushing_strategy_type_ = TAO_LEADER_FOLLOWER_FLUSHING;
 </data>
</add>

<!-- Comment out creation of all other flushing strategies -->
<comment>
 <start-hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_START</start-hook>
 <end-hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_END</end-hook>
</comment>

<!-- Create the L/F flushing strategy directly -->
<add>
 <hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_END</hook>
 <data>ACE_NEW_RETURN (strategy,
                       TAO_Leader_Follower_Flushing_Strategy,
                      0);
 </data>
</add>

</file>

<file name="default_resource.h">

<!-- Replace all occurences of Flushing_Strategy with L/F strategy -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_Strategy</replace>
</substitute>

</file>

<file name="ORB_Core.h">

<!-- Replace all occurences of base strategy with most
     derived strategy -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_Strategy</replace>
</substitute>

</file>

<file name="ORB_Core.cpp">

<!-- Replace the Flushing Strategy inclue with L/F
     flushing include -->
<substitute match-line="yes">
 <search>#include "Flushing_Strategy.h"</search>
 <replace>#include "Leader_Follower_Flushing_Strategy</replace>
</substitute>

</file>

<file name="ORB_Core.i">

<!-- Replace all occurences of base strategy with most
     derived strategy -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_Strategy</replace>
</substitute>

</file>

<file name="Transport.h">

<!-- Remove the friend declaration of Reactive_Flushing -->
<substitute match-line="yes">
 <search>friend class TAO_Reactive_Flushing_Strategy;</search>
 <replace>// friend class TAO_Reactive_Flushing_Strategy;</replace>
</substitute>

<!-- Remove friend declaration of Block Flushing -->
<substitute match-line="yes">
 <search>friend class TAO_Block_Flushing_Strategy;</search>
 <replace>// friend class TAO_Block_Flushing_Strategy;</replace>
</substitute>

</file>

<file name="Transport.cpp">

<substitute match-line="yes">
  <search>#include "Flushing_Strategy.h"</search>
  <replace>#include "Leader_Follower_Flushing_Strategy.h</replace>
</substitute>

<!-- Replace all occurences of TAO_Flushing_Strategy with
     TAO_Leader_Follower_Flushing -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_strategy</replace>
</substitute>

</file>

<file name="Resource_Factor.h">

<!-- Replace TAO_Flushing_Strategy with L/F version -->
<substitute>
 <search>TAO_Flushing_Strategy</search>
 <replace>TAO_Leader_Follower_Flushing_Strategy</replace>
</substitute>

</file>

</module>

</transform>
