diff options
author | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-16 04:16:32 +0000 |
---|---|---|
committer | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-16 04:16:32 +0000 |
commit | b35fd7da3b938c9f13b1ec4ed2f92de6ede94f9c (patch) | |
tree | afcca129a3ba45525f1e1ae0672d5fe5221fdc33 /TAO/tests | |
parent | c125149e052ae8f796471fdf9d588a74b9e7cc47 (diff) | |
download | ATCD-b35fd7da3b938c9f13b1ec4ed2f92de6ede94f9c.tar.gz |
ChangelogTag: Wed Jul 16 00:03:40 2003 Yamuna Krishnamurthy <yamuna@oomworks.com>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Makefile | 3 | ||||
-rw-r--r-- | TAO/tests/RTScheduling/Makefile | 33 | ||||
-rw-r--r-- | TAO/tests/RTScheduling/Scheduler.cpp | 234 | ||||
-rw-r--r-- | TAO/tests/RTScheduling/Scheduler.h | 129 |
4 files changed, 398 insertions, 1 deletions
diff --git a/TAO/tests/Makefile b/TAO/tests/Makefile index 0b85e9e6487..c3d4ac4505a 100644 --- a/TAO/tests/Makefile +++ b/TAO/tests/Makefile @@ -96,7 +96,8 @@ DIRS = CDR \ DLL_ORB \ ORB_shutdown \ Two_Objects \ - Nested_Upcall_Crash + Nested_Upcall_Crash \ + RTScheduling ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO diff --git a/TAO/tests/RTScheduling/Makefile b/TAO/tests/RTScheduling/Makefile new file mode 100644 index 00000000000..d1a01f6e4fc --- /dev/null +++ b/TAO/tests/RTScheduling/Makefile @@ -0,0 +1,33 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +# Makefile for RTScheduling tests +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +DIRS = \ + DT_Spawn \ + Scheduling_Interceptor \ + VoidData \ + Current \ + Thread_Cancel + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU diff --git a/TAO/tests/RTScheduling/Scheduler.cpp b/TAO/tests/RTScheduling/Scheduler.cpp new file mode 100644 index 00000000000..894ea92f3dc --- /dev/null +++ b/TAO/tests/RTScheduling/Scheduler.cpp @@ -0,0 +1,234 @@ +//$Id$ + +#include "Scheduler.h" +#include "ace/Atomic_Op.h" +#include "tao/RTScheduling/Request_Interceptor.h" + +ACE_Atomic_Op<ACE_Thread_Mutex, long> server_guid_counter; + +TAO_Scheduler::TAO_Scheduler (CORBA::ORB_ptr orb) +{ + CORBA::Object_ptr current_obj = orb->resolve_initial_references ("RTScheduler_Current"); + + current_ = RTScheduling::Current::_narrow (current_obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +TAO_Scheduler::~TAO_Scheduler (void) +{ +} + +CORBA::PolicyList* +TAO_Scheduler::scheduling_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return 0; +} + +void +TAO_Scheduler::scheduling_policies (const CORBA::PolicyList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +CORBA::PolicyList* +TAO_Scheduler::poa_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return 0; +} + +char * +TAO_Scheduler::scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return 0; +} + +RTScheduling::ResourceManager_ptr +TAO_Scheduler::create_resource_manager (const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return 0; +} + +void +TAO_Scheduler::set_scheduling_parameter (PortableServer::Servant &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +TAO_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +} + +void +TAO_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +} + +void +TAO_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +} + +void +TAO_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &, + const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +TAO_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + + +void +TAO_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr request_info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + IOP::ServiceContext* srv_con = new IOP::ServiceContext; + srv_con->context_id = Client_Interceptor::SchedulingInfo; + srv_con->context_data.length (sizeof (long)); + ACE_OS::memcpy (srv_con->context_data.get_buffer (), + current_->id (ACE_ENV_ARG_PARAMETER)->get_buffer (), + sizeof (long)); + ACE_CHECK; + request_info->add_request_service_context (*srv_con, + 0); +} + +void +TAO_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info, + RTScheduling::Current::IdType_out guid_out, + CORBA::String_out /*name*/, + CORBA::Policy_out /*sched_param*/, + CORBA::Policy_out /*implicit_sched_param*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + IOP::ServiceContext* serv_cxt = 0; + + ACE_TRY + { + serv_cxt = request_info->get_request_service_context (Server_Interceptor::SchedulingInfo); + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + "Invalid Service Context\n")); + } + ACE_ENDTRY; + + if (serv_cxt != 0) + { + int gu_id; + ACE_OS::memcpy (&gu_id, + serv_cxt->context_data.get_buffer (), + serv_cxt->context_data.length ()); + + ACE_DEBUG ((LM_DEBUG, + "The Guid is %d\n", + gu_id)); + + RTScheduling::Current::IdType* guid; + ACE_NEW (guid, + RTScheduling::Current::IdType); + + guid->length (sizeof (long)); + ACE_OS::memcpy (guid->get_buffer (), + serv_cxt->context_data.get_buffer (), + sizeof (long)); + + guid_out.ptr () = guid; + } +} + +void +TAO_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +TAO_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +TAO_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +TAO_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +TAO_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +TAO_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +TAO_Scheduler::cancel (const RTScheduling::Current::IdType & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} diff --git a/TAO/tests/RTScheduling/Scheduler.h b/TAO/tests/RTScheduling/Scheduler.h new file mode 100644 index 00000000000..3147c40afd7 --- /dev/null +++ b/TAO/tests/RTScheduling/Scheduler.h @@ -0,0 +1,129 @@ +//$Id$ + +#ifndef SCHEDULER_H +#define SCHEDULER_H + +#include "tao/RTScheduling/RTScheduler.h" + +class TAO_Scheduler: +public RTScheduling::Scheduler, + public TAO_Local_RefCounted_Object +{ + public: + + TAO_Scheduler (CORBA::ORB_ptr orb); + + ~TAO_Scheduler (void); + + virtual CORBA::PolicyList * scheduling_policies (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void scheduling_policies (const CORBA::PolicyList & scheduling_policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::PolicyList * poa_policies (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual char * scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual RTScheduling::ResourceManager_ptr create_resource_manager (const char * name, + CORBA::Policy_ptr scheduling_parameter + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void set_scheduling_parameter (PortableServer::Servant & resource, + const char * name, + CORBA::Policy_ptr scheduling_parameter + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void begin_new_scheduling_segment (const RTScheduling::Current::IdType & guid, + const char * name, + CORBA::Policy_ptr sched_param, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void begin_nested_scheduling_segment (const RTScheduling::Current::IdType & guid, + const char * name, + CORBA::Policy_ptr sched_param, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void update_scheduling_segment (const RTScheduling::Current::IdType & guid, + const char * name, + CORBA::Policy_ptr sched_param, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void end_scheduling_segment (const RTScheduling::Current::IdType & guid, + const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType & guid, + const char * name, + CORBA::Policy_ptr outer_sched_param + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid, + CORBA::String_out name, + CORBA::Policy_out sched_param, + CORBA::Policy_out implicit_sched_param + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void cancel (const RTScheduling::Current::IdType & guid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + private: + RTScheduling::Current_var current_; +}; + +#endif //SCHEDULER_H + + + |