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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 /** 00022 * @class DirectPriorityMapper 00023 * 00024 * @brief map TRANSPORT_PRIORITY values directly. 00025 * 00026 * This implementation maps TRANSPORT_PRIORITY values directly to 00027 * both DiffServ codepoint and thread priority values. The behavior 00028 * is saturating - that is when the TRANSPORT_PRIORITY value is out 00029 * of the target range, it is mapped to the nearest extremum. 00030 * 00031 * DiffServ codepoint values are mapped within the closed interval 00032 * [0,63], with the corresponding TRANSPORT_PRIORITY values mapped 00033 * directly within this range. 00034 * 00035 * Thread priorities are mapped to the system thread scheduler 00036 * minimum value (obtained from the sched_get_priority_min(sched) 00037 * system call, where available) up to the maximum value (obtained 00038 * from the sched_get_priority_max(sched) system call, where 00039 * available). The TRANSPORT_PRIORITY value of 0 is mapped to the 00040 * minimum and a value of |max-min| is mapped to the maximum. 00041 */ 00042 class OpenDDS_Dcps_Export DirectPriorityMapper : public PriorityMapper { 00043 public: 00044 /// Construct with a priority value. 00045 DirectPriorityMapper(Priority priority = 0); 00046 00047 virtual ~DirectPriorityMapper(); 00048 00049 /// Access the mapped DiffServ codepoint value. 00050 virtual short codepoint() const; 00051 00052 /// Access the mapped thread priority value. 00053 virtual short thread_priority() const; 00054 }; 00055 00056 } // namespace DCPS 00057 } // namespace OpenDDS 00058 00059 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00060 00061 #if defined (__ACE_INLINE__) 00062 #include "DirectPriorityMapper.inl" 00063 #endif /* __ACE_INLINE__ */ 00064 00065 #endif /* DIRECTPRIORITY_MAPPER_H */