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