Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / examples / Kokyu_dsrt_schedulers / FP_Scheduler.h
blob71d2309ef353c540c71dfb84b89e3a8f25f5a7c9
1 #ifndef FIXED_PRIORITY_SCHEDULER_H
2 #define FIXED_PRIORITY_SCHEDULER_H
4 #include "tao/RTScheduling/RTScheduler.h"
5 #include "tao/CodecFactory/CodecFactory.h"
6 #include "tao/LocalObject.h"
7 #include "FP_SchedulingC.h"
8 #include "Kokyu/Kokyu_dsrt.h"
9 #include "Kokyu_dsrt_schedulers_export.h"
11 struct FP_Scheduler_Traits
13 typedef RTScheduling::Current::IdType Guid_t;
15 struct _QoSDescriptor_t
17 typedef long Priority_t;
18 Priority_t priority_;
21 typedef _QoSDescriptor_t QoSDescriptor_t;
23 typedef Kokyu::Fixed_Priority_Comparator<QoSDescriptor_t> QoSComparator_t;
25 class _Guid_Hash
27 public:
28 u_long operator () (const Guid_t& id)
30 return ACE::hash_pjw ((const char *) id.get_buffer (),
31 id.length ());
35 typedef _Guid_Hash Guid_Hash;
38 class Kokyu_DSRT_Schedulers_Export FP_Segment_Sched_Param_Policy:
39 public FP_Scheduling::SegmentSchedulingParameterPolicy,
40 public ::CORBA::LocalObject
42 public:
43 FP_Segment_Sched_Param_Policy ();
44 FP_Segment_Sched_Param_Policy (const FP_Segment_Sched_Param_Policy &rhs);
46 FP_Scheduling::SegmentSchedulingParameter value (
49 void value (
50 const FP_Scheduling::SegmentSchedulingParameter & value
53 virtual CORBA::Policy_ptr copy ();
55 virtual CORBA::PolicyType policy_type ();
57 virtual void destroy ();
59 private:
60 FP_Scheduling::SegmentSchedulingParameter value_;
63 class Kokyu_DSRT_Schedulers_Export Fixed_Priority_Scheduler:
64 public FP_Scheduling::FP_Scheduler,
65 public ::CORBA::LocalObject
67 public:
68 Fixed_Priority_Scheduler (CORBA::ORB_ptr orb,
69 Kokyu::DSRT_Dispatcher_Impl_t,
70 int ace_sched_policy,
71 int ace_sched_scope);
73 ~Fixed_Priority_Scheduler ();
75 void shutdown ();
77 virtual FP_Scheduling::SegmentSchedulingParameterPolicy_ptr
78 create_segment_scheduling_parameter (
79 const FP_Scheduling::SegmentSchedulingParameter & value
82 virtual void begin_new_scheduling_segment (const RTScheduling::Current::IdType & guid,
83 const char * name,
84 CORBA::Policy_ptr sched_param,
85 CORBA::Policy_ptr implicit_sched_param);
87 virtual void begin_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
88 const char * name,
89 CORBA::Policy_ptr sched_param,
90 CORBA::Policy_ptr implicit_sched_param);
92 virtual void update_scheduling_segment (const RTScheduling::Current::IdType & guid,
93 const char * name,
94 CORBA::Policy_ptr sched_param,
95 CORBA::Policy_ptr implicit_sched_param);
97 virtual void end_scheduling_segment (const RTScheduling::Current::IdType & guid,
98 const char * name);
100 virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
101 const char * name,
102 CORBA::Policy_ptr outer_sched_param);
104 virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri);
106 virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
107 RTScheduling::Current::IdType_out guid,
108 CORBA::String_out name,
109 CORBA::Policy_out sched_param,
110 CORBA::Policy_out implicit_sched_param);
112 virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri);
114 virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri);
116 virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri);
118 virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri);
120 virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri);
122 virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri);
124 virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri);
126 virtual void cancel (const RTScheduling::Current::IdType & guid);
128 virtual CORBA::PolicyList * scheduling_policies ();
130 virtual void scheduling_policies (const CORBA::PolicyList & scheduling_policies);
132 virtual CORBA::PolicyList * poa_policies ();
134 virtual char * scheduling_discipline_name ();
136 virtual RTScheduling::ResourceManager_ptr create_resource_manager (const char * name,
137 CORBA::Policy_ptr scheduling_parameter);
139 virtual void set_scheduling_parameter (PortableServer::Servant & resource,
140 const char * name,
141 CORBA::Policy_ptr scheduling_parameter);
143 private:
144 CORBA::ORB_var orb_;
145 IOP::Codec_var codec_;
146 RTScheduling::Current_var current_;
147 Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr
148 kokyu_dispatcher_;
149 Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type_;
150 int ace_sched_policy_;
151 int ace_sched_scope_;
154 #endif //FIXED_PRIORITY_SCHEDULER_H