00001
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.i"
00011 #endif
00012
00013 ACE_RCSID(Event, EC_Priority_Scheduling, "EC_Priority_Scheduling.cpp,v 1.9 2006/03/14 06:14:25 jtc Exp")
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 ACE_ENV_ARG_DECL)
00026 {
00027 ACE_DEBUG ((LM_DEBUG, "add_proxy_supplier_dependencies - %x %x\n",
00028 supplier, consumer));
00029 const RtecEventChannelAdmin::SupplierQOS& qos =
00030 consumer->publications ();
00031 for (CORBA::ULong i = 0; i < qos.publications.length (); ++i)
00032 {
00033 const RtecEventComm::EventHeader &header =
00034 qos.publications[i].event.header;
00035 TAO_EC_QOS_Info qos_info;
00036 qos_info.rt_info = qos.publications[i].dependency_info.rt_info;
00037
00038 RtecScheduler::OS_Priority os_priority;
00039 RtecScheduler::Preemption_Subpriority_t p_subpriority;
00040 RtecScheduler::Preemption_Priority_t p_priority;
00041 this->scheduler_->priority (qos_info.rt_info,
00042 os_priority,
00043 p_subpriority,
00044 p_priority
00045 ACE_ENV_ARG_PARAMETER);
00046 ACE_CHECK;
00047 qos_info.preemption_priority = p_priority;
00048
00049 supplier->add_dependencies (header, qos_info ACE_ENV_ARG_PARAMETER);
00050 ACE_CHECK;
00051 }
00052 }
00053
00054 void
00055 TAO_EC_Priority_Scheduling::schedule_event (const RtecEventComm::EventSet &event,
00056 TAO_EC_ProxyPushConsumer *consumer,
00057 TAO_EC_Supplier_Filter *filter
00058 ACE_ENV_ARG_DECL)
00059 {
00060 RtecEventChannelAdmin::SupplierQOS qos =
00061 consumer->publications ();
00062
00063 for (CORBA::ULong j = 0; j != event.length (); ++j)
00064 {
00065 const RtecEventComm::Event& e = event[j];
00066 RtecEventComm::Event* buffer =
00067 const_cast<RtecEventComm::Event*> (&e);
00068 RtecEventComm::EventSet single_event (1, 1, buffer, 0);
00069
00070 TAO_EC_QOS_Info qos_info;
00071
00072 for (CORBA::ULong i = 0; i != qos.publications.length (); ++i)
00073 {
00074 const RtecEventComm::EventHeader &qos_header =
00075 qos.publications[i].event.header;
00076
00077 if (TAO_EC_Filter::matches (e.header, qos_header) == 0)
00078 continue;
00079
00080 qos_info.rt_info = qos.publications[i].dependency_info.rt_info;
00081
00082 RtecScheduler::OS_Priority os_priority;
00083 RtecScheduler::Preemption_Subpriority_t p_subpriority;
00084 RtecScheduler::Preemption_Priority_t p_priority;
00085 this->scheduler_->priority (qos_info.rt_info,
00086 os_priority,
00087 p_subpriority,
00088 p_priority
00089 ACE_ENV_ARG_PARAMETER);
00090 ACE_CHECK;
00091 qos_info.preemption_priority = p_priority;
00092 }
00093
00094 filter->push_scheduled_event (single_event, qos_info
00095 ACE_ENV_ARG_PARAMETER);
00096 ACE_CHECK;
00097 }
00098 }
00099
00100 TAO_END_VERSIONED_NAMESPACE_DECL