00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef DIRECTPRIORITY_MAPPER_H 00009 #define DIRECTPRIORITY_MAPPER_H 00010 00011 #include "dds/DCPS/dcps_export.h" 00012 00013 #include "PriorityMapper.h" 00014 #include "ace/OS_NS_Thread.h" 00015 00016 namespace OpenDDS { 00017 namespace DCPS { 00018 00019 /** 00020 * @class DirectPriorityMapper 00021 * 00022 * @brief map TRANSPORT_PRIORITY values directly. 00023 * 00024 * This implementation maps TRANSPORT_PRIORITY values directly to 00025 * both DiffServ codepoint and thread priority values. The behavior 00026 * is saturating - that is when the TRANSPORT_PRIORITY value is out 00027 * of the target range, it is mapped to the nearest extremum. 00028 * 00029 * DiffServ codepoint values are mapped within the closed interval 00030 * [0,63], with the corresponding TRANSPORT_PRIORITY values mapped 00031 * directly within this range. 00032 * 00033 * Thread priorities are mapped to the system thread scheduler 00034 * minimum value (obtained from the sched_get_priority_min(sched) 00035 * system call, where available) up to the maximum value (obtained 00036 * from the sched_get_priority_max(sched) system call, where 00037 * available). The TRANSPORT_PRIORITY value of 0 is mapped to the 00038 * minimum and a value of |max-min| is mapped to the maximum. 00039 */ 00040 class OpenDDS_Dcps_Export DirectPriorityMapper : public PriorityMapper { 00041 public: 00042 /// Construct with a priority value. 00043 DirectPriorityMapper(Priority priority = 0); 00044 00045 /// Virtual destructor. 00046 virtual ~DirectPriorityMapper(); 00047 00048 /// Access the mapped DiffServ codepoint value. 00049 virtual short codepoint() const; 00050 00051 /// Access the mapped thread priority value. 00052 virtual short thread_priority() const; 00053 }; 00054 00055 } // namespace DCPS 00056 } // namespace OpenDDS 00057 00058 #if defined (__ACE_INLINE__) 00059 #include "DirectPriorityMapper.inl" 00060 #endif /* __ACE_INLINE__ */ 00061 00062 #endif /* DIRECTPRIORITY_MAPPER_H */