EC_TPC_Factory.cpp

Go to the documentation of this file.
00001 // $Id: EC_TPC_Factory.cpp 75304 2006-11-09 15:46:21Z cleeland $
00002 
00003 #include "orbsvcs/Event/EC_TPC_Factory.h"
00004 
00005 #include "orbsvcs/Event/EC_TPC_Dispatching.h"
00006 #include "orbsvcs/Event/EC_TPC_ProxySupplier.h"
00007 #include "orbsvcs/Event/EC_TPC_ProxyConsumer.h"
00008 
00009 #include "tao/ORB_Core.h"
00010 
00011 #include "ace/Arg_Shifter.h"
00012 #include "ace/Sched_Params.h"
00013 #include "ace/OS_NS_strings.h"
00014 
00015 ACE_RCSID(Event, EC_TPC_Factory, "$Id: EC_TPC_Factory.cpp 75304 2006-11-09 15:46:21Z cleeland $")
00016 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 unsigned long TAO_EC_TPC_debug_level;
00020 
00021 TAO_EC_TPC_Factory::TAO_EC_TPC_Factory (void)
00022 {
00023   TAO_EC_TPC_debug_level = 0;
00024 }
00025 
00026 TAO_EC_TPC_Factory::~TAO_EC_TPC_Factory (void)
00027 {
00028 }
00029 
00030 int
00031 TAO_EC_TPC_Factory::init_svcs (void)
00032 {
00033   TAO_EC_Simple_Queue_Full_Action::init_svcs();
00034   return ACE_Service_Config::static_svcs ()->
00035     insert (&ace_svc_desc_TAO_EC_TPC_Factory);
00036 }
00037 
00038 int
00039 TAO_EC_TPC_Factory::init (int argc, char* argv[])
00040 {
00041   ACE_Arg_Shifter arg_shifter (argc, argv);
00042 
00043   while (arg_shifter.is_anything_left ())
00044     {
00045       const char *arg = arg_shifter.get_current ();
00046 
00047       if (ACE_OS::strcasecmp (arg, "-ECDispatching") == 0)
00048         {
00049           arg_shifter.consume_arg ();
00050 
00051           if (arg_shifter.is_parameter_next ())
00052             {
00053               // Here we print out a message indicating that this
00054               // option isn't valid with this factory and that it's
00055               // being ignored.
00056 
00057               ACE_DEBUG ((LM_ERROR,
00058                             "EC_TPC_Factory - "
00059                           "-ECDispatching not supported with TPC_Factory; ignoring the option and using thread-per-consumer dispatch strategy\n"));
00060               arg_shifter.consume_arg ();
00061             }
00062         }
00063       if (ACE_OS::strcasecmp (arg, "-ECTPCDebug") == 0)
00064         {
00065           arg_shifter.consume_arg ();
00066           ++TAO_EC_TPC_debug_level;
00067         }
00068       else
00069         {
00070           arg_shifter.ignore_arg ();
00071         }
00072 
00073     }
00074 
00075   return TAO_EC_Default_Factory::init (argc, argv);
00076 }
00077 
00078 // ****************************************************************
00079 
00080 TAO_EC_Dispatching*
00081 TAO_EC_TPC_Factory::create_dispatching (TAO_EC_Event_Channel_Base *)
00082 {
00083   if (TAO_EC_TPC_debug_level > 0)
00084     ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_dispatching\n"));
00085 
00086   TAO_EC_Queue_Full_Service_Object* so =
00087     this->find_service_object (this->queue_full_service_object_name_.fast_rep(),
00088                                TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME);
00089  
00090   return new TAO_EC_TPC_Dispatching (this->dispatching_threads_,
00091                                      this->dispatching_threads_flags_,
00092                                      this->dispatching_threads_priority_,
00093                                      this->dispatching_threads_force_active_,
00094                                      so);
00095 }
00096 
00097 
00098 TAO_EC_ProxyPushSupplier*
00099 TAO_EC_TPC_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec)
00100 {
00101   if (TAO_EC_TPC_debug_level > 0)
00102     ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_supplier\n"));
00103   return new TAO_EC_TPC_ProxyPushSupplier (ec, this->consumer_validate_connection_);
00104 }
00105 
00106 
00107 TAO_EC_ProxyPushConsumer*
00108 TAO_EC_TPC_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec)
00109 {
00110   if (TAO_EC_TPC_debug_level > 0)
00111     ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_consumer\n"));
00112   return new TAO_EC_TPC_ProxyPushConsumer (ec);
00113 }
00114 
00115 TAO_END_VERSIONED_NAMESPACE_DECL
00116 
00117 // ****************************************************************
00118 
00119 ACE_STATIC_SVC_DEFINE (TAO_EC_TPC_Factory,
00120                        ACE_TEXT ("EC_Factory"),
00121                        ACE_SVC_OBJ_T,
00122                        &ACE_SVC_NAME (TAO_EC_TPC_Factory),
00123                        ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00124                        0)
00125 ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_TPC_Factory)
00126 
00127 // ****************************************************************
00128 

Generated on Tue Feb 2 17:44:06 2010 for TAO_RTEvent by  doxygen 1.4.7