00001 // -*- C++ -*- 00002 00003 00004 //============================================================================= 00005 /** 00006 * @file Multi_Priority_Mapping.h 00007 * 00008 * $Id: Multi_Priority_Mapping.h 78627 2007-06-28 08:50:01Z johnnyw $ 00009 * 00010 * Declares a priority mapping to support cross platform communication. 00011 * 00012 * 00013 * @author Brian Mendel (brian.r.mendel@boeing.com) 00014 */ 00015 //============================================================================= 00016 00017 00018 #ifndef TAO_MULTI_PRIORITY_MAPPING_H 00019 #define TAO_MULTI_PRIORITY_MAPPING_H 00020 00021 #include "tao/orbconf.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 00028 00029 #include "tao/RTCORBA/Priority_Mapping.h" 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 /** 00034 * @class TAO_Multi_Priority_Mapping 00035 * 00036 * @brief An implementation of the Priority_Mapping interface for communication 00037 * between different platforms 00038 * 00039 * This implementation uses a custom mapping between the range of 00040 * priorities for a given scheduling class (ACE_SCHED_OTHER, 00041 * ACE_SCHED_FIFO, ACE_SCHED_RR) and the valid range of CORBA 00042 * priorities (0...32767) 00043 */ 00044 class TAO_RTCORBA_Export TAO_Multi_Priority_Mapping 00045 : public TAO_Priority_Mapping 00046 { 00047 public: 00048 /// Default constructor 00049 /** 00050 * @param base_native_priority The native priority to use for the highest 00051 * priority endpoint. 00052 * @param base_corba_priority The corba priority to use for the highest 00053 * priority endpoint 00054 * @param priority_spacing The priority increment to use between endpoints 00055 * @param priorities_contiguous Some platforms do use contiguous priorities 00056 * @param policy The scheduling policy to use. 00057 */ 00058 TAO_Multi_Priority_Mapping (int base_native_priority, 00059 int base_corba_priority, 00060 int priority_spacing = 1, 00061 int priorities_contiguous = 1, 00062 int policy = ACE_SCHED_FIFO); 00063 00064 /// The destructor 00065 virtual ~TAO_Multi_Priority_Mapping (void); 00066 00067 virtual CORBA::Boolean 00068 to_native (RTCORBA::Priority corba_priority, 00069 RTCORBA::NativePriority &native_priority); 00070 virtual CORBA::Boolean 00071 to_CORBA (RTCORBA::NativePriority native_priority, 00072 RTCORBA::Priority &corba_priority); 00073 00074 private: 00075 00076 /// The base settings 00077 int base_native_priority_; 00078 int base_corba_priority_; 00079 00080 const int priority_spacing_; 00081 const int priorities_contiguous_; 00082 00083 /// The scheduling policy 00084 int policy_; 00085 00086 /// The range 00087 int const min_; 00088 int const max_; 00089 }; 00090 00091 TAO_END_VERSIONED_NAMESPACE_DECL 00092 00093 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */ 00094 00095 #endif /* TAO_MULTI_PRIORITY_MAPPING_H */