00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef PRIORITY_MAPPER_H 00009 #define PRIORITY_MAPPER_H 00010 00011 #include "dds/DCPS/dcps_export.h" 00012 00013 #include "TransportDefs.h" 00014 00015 namespace OpenDDS { 00016 namespace DCPS { 00017 00018 /** 00019 * @class PriorityMapper 00020 * 00021 * @brief Encapsulate a TRANSPORT_PRIORITY value. 00022 * 00023 * This interface allows a TRANSPORT_PRIORIY value to be mapped to 00024 * values to use as DiffServ codepoint and thread priority values. 00025 * Specific implementations of this interface can define specific 00026 * mapping algorithms for conversion from the basic 00027 * TRANSPORT_PRIORITY value to the values to use for network and 00028 * thread prirorities. 00029 * 00030 * We take our cue from the RTCORBA code base in defining the types 00031 * of the priority values mapped to. RTCORBA defines both the 00032 * network and thread priority values as shorts. Since this is well 00033 * within the expected range of priority values to be mapped to and 00034 * the short value can be expanded into larger types without 00035 * complaint, this priority type should be without problem here. 00036 */ 00037 class OpenDDS_Dcps_Export PriorityMapper { 00038 public: 00039 /// Construct with a priority value. 00040 PriorityMapper(Priority priority = 0); 00041 00042 /// Virtual destructor. 00043 virtual ~PriorityMapper(); 00044 00045 /// Accessors for the TRANSPORT_PRIORITY value. 00046 Priority& priority(); 00047 Priority priority() const; 00048 00049 /// Access the mapped DiffServ codepoint value. 00050 virtual short codepoint() const = 0; 00051 00052 /// Access the mapped thread priority value. 00053 virtual short thread_priority() const = 0; 00054 00055 private: 00056 /// The TRANSPORT_PRIORITY value. 00057 Priority priority_; 00058 }; 00059 00060 } // namespace DCPS 00061 } // namespace OpenDDS 00062 00063 #if defined (__ACE_INLINE__) 00064 #include "PriorityMapper.inl" 00065 #endif /* __ACE_INLINE__ */ 00066 00067 #endif /* PRIORITY_MAPPER_H */