1 #ifndef MUF_SCHEDULER_H
2 #define MUF_SCHEDULER_H
4 #include "tao/RTScheduling/RTScheduler.h"
5 #include "tao/CodecFactory/CodecFactory.h"
6 #include "MUF_SchedulingC.h"
7 #include "Kokyu/Kokyu_dsrt.h"
8 #include "Kokyu_dsrt_schedulers_export.h"
9 #include "tao/LocalObject.h"
11 struct MUF_Scheduler_Traits
13 typedef RTScheduling::Current::IdType Guid_t
;
15 typedef TimeBase::TimeT Time_t
;
21 ACE_Time_Value time
= ACE_OS::gettimeofday ();
22 return 10*time
.usec () + 10000000*time
.sec ();
26 struct _QoSDescriptor_t
28 typedef long Criticality_t
;
30 typedef TimeBase::TimeT Time_t
;
33 Criticality_t criticality_
;
38 typedef _QoSDescriptor_t QoSDescriptor_t
;
40 typedef Kokyu::MUF_Comparator
<QoSDescriptor_t
> QoSComparator_t
;
45 u_long
operator () (const Guid_t
& id
)
47 return ACE::hash_pjw ((const char *) id
.get_buffer (),
51 typedef _Guid_Hash Guid_Hash
;
54 class Kokyu_DSRT_Schedulers_Export MUF_Sched_Param_Policy
:
55 public MUF_Scheduling::SchedulingParameterPolicy
,
56 public ::CORBA::LocalObject
59 MUF_Sched_Param_Policy ();
60 MUF_Sched_Param_Policy (const MUF_Sched_Param_Policy
&rhs
);
62 MUF_Scheduling::SchedulingParameter
value ();
64 void value (const MUF_Scheduling::SchedulingParameter
& value
);
66 virtual CORBA::Policy_ptr
copy ();
68 virtual CORBA::PolicyType
policy_type ();
70 virtual void destroy ();
73 MUF_Scheduling::SchedulingParameter value_
;
76 class Kokyu_DSRT_Schedulers_Export MUF_Scheduler
:
77 public MUF_Scheduling::Scheduler
,
78 public ::CORBA::LocalObject
81 MUF_Scheduler (CORBA::ORB_ptr orb
,
82 Kokyu::DSRT_Dispatcher_Impl_t
,
89 virtual MUF_Scheduling::SchedulingParameterPolicy_ptr
90 create_scheduling_parameter (const MUF_Scheduling::SchedulingParameter
& value
);
94 virtual void begin_new_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
96 CORBA::Policy_ptr sched_param
,
97 CORBA::Policy_ptr implicit_sched_param
);
99 virtual void begin_nested_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
101 CORBA::Policy_ptr sched_param
,
102 CORBA::Policy_ptr implicit_sched_param
);
104 virtual void update_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
106 CORBA::Policy_ptr sched_param
,
107 CORBA::Policy_ptr implicit_sched_param
);
109 virtual void end_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
112 virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
114 CORBA::Policy_ptr outer_sched_param
);
116 virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri
);
118 virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri
);
120 virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri
,
121 RTScheduling::Current::IdType_out guid
,
122 CORBA::String_out name
,
123 CORBA::Policy_out sched_param
,
124 CORBA::Policy_out implicit_sched_param
);
126 virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
);
128 virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri
);
130 virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri
);
132 virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri
);
134 virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri
);
136 virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri
);
138 virtual void cancel (const RTScheduling::Current::IdType
& guid
);
140 virtual CORBA::PolicyList
* scheduling_policies ();
142 virtual void scheduling_policies (const CORBA::PolicyList
& scheduling_policies
);
144 virtual CORBA::PolicyList
* poa_policies ();
146 virtual char * scheduling_discipline_name ();
148 virtual RTScheduling::ResourceManager_ptr
create_resource_manager (const char * name
,
149 CORBA::Policy_ptr scheduling_parameter
);
151 virtual void set_scheduling_parameter (PortableServer::Servant
& resource
,
153 CORBA::Policy_ptr scheduling_parameter
);
157 IOP::Codec_var codec_
;
158 RTScheduling::Current_var current_
;
159 Kokyu::DSRT_Dispatcher_Factory
<MUF_Scheduler_Traits
>::DSRT_Dispatcher_Auto_Ptr
161 Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type_
;
162 int ace_sched_policy_
;
163 int ace_sched_scope_
;
166 #endif //MUF_SCHEDULER_H