Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / RTScheduling / Scheduler.cpp
blobfe6cfa857678590228fcb5a36951114d7323404d
1 #include "Scheduler.h"
2 #include "tao/ORB.h"
3 #include "ace/Atomic_Op.h"
4 #include "tao/RTScheduling/Request_Interceptor.h"
6 TAO_Scheduler::TAO_Scheduler (CORBA::ORB_ptr orb)
8 CORBA::Object_var current_obj =
9 orb->resolve_initial_references ("RTScheduler_Current");
11 current_ = RTScheduling::Current::_narrow (current_obj.in ());
14 TAO_Scheduler::~TAO_Scheduler (void)
18 CORBA::PolicyList*
19 TAO_Scheduler::scheduling_policies (void)
21 return 0;
24 void
25 TAO_Scheduler::scheduling_policies (const CORBA::PolicyList &)
29 CORBA::PolicyList*
30 TAO_Scheduler::poa_policies (void)
32 return 0;
35 char *
36 TAO_Scheduler::scheduling_discipline_name (void)
38 return 0;
41 RTScheduling::ResourceManager_ptr
42 TAO_Scheduler::create_resource_manager (const char *,
43 CORBA::Policy_ptr)
45 return 0;
48 void
49 TAO_Scheduler::set_scheduling_parameter (PortableServer::Servant &,
50 const char *,
51 CORBA::Policy_ptr)
55 void
56 TAO_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType &,
57 const char *,
58 CORBA::Policy_ptr,
59 CORBA::Policy_ptr)
63 void
64 TAO_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdType &,
65 const char *,
66 CORBA::Policy_ptr,
67 CORBA::Policy_ptr)
71 void
72 TAO_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &,
73 const char *,
74 CORBA::Policy_ptr,
75 CORBA::Policy_ptr)
79 void
80 TAO_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &,
81 const char *)
85 void
86 TAO_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType &,
87 const char *,
88 CORBA::Policy_ptr)
93 void
94 TAO_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr request_info)
96 IOP::ServiceContext srv_con;
97 srv_con.context_id = Client_Interceptor::SchedulingInfo;
98 srv_con.context_data.length (sizeof (size_t));
99 RTScheduling::Current::IdType_var id = this->current_->id ();
100 ACE_OS::memcpy (srv_con.context_data.get_buffer (),
101 id->get_buffer (),
102 sizeof (size_t));
103 request_info->add_request_service_context (srv_con,
107 void
108 TAO_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info,
109 RTScheduling::Current::IdType_out guid_out,
110 CORBA::String_out /*name*/,
111 CORBA::Policy_out /*sched_param*/,
112 CORBA::Policy_out /*implicit_sched_param*/)
114 IOP::ServiceContext_var serv_cxt;
118 serv_cxt = request_info->get_request_service_context (Server_Interceptor::SchedulingInfo);
120 size_t gu_id;
121 ACE_OS::memcpy (&gu_id,
122 serv_cxt->context_data.get_buffer (),
123 serv_cxt->context_data.length ());
125 ACE_DEBUG ((LM_DEBUG,
126 "The Guid is %d\n",
127 gu_id));
129 RTScheduling::Current::IdType* guid;
130 ACE_NEW (guid,
131 RTScheduling::Current::IdType);
133 guid->length (sizeof (size_t));
134 ACE_OS::memcpy (guid->get_buffer (),
135 serv_cxt->context_data.get_buffer (),
136 sizeof (size_t));
138 guid_out = guid;
140 catch (const CORBA::Exception&)
142 ACE_DEBUG ((LM_DEBUG,
143 "Invalid Service Context\n"));
147 void
148 TAO_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr)
152 void
153 TAO_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr)
157 void
158 TAO_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr)
162 void
163 TAO_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr)
167 void
168 TAO_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr)
172 void
173 TAO_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr)
177 void
178 TAO_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr)
182 void
183 TAO_Scheduler::cancel (const RTScheduling::Current::IdType &)