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