OpenDDS  Snapshot(2023/04/28-20:55)
DirectPriorityMapper.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TRANSPORT_FRAMEWORK_DIRECTPRIORITYMAPPER_H
9 #define OPENDDS_DCPS_TRANSPORT_FRAMEWORK_DIRECTPRIORITYMAPPER_H
10 
11 #include "dds/DCPS/dcps_export.h"
12 
13 #include "PriorityMapper.h"
14 #include "ace/OS_NS_Thread.h"
15 
17 
18 namespace OpenDDS {
19 namespace DCPS {
20 
21 /**
22  * @class DirectPriorityMapper
23  *
24  * @brief map TRANSPORT_PRIORITY values directly.
25  *
26  * This implementation maps TRANSPORT_PRIORITY values directly to
27  * both DiffServ codepoint and thread priority values. The behavior
28  * is saturating - that is when the TRANSPORT_PRIORITY value is out
29  * of the target range, it is mapped to the nearest extremum.
30  *
31  * DiffServ codepoint values are mapped within the closed interval
32  * [0,63], with the corresponding TRANSPORT_PRIORITY values mapped
33  * directly within this range.
34  *
35  * Thread priorities are mapped to the system thread scheduler
36  * minimum value (obtained from the sched_get_priority_min(sched)
37  * system call, where available) up to the maximum value (obtained
38  * from the sched_get_priority_max(sched) system call, where
39  * available). The TRANSPORT_PRIORITY value of 0 is mapped to the
40  * minimum and a value of |max-min| is mapped to the maximum.
41  */
43 public:
44  /// Construct with a priority value.
45  DirectPriorityMapper(Priority priority = 0);
46 
47  virtual ~DirectPriorityMapper();
48 
49  /// Access the mapped DiffServ codepoint value.
50  virtual short codepoint() const;
51 
52  /// Access the mapped thread priority value.
53  virtual short thread_priority() const;
54 };
55 
56 } // namespace DCPS
57 } // namespace OpenDDS
58 
60 
61 #if defined (__ACE_INLINE__)
62 #include "DirectPriorityMapper.inl"
63 #endif /* __ACE_INLINE__ */
64 
65 #endif /* DIRECTPRIORITY_MAPPER_H */
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
map TRANSPORT_PRIORITY values directly.
ACE_CDR::Long Priority
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
Encapsulate a TRANSPORT_PRIORITY value.
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28