TAO_EC_Kokyu_Factory Class Reference

Extend the default factory to support scheduling. More...

#include <EC_Kokyu_Factory.h>

Inheritance diagram for TAO_EC_Kokyu_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_Kokyu_Factory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Kokyu_Factory (void)
 Constructor.

virtual ~TAO_EC_Kokyu_Factory (void)
 destructor...

virtual int init (int argc, ACE_TCHAR *argv[])
virtual int fini (void)
virtual TAO_EC_Dispatchingcreate_dispatching (TAO_EC_Event_Channel_Base *)
 Create and destroy the dispatching module.

virtual TAO_EC_Filter_Buildercreate_filter_builder (TAO_EC_Event_Channel_Base *)
 Create and destroy the filter builder.

virtual TAO_EC_Timeout_Generatorcreate_timeout_generator (TAO_EC_Event_Channel_Base *)
 Create and destroy the timer module.

virtual TAO_EC_Scheduling_Strategycreate_scheduling_strategy (TAO_EC_Event_Channel_Base *)
 Create and destroy the observer strategy.


Static Public Member Functions

int init_svcs (void)

Private Attributes

int disp_sched_policy_
int disp_sched_scope_

Detailed Description

Extend the default factory to support scheduling.

Definition at line 36 of file EC_Kokyu_Factory.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_EC_Kokyu_Factory::TAO_EC_Kokyu_Factory void   ) 
 

Constructor.

Definition at line 8 of file EC_Kokyu_Factory.i.

References ACE_SCHED_FIFO, and ACE_SCOPE_THREAD.

00009   :  TAO_EC_Default_Factory (),
00010      disp_sched_policy_ (ACE_SCHED_FIFO),
00011      disp_sched_scope_ (ACE_SCOPE_THREAD)
00012 {
00013 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_EC_Kokyu_Factory::~TAO_EC_Kokyu_Factory void   )  [virtual]
 

destructor...

Definition at line 24 of file EC_Kokyu_Factory.cpp.

00025 {
00026 }


Member Function Documentation

TAO_EC_Dispatching * TAO_EC_Kokyu_Factory::create_dispatching TAO_EC_Event_Channel_Base  )  [virtual]
 

Create and destroy the dispatching module.

Reimplemented from TAO_EC_Default_Factory.

Definition at line 218 of file EC_Kokyu_Factory.cpp.

References TAO_EC_Default_Factory::create_dispatching().

00219 {
00220   if (this->dispatching_ == 2)
00221     return new TAO_EC_Kokyu_Dispatching (ec,
00222                                          this->disp_sched_policy_,
00223                                          this->disp_sched_scope_);
00224   return this->TAO_EC_Default_Factory::create_dispatching (ec);
00225 }

TAO_EC_Filter_Builder * TAO_EC_Kokyu_Factory::create_filter_builder TAO_EC_Event_Channel_Base  )  [virtual]
 

Create and destroy the filter builder.

Reimplemented from TAO_EC_Default_Factory.

Definition at line 228 of file EC_Kokyu_Factory.cpp.

References TAO_EC_Default_Factory::create_filter_builder().

00229 {
00230   if (this->filtering_ == 3)
00231     return new TAO_EC_Kokyu_Filter_Builder (ec);
00232 
00233   return this->TAO_EC_Default_Factory::create_filter_builder (ec);
00234 }

TAO_EC_Scheduling_Strategy * TAO_EC_Kokyu_Factory::create_scheduling_strategy TAO_EC_Event_Channel_Base  )  [virtual]
 

Create and destroy the observer strategy.

Reimplemented from TAO_EC_Default_Factory.

Definition at line 250 of file EC_Kokyu_Factory.cpp.

References TAO_EC_Default_Factory::create_scheduling_strategy(), and TAO_EC_Event_Channel_Base::scheduler().

00251 {
00252   if (this->scheduling_ == 2)
00253     {
00254       CORBA::Object_var tmp = ec->scheduler ();
00255       RtecScheduler::Scheduler_var scheduler =
00256         RtecScheduler::Scheduler::_narrow (tmp.in ());
00257       return new TAO_EC_Kokyu_Scheduling (scheduler.in ());
00258     }
00259   return this->TAO_EC_Default_Factory::create_scheduling_strategy (ec);
00260 }

TAO_EC_Timeout_Generator * TAO_EC_Kokyu_Factory::create_timeout_generator TAO_EC_Event_Channel_Base  )  [virtual]
 

Create and destroy the timer module.

Reimplemented from TAO_EC_Default_Factory.

Definition at line 238 of file EC_Kokyu_Factory.cpp.

References TAO_EC_Default_Factory::create_timeout_generator().

00239 {
00240 #if 0
00241   if (this->timeout_ == 1)
00242     {
00243       //Kokyu timeout generator?
00244     }
00245 #endif
00246   return this->TAO_EC_Default_Factory::create_timeout_generator (ec);
00247 }

int TAO_EC_Kokyu_Factory::fini void   )  [virtual]
 

Reimplemented from TAO_EC_Default_Factory.

Definition at line 210 of file EC_Kokyu_Factory.cpp.

00211 {
00212   return 0;
00213 }

int TAO_EC_Kokyu_Factory::init int  argc,
ACE_TCHAR argv[]
[virtual]
 

Reimplemented from TAO_EC_Default_Factory.

Definition at line 36 of file EC_Kokyu_Factory.cpp.

References ACE_Arg_Shifter, ACE_ERROR, ACE_SCHED_FIFO, ACE_SCHED_OTHER, ACE_SCHED_RR, ACE_SCOPE_PROCESS, ACE_SCOPE_THREAD, ACE_TCHAR, ACE_TEXT, TAO_EC_Default_Factory::init(), LM_ERROR, and ACE_OS::strcasecmp().

00037 {
00038   ACE_Arg_Shifter arg_shifter (argc, argv);
00039 
00040   while (arg_shifter.is_anything_left ())
00041     {
00042       const ACE_TCHAR* arg = arg_shifter.get_current ();
00043 
00044       if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatching")) == 0)
00045         {
00046           arg_shifter.consume_arg ();
00047 
00048           if (arg_shifter.is_parameter_next ())
00049             {
00050               const ACE_TCHAR* opt = arg_shifter.get_current ();
00051               if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0)
00052                 {
00053                   this->dispatching_ = 0;
00054                 }
00055               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("mt")) == 0)
00056                 {
00057                   this->dispatching_ = 1;
00058                 }
00059               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0)
00060                 {
00061                   this->dispatching_ = 2;
00062                 }
00063               else
00064                 {
00065                   ACE_ERROR ((LM_ERROR,
00066                               ACE_TEXT("EC_Kokyu_Factory - ")
00067                               ACE_TEXT("unsupported dispatching <%s>\n"),
00068                               opt));
00069                 }
00070               arg_shifter.consume_arg ();
00071             }
00072           //if Kokyu dispatching - look for sched policy
00073           if (this->dispatching_ == 2)
00074             {
00075               if (arg_shifter.is_parameter_next ())
00076                 {
00077                   const ACE_TCHAR* opt = arg_shifter.get_current ();
00078                   if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_FIFO")) == 0)
00079                     {
00080                       this->disp_sched_policy_ = ACE_SCHED_FIFO;
00081                     }
00082                   else if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_RR")) == 0)
00083                     {
00084                       this->disp_sched_policy_ = ACE_SCHED_RR;
00085                     }
00086                   else
00087                     {
00088                       this->disp_sched_policy_ = ACE_SCHED_OTHER;
00089                     }
00090                   arg_shifter.consume_arg ();
00091 
00092                   if (arg_shifter.is_parameter_next ())
00093                     {
00094                       const ACE_TCHAR* opt = arg_shifter.get_current ();
00095                       if (ACE_OS::strcasecmp (opt, ACE_TEXT("SYSTEM")) == 0)
00096                         {
00097                           this->disp_sched_scope_ = ACE_SCOPE_THREAD;
00098                         }
00099                       else if (ACE_OS::strcasecmp (opt, ACE_TEXT("PROCESS")) == 0)
00100                         {
00101                           this->disp_sched_scope_ = ACE_SCOPE_PROCESS;
00102                         }
00103                       arg_shifter.consume_arg ();
00104                     }
00105                 }
00106             }
00107         }
00108 
00109       else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECFiltering")) == 0)
00110         {
00111           arg_shifter.consume_arg ();
00112 
00113           if (arg_shifter.is_parameter_next ())
00114             {
00115               const ACE_TCHAR* opt = arg_shifter.get_current ();
00116               if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0)
00117                 {
00118                   this->filtering_ = 0;
00119                 }
00120               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("basic")) == 0)
00121                 {
00122                   this->filtering_ = 1;
00123                 }
00124               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("prefix")) == 0)
00125                 {
00126                   this->filtering_ = 2;
00127                 }
00128               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0)
00129                 {
00130                   this->filtering_ = 3;
00131                 }
00132               else
00133                 {
00134                   ACE_ERROR ((LM_ERROR,
00135                               ACE_TEXT("EC_Kokyu_Factory - ")
00136                               ACE_TEXT("unsupported filtering <%s>\n"),
00137                               opt));
00138                 }
00139               arg_shifter.consume_arg ();
00140             }
00141         }
00142 
00143       else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECTimeout")) == 0)
00144         {
00145           arg_shifter.consume_arg ();
00146 
00147           if (arg_shifter.is_parameter_next ())
00148             {
00149               const ACE_TCHAR* opt = arg_shifter.get_current ();
00150               if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0)
00151                 {
00152                   this->timeout_ = 0;
00153                 }
00154 #if 0
00155               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0)
00156                 {
00157                   this->timeout_ = 1;
00158                 }
00159 #endif /* 0 */
00160               else
00161                 {
00162                   ACE_ERROR ((LM_ERROR,
00163                               ACE_TEXT("EC_Kokyu_Factory - ")
00164                               ACE_TEXT("unsupported timeout <%s>\n"),
00165                               opt));
00166                 }
00167               arg_shifter.consume_arg ();
00168             }
00169         }
00170 
00171       else if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECScheduling")) == 0)
00172         {
00173           arg_shifter.consume_arg ();
00174 
00175           if (arg_shifter.is_parameter_next ())
00176             {
00177               const ACE_TCHAR* opt = arg_shifter.get_current ();
00178               if (ACE_OS::strcasecmp (opt, ACE_TEXT("null")) == 0)
00179                 {
00180                   this->scheduling_ = 0;
00181                 }
00182               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("group")) == 0)
00183                 {
00184                   this->scheduling_ = 1;
00185                 }
00186               else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0)
00187                 {
00188                   this->scheduling_ = 2;
00189                 }
00190               else
00191                 {
00192                   ACE_ERROR ((LM_ERROR,
00193                               ACE_TEXT("EC_Kokyu_Factory - ")
00194                               ACE_TEXT("unsupported scheduling <%s>\n"),
00195                               opt));
00196                 }
00197               arg_shifter.consume_arg ();
00198             }
00199         }
00200 
00201       else
00202         {
00203           arg_shifter.ignore_arg ();
00204         }
00205     }
00206   return this->TAO_EC_Default_Factory::init (argc, argv);
00207 }

int TAO_EC_Kokyu_Factory::init_svcs void   )  [static]
 

Helper function to register the Kokyu factory into the service configurator.

Reimplemented from TAO_EC_Default_Factory.

Definition at line 29 of file EC_Kokyu_Factory.cpp.

References ACE_Service_Config::static_svcs().

00030 {
00031   return ACE_Service_Config::static_svcs ()->
00032     insert (&ace_svc_desc_TAO_EC_Kokyu_Factory);
00033 }


Member Data Documentation

int TAO_EC_Kokyu_Factory::disp_sched_policy_ [private]
 

Definition at line 64 of file EC_Kokyu_Factory.h.

int TAO_EC_Kokyu_Factory::disp_sched_scope_ [private]
 

Definition at line 65 of file EC_Kokyu_Factory.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:14:55 2006 for TAO_RTEvent by doxygen 1.3.6