diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/orbsvcs/tests/Notify/RT_lib | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/RT_lib')
10 files changed, 768 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/Makefile.am b/TAO/orbsvcs/tests/Notify/RT_lib/Makefile.am new file mode 100644 index 00000000000..e665d59cb88 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/Makefile.am @@ -0,0 +1,57 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ../bin/mwc.pl -type automake -noreldefs TAO.mwc + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_ROOT = $(top_srcdir) + + +## Makefile.RT_Notify_lib.am + +if BUILD_CORBA_MESSAGING +if BUILD_RT_CORBA +if !BUILD_MINIMUM_CORBA + +noinst_LTLIBRARIES = libTAO_RT_NotifyTests.la + +libTAO_RT_NotifyTests_la_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs \ + -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \ + -DTAO_HAS_TYPED_EVENT_CHANNEL \ + -DTAO_RT_NOTIFY_TEST_BUILD_DLL + +libTAO_RT_NotifyTests_la_SOURCES = \ + RT_Application_Command.cpp \ + RT_Factories_Define.cpp \ + RT_POA_Command.cpp \ + RT_Priority_Mapping.cpp + +noinst_HEADERS = \ + RT_Application_Command.h \ + RT_POA_Command.h \ + RT_Priority_Mapping.h + +endif !BUILD_MINIMUM_CORBA +endif BUILD_RT_CORBA +endif BUILD_CORBA_MESSAGING + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.cpp b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.cpp new file mode 100644 index 00000000000..7bb9c0d3801 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.cpp @@ -0,0 +1,35 @@ +// $Id$ + +#include "RT_Application_Command.h" + +ACE_RCSID(lib, TAO_RT_Application_Command, "$Id$") + +#include "../lib/LookupManager.h" +#include "RT_Priority_Mapping.h" + +TAO_Notify_Tests_RT_Application_Command::TAO_Notify_Tests_RT_Application_Command (void) +{ +} + +TAO_Notify_Tests_RT_Application_Command::~TAO_Notify_Tests_RT_Application_Command () +{ +} + +void +TAO_Notify_Tests_RT_Application_Command::handle_init (ACE_ENV_SINGLE_ARG_DECL) +{ + // Call the Base class. + TAO_Notify_Tests_Application_Command::handle_init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::ORB_var orb; + + LOOKUP_MANAGER->resolve (orb); + + TAO_Notify_Tests_RT_Priority_Mapping* mapping = new TAO_Notify_Tests_RT_Priority_Mapping (); + + mapping->init (orb.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + LOOKUP_MANAGER->_register (mapping); +} diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.h b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.h new file mode 100644 index 00000000000..34376e99515 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Application_Command.h @@ -0,0 +1,43 @@ +/* -*- C++ -*- */ +/** + * @file RT_Application_Command.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_Notify_Tests_RT_APPLICATION_COMMAND_H +#define TAO_Notify_Tests_RT_APPLICATION_COMMAND_H +#include /**/ "ace/pre.h" + +#include "rt_notify_test_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "../lib/Application_Command.h" + +/** + * @class TAO_Notify_Tests_RT_Application_Command + * + * @brief + * + */ +class TAO_RT_NOTIFY_TEST_Export TAO_Notify_Tests_RT_Application_Command : public TAO_Notify_Tests_Application_Command +{ +public: + /// Constuctor + TAO_Notify_Tests_RT_Application_Command (void); + + /// Destructor + ~TAO_Notify_Tests_RT_Application_Command (); + + virtual void handle_init (ACE_ENV_SINGLE_ARG_DECL); +}; + +#include /**/ "ace/post.h" +#endif /* TAO_Notify_Tests_RT_APPLICATION_COMMAND_H */ diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Factories_Define.cpp b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Factories_Define.cpp new file mode 100644 index 00000000000..35be49f7be6 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Factories_Define.cpp @@ -0,0 +1,13 @@ +// $Id$ +#include "../lib/Factories_Define.h" + +ACE_RCSID(lib, TAO_Notify_Tests_Factories_Define, "$Id$") + +#include "rt_notify_test_export.h" +#include "../lib/Name.h" +#include "../lib/Command_Factory_T.h" +#include "RT_POA_Command.h" +#include "RT_Application_Command.h" + +TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_RT_NOTIFY_TEST,TAO_Notify_Tests_RT_POA_Command,TAO_Notify_Tests_Name::poa_command_factory) +TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_RT_NOTIFY_TEST,TAO_Notify_Tests_RT_Application_Command,TAO_Notify_Tests_Name::application_command_factory) diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Notify_lib.mpc b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Notify_lib.mpc new file mode 100644 index 00000000000..caaf2d4cb8f --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Notify_lib.mpc @@ -0,0 +1,16 @@ +// -*- MPC -*- +// $Id$ + +project: orbsvcslib, notification, rtcorba, rtportableserver, notifytest, minimum_corba { + + sharedname = TAO_RT_NotifyTests + + dynamicflags = TAO_RT_NOTIFY_TEST_BUILD_DLL + + Source_Files{ + RT_Application_Command.cpp + RT_POA_Command.cpp + RT_Priority_Mapping.cpp + RT_Factories_Define.cpp + } +} diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.cpp b/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.cpp new file mode 100644 index 00000000000..4d9aa177a6c --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.cpp @@ -0,0 +1,390 @@ +// $Id$ + +#include "RT_POA_Command.h" + +ACE_RCSID(lib, TAO_RT_POA_Command, "$Id$") + +#include "tao/debug.h" +#include "../lib/LookupManager.h" +#include "../lib/Name.h" + +TAO_Notify_Tests_RT_POA_Command::TAO_Notify_Tests_RT_POA_Command (void) + :priority_model_ (RTCORBA::CLIENT_PROPAGATED) + , server_priority_ (0) + , thread_pool_static_threads_ (0) + , thread_pool_default_priority_ (0) +{ +} + +TAO_Notify_Tests_RT_POA_Command::~TAO_Notify_Tests_RT_POA_Command () +{ +} + +const char* +TAO_Notify_Tests_RT_POA_Command::get_name (void) +{ + return TAO_Notify_Tests_RT_POA_Command::name (); +} + +const char* +TAO_Notify_Tests_RT_POA_Command::name (void) +{ + return TAO_Notify_Tests_Name::poa_command; +} + +void +TAO_Notify_Tests_RT_POA_Command::init (ACE_Arg_Shifter& arg_shifter) +{ + const ACE_TCHAR *current_arg = 0; + + if (arg_shifter.is_anything_left ()) + { + if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0) + { + this->command_ = CREATE; + + arg_shifter.consume_arg (); + + this->POA_name_ = arg_shifter.get_current (); + + arg_shifter.consume_arg (); + + while (arg_shifter.is_anything_left ()) + { + if ((current_arg = arg_shifter.get_the_parameter ("-PriorityModel"))) + { + if (arg_shifter.cur_arg_strncasecmp ("CLIENT") == 0) + priority_model_ = RTCORBA::CLIENT_PROPAGATED; + else + priority_model_ = RTCORBA::SERVER_DECLARED; + arg_shifter.consume_arg (); + + server_priority_ = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + + continue; + } + // -Lanes lane-count -Lane prio statc_thr dyn_thr + if ((current_arg = arg_shifter.get_the_parameter ("-Lanes"))) + { + int lanecount = ACE_OS::atoi (current_arg); + lanes_.length (lanecount); + arg_shifter.consume_arg (); + + int l_index = 0; + //parse lane values ... + while (arg_shifter.is_anything_left ()) + { + if (arg_shifter.cur_arg_strncasecmp ("-Lane") == 0) + { + arg_shifter.consume_arg (); + + // read priority + lanes_[l_index].lane_priority = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + // static thread count + lanes_[l_index].static_threads = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + // dynamic thread count + lanes_[l_index].dynamic_threads = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "POA Create: lane parsed - %d, %d, %d\n", + lanes_[l_index].lane_priority, lanes_[l_index].static_threads, lanes_[l_index].dynamic_threads)); + l_index++; + } + else + break; + } /* while -- lane values */ + + continue; + } /* if -Lanes */ + + if ((current_arg = arg_shifter.get_the_parameter ("-Bands"))) + { + int bandcount = ACE_OS::atoi (current_arg); + bands_.length (bandcount); + arg_shifter.consume_arg (); + + int b_index = 0; + //parse band values ... + while (arg_shifter.is_anything_left ()) + { + if (arg_shifter.cur_arg_strncasecmp ("-Band") == 0) + { + arg_shifter.consume_arg (); + + // read low + bands_[b_index].low = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + // read high + bands_[b_index].high = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "POA Create: band parsed - %d, %d \n", + bands_[b_index].low, bands_[b_index].high)); + b_index++; + } + else + break; + } /* while -- Band values */ + + continue; + } /* if -Bands */ + + // -ThreadPool thread_pool_count thread_pool_default_priority + if (arg_shifter.cur_arg_strncasecmp ("-ThreadPool") == 0) + { + arg_shifter.consume_arg (); + + current_arg = arg_shifter.get_current (); + this->thread_pool_static_threads_ = ACE_OS::atoi (current_arg); + + arg_shifter.consume_arg (); + + current_arg = arg_shifter.get_current (); + this->thread_pool_default_priority_ = ACE_OS::atoi (current_arg); + + arg_shifter.consume_arg (); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "ThreadPool parsed - static threads = %d, prio = %d \n", + this->thread_pool_static_threads_, this->thread_pool_default_priority_)); + + continue; + } /* ThreadPool */ + + // none of the matched so break out... + break; + } /* while */ + } + else if (arg_shifter.cur_arg_strncasecmp ("-Destroy") == 0) + { + this->command_ = DESTROY; + + arg_shifter.consume_arg (); + + this->POA_name_ = arg_shifter.get_current (); + + arg_shifter.consume_arg (); + } + } /* if */ +} + +void +TAO_Notify_Tests_RT_POA_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL) +{ + if (this->command_ == CREATE) + { + // Resolve ORB + CORBA::ORB_var orb; + + LOOKUP_MANAGER->resolve (orb); + + // Resolve RTORB + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Resolve parent poa. + PortableServer::POA_var parent_poa; + + LOOKUP_MANAGER->resolve (parent_poa); + + // Create the POA. + this->create (rt_orb.in (), parent_poa.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Created RT POA %s\n", this->POA_name_.c_str ())); + } + else if (this->command_ == DESTROY) + { + PortableServer::POA_var poa; + + LOOKUP_MANAGER->resolve (poa, this->POA_name_.c_str () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + poa->destroy (1,0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Destroyed RT POA %s\n", this->POA_name_.c_str ())); + } +} + +void +TAO_Notify_Tests_RT_POA_Command::create (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL) +{ + /* + lanes bands priomodel + + if lanes create lanespolicy + if bands create bands policy + + if lanes and bands , policy_list_length = 3 + else + if lanes policy_list_length = 2 + else + if threadpool and bands , policy_list_length = 3 + else + if threadpool policy_list_length = 2 + else + if bands policy_list_length = 2 + else + policy_list_length = 1 + + */ + + CORBA::Policy_var priority_model_policy; + CORBA::Policy_var lanes_policy; + CORBA::Policy_var thread_pool_policy; + CORBA::Policy_var bands_policy; + + // Create a priority model policy. + priority_model_policy = + rt_orb->create_priority_model_policy (priority_model_, + server_priority_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (lanes_.length () != 0) + { + // Create a thread-pool. + CORBA::ULong stacksize = 0; + CORBA::Boolean allow_request_buffering = 0; + CORBA::ULong max_buffered_requests = 0; + CORBA::ULong max_request_buffer_size = 0; + CORBA::Boolean allow_borrowing = 0; + // CORBA::ULong static_threads = 1; + // CORBA::ULong dynamic_threads = 0; + + // Create the thread-pool. + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool_with_lanes (stacksize, + lanes_, + allow_borrowing, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Create a thread-pool policy. + lanes_policy = + rt_orb->create_threadpool_policy (threadpool_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + else if (thread_pool_static_threads_ > 0) + { + CORBA::ULong stacksize = 0; + CORBA::ULong static_threads = this->thread_pool_static_threads_; + CORBA::ULong dynamic_threads = 0; + RTCORBA::Priority default_priority = this->thread_pool_default_priority_; + CORBA::Boolean allow_request_buffering = 0; + CORBA::ULong max_buffered_requests = 0; + CORBA::ULong max_request_buffer_size = 0; + + // Create the thread-pool. + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (stacksize, + static_threads, + dynamic_threads, + default_priority, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + thread_pool_policy = + rt_orb->create_threadpool_policy (threadpool_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + if (bands_.length () != 0) + { + // Create a bands policy. + bands_policy = + rt_orb->create_priority_banded_connection_policy (this->bands_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + CORBA::PolicyList poa_policy_list; + + CORBA::Policy_var activation_policy = + parent_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (lanes_.length () == 0 && thread_pool_static_threads_ == 0 && bands_.length () == 0) + { + poa_policy_list.length (1); + poa_policy_list[0] = priority_model_policy; + } + else if (lanes_.length () == 0 && thread_pool_static_threads_ == 0 && bands_.length () > 0) + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = bands_policy; + } + else if (lanes_.length () == 0 && thread_pool_static_threads_ > 0 && bands_.length () == 0) + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = thread_pool_policy; + } + else if (lanes_.length () == 0 && thread_pool_static_threads_ > 0 && bands_.length () > 0) + { + poa_policy_list.length (3); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = bands_policy; + poa_policy_list[2] = thread_pool_policy; + } + else if (lanes_.length () > 0 && thread_pool_static_threads_ == 0 && bands_.length () == 0) + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = lanes_policy; + } + else if (lanes_.length () > 0 && thread_pool_static_threads_ == 0 && bands_.length () > 0) + { + poa_policy_list.length (3); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = bands_policy; + poa_policy_list[2] = lanes_policy; + } + + // Add the activation policy + int act_index = poa_policy_list.length (); + poa_policy_list.length (act_index + 1); + + poa_policy_list[act_index] = activation_policy; + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "creating POA %s\n", POA_name_.c_str ())); + + // Get the POA Manager. + PortableServer::POAManager_var poa_manager = + parent_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + parent_poa->create_POA (POA_name_.c_str (), + poa_manager.in (), + poa_policy_list + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.h b/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.h new file mode 100644 index 00000000000..b5bcb27a825 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_POA_Command.h @@ -0,0 +1,81 @@ +/* -*- C++ -*- */ +/** + * @file RT_POA_Command.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_Notify_Tests_RT_POA_COMMAND_H +#define TAO_Notify_Tests_RT_POA_COMMAND_H +#include /**/ "ace/pre.h" + +#include "rt_notify_test_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/PortableServer/PortableServer.h" +#include "../lib/Command.h" +#include "ace/SString.h" + +/** + * @class TAO_Notify_Tests_RT_POA_Command + * + * @brief Command for managing RTCORBA POAs. + * + */ +class TAO_RT_NOTIFY_TEST_Export TAO_Notify_Tests_RT_POA_Command : public TAO_Notify_Tests_Command +{ +public: + /// Constuctor + TAO_Notify_Tests_RT_POA_Command (void); + + /// Destructor + ~TAO_Notify_Tests_RT_POA_Command (); + + /// Parse args and populate options. + /// The arg_shifter options are read in the following manner: -Create <name> -PriorityModel <CLIENT|SERVER> <priority> -Lanes <count> (-Lane <priority> ,<static_threads> <dynamic_threads>)* -Bands <count> (-Band <low> <high>)* + virtual void init (ACE_Arg_Shifter& arg_shifter); + + /// Execute the command. + virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL); + + /// Get the command name. + virtual const char* get_name (void); + static const char* name (void); + +protected: + /// Create the POA with the params parsed. + void create (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL); + +#ifdef HPUX_11 + // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h +#undef COMMAND +#endif + enum COMMAND + { + CREATE, + DESTROY, + DUMP_STATE + }; + + ACE_CString POA_name_; + + RTCORBA::PriorityModel priority_model_; + RTCORBA::Priority server_priority_; + RTCORBA::ThreadpoolLanes lanes_; + RTCORBA::PriorityBands bands_; + + CORBA::ULong thread_pool_static_threads_; + RTCORBA::Priority thread_pool_default_priority_; +}; + +#include /**/ "ace/post.h" +#endif /* TAO_Notify_Tests_RT_POA_COMMAND_H */ diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.cpp b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.cpp new file mode 100644 index 00000000000..ee30db74bd1 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.cpp @@ -0,0 +1,40 @@ +// $Id$ + +#include "RT_Priority_Mapping.h" + +ACE_RCSID(lib, RT_Priority_Mapping, "$Id$") + +#include "../lib/LookupManager.h" + +TAO_Notify_Tests_RT_Priority_Mapping::~TAO_Notify_Tests_RT_Priority_Mapping (void) +{ +} + +void +TAO_Notify_Tests_RT_Priority_Mapping::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + CORBA::Object_var object = orb->resolve_initial_references ("PriorityMappingManager" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::PriorityMappingManager_var mapping_manager = + RTCORBA::PriorityMappingManager::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->priority_mapping_ = mapping_manager->mapping (); +} + +CORBA::Boolean +TAO_Notify_Tests_RT_Priority_Mapping::to_native (RTCORBA::Priority corba_priority, + RTCORBA::NativePriority &native_priority) +{ + return this->priority_mapping_->to_native (corba_priority, native_priority); +} + +CORBA::Boolean +TAO_Notify_Tests_RT_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority, + RTCORBA::Priority &corba_priority) +{ + return this->priority_mapping_->to_CORBA (native_priority, corba_priority); +} diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.h b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.h new file mode 100644 index 00000000000..0e8d308e656 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/RT_Priority_Mapping.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +/** + * @file RT_Priority_Mapping.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_Notify_Tests_RT_PRIORITY_MAPPING_H +#define TAO_Notify_Tests_RT_PRIORITY_MAPPING_H +#include /**/ "ace/pre.h" + +#include "rt_notify_test_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "../lib/Priority_Mapping.h" +#include "tao/RTCORBA/Priority_Mapping_Manager.h" + +/** + * @class TAO_Notify_Tests_RT_Priority_Mapping + * + * @brief Delegates to a RTCORBA::PriorityMapping + * + */ +class TAO_RT_NOTIFY_TEST_Export TAO_Notify_Tests_RT_Priority_Mapping : public TAO_Notify_Tests_Priority_Mapping +{ +public: + /// The destructor + virtual ~TAO_Notify_Tests_RT_Priority_Mapping (void); + + /// Init the Mapping manager. + void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + + virtual CORBA::Boolean + to_native (CORBA::Short corba_priority, + CORBA::Short &native_priority); + virtual CORBA::Boolean + to_CORBA (CORBA::Short native_priority, + CORBA::Short &corba_priority); + +protected: + + /// The Priority Mapping helper. + RTCORBA::PriorityMapping *priority_mapping_; +}; + +#include /**/ "ace/post.h" +#endif /* TAO_Notify_Tests_RT_PRIORITY_MAPPING_H */ diff --git a/TAO/orbsvcs/tests/Notify/RT_lib/rt_notify_test_export.h b/TAO/orbsvcs/tests/Notify/RT_lib/rt_notify_test_export.h new file mode 100644 index 00000000000..356b8f92976 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/RT_lib/rt_notify_test_export.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef TAO_RT_NOTIFY_TEST_EXPORT_H +#define TAO_RT_NOTIFY_TEST_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (TAO_RT_NOTIFY_TEST_HAS_DLL) +# define TAO_RT_NOTIFY_TEST_HAS_DLL 0 +# endif /* ! TAO_RT_NOTIFY_TEST_HAS_DLL */ +#else +# if !defined (TAO_RT_NOTIFY_TEST_HAS_DLL) +# define TAO_RT_NOTIFY_TEST_HAS_DLL 1 +# endif /* ! TAO_RT_NOTIFY_TEST_HAS_DLL */ +#endif + +#if defined (TAO_RT_NOTIFY_TEST_HAS_DLL) && (TAO_RT_NOTIFY_TEST_HAS_DLL == 1) +# if defined (TAO_RT_NOTIFY_TEST_BUILD_DLL) +# define TAO_RT_NOTIFY_TEST_Export ACE_Proper_Export_Flag +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_RT_NOTIFY_TEST_BUILD_DLL */ +# define TAO_RT_NOTIFY_TEST_Export ACE_Proper_Import_Flag +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_RT_NOTIFY_TEST_BUILD_DLL */ +#else /* TAO_RT_NOTIFY_TEST_HAS_DLL == 1 */ +# define TAO_RT_NOTIFY_TEST_Export +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARATION(T) +# define TAO_RT_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_RT_NOTIFY_TEST_HAS_DLL == 1 */ + +#endif /* TAO_RT_NOTIFY_TEST_EXPORT_H */ + +// End of auto generated file. |