EC_Priority_Scheduling.cpp

Go to the documentation of this file.
00001 // $Id: EC_Priority_Scheduling.cpp 76589 2007-01-25 18:04:11Z elliott_c $
00002 
00003 #include "orbsvcs/Event/EC_Priority_Scheduling.h"
00004 #include "orbsvcs/Event/EC_QOS_Info.h"
00005 #include "orbsvcs/Event/EC_ProxyConsumer.h"
00006 #include "orbsvcs/Event/EC_ProxySupplier.h"
00007 #include "orbsvcs/Event/EC_Supplier_Filter.h"
00008 
00009 #if ! defined (__ACE_INLINE__)
00010 #include "orbsvcs/Event/EC_Priority_Scheduling.inl"
00011 #endif /* __ACE_INLINE__ */
00012 
00013 ACE_RCSID(Event, EC_Priority_Scheduling, "$Id: EC_Priority_Scheduling.cpp 76589 2007-01-25 18:04:11Z elliott_c $")
00014 
00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 TAO_EC_Priority_Scheduling::~TAO_EC_Priority_Scheduling (void)
00018 {
00019 }
00020 
00021 void
00022 TAO_EC_Priority_Scheduling::add_proxy_supplier_dependencies (
00023       TAO_EC_ProxyPushSupplier *supplier,
00024       TAO_EC_ProxyPushConsumer *consumer)
00025 {
00026   ACE_DEBUG ((LM_DEBUG, "add_proxy_supplier_dependencies - %x %x\n",
00027               supplier, consumer));
00028   const RtecEventChannelAdmin::SupplierQOS& qos =
00029     consumer->publications ();
00030   for (CORBA::ULong i = 0; i < qos.publications.length (); ++i)
00031     {
00032       const RtecEventComm::EventHeader &header =
00033         qos.publications[i].event.header;
00034       TAO_EC_QOS_Info qos_info;
00035       qos_info.rt_info = qos.publications[i].dependency_info.rt_info;
00036 
00037       RtecScheduler::OS_Priority os_priority;
00038       RtecScheduler::Preemption_Subpriority_t p_subpriority;
00039       RtecScheduler::Preemption_Priority_t p_priority;
00040       this->scheduler_->priority (qos_info.rt_info,
00041                                   os_priority,
00042                                   p_subpriority,
00043                                   p_priority);
00044       qos_info.preemption_priority = p_priority;
00045 
00046       supplier->add_dependencies (header, qos_info);
00047     }
00048 }
00049 
00050 void
00051 TAO_EC_Priority_Scheduling::schedule_event (const RtecEventComm::EventSet &event,
00052                                             TAO_EC_ProxyPushConsumer *consumer,
00053                                             TAO_EC_Supplier_Filter *filter)
00054 {
00055   RtecEventChannelAdmin::SupplierQOS qos =
00056     consumer->publications ();
00057 
00058   for (CORBA::ULong j = 0; j != event.length (); ++j)
00059     {
00060       const RtecEventComm::Event& e = event[j];
00061       RtecEventComm::Event* buffer =
00062         const_cast<RtecEventComm::Event*> (&e);
00063       RtecEventComm::EventSet single_event (1, 1, buffer, 0);
00064 
00065       TAO_EC_QOS_Info qos_info;
00066 
00067       for (CORBA::ULong i = 0; i != qos.publications.length (); ++i)
00068         {
00069           const RtecEventComm::EventHeader &qos_header =
00070             qos.publications[i].event.header;
00071 
00072           if (TAO_EC_Filter::matches (e.header, qos_header) == 0)
00073             continue;
00074 
00075           qos_info.rt_info = qos.publications[i].dependency_info.rt_info;
00076 
00077           RtecScheduler::OS_Priority os_priority;
00078           RtecScheduler::Preemption_Subpriority_t p_subpriority;
00079           RtecScheduler::Preemption_Priority_t p_priority;
00080           this->scheduler_->priority (qos_info.rt_info,
00081                                       os_priority,
00082                                       p_subpriority,
00083                                       p_priority);
00084           qos_info.preemption_priority = p_priority;
00085         }
00086 
00087       filter->push_scheduled_event (single_event, qos_info);
00088     }
00089 }
00090 
00091 TAO_END_VERSIONED_NAMESPACE_DECL

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