PriorityMapper.h

Go to the documentation of this file.
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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 namespace OpenDDS {
00018 namespace DCPS {
00019 
00020 /**
00021  * @class PriorityMapper
00022  *
00023  * @brief Encapsulate a TRANSPORT_PRIORITY value.
00024  *
00025  * This interface allows a TRANSPORT_PRIORIY value to be mapped to
00026  * values to use as DiffServ codepoint and thread priority values.
00027  * Specific implementations of this interface can define specific
00028  * mapping algorithms for conversion from the basic
00029  * TRANSPORT_PRIORITY value to the values to use for network and
00030  * thread prirorities.
00031  *
00032  * We take our cue from the RTCORBA code base in defining the types
00033  * of the priority values mapped to.  RTCORBA defines both the
00034  * network and thread priority values as shorts.  Since this is well
00035  * within the expected range of priority values to be mapped to and
00036  * the short value can be expanded into larger types without
00037  * complaint, this priority type should be without problem here.
00038  */
00039 class OpenDDS_Dcps_Export PriorityMapper {
00040 public:
00041   /// Construct with a priority value.
00042   PriorityMapper(Priority priority = 0);
00043 
00044   virtual ~PriorityMapper();
00045 
00046   /// Accessors for the TRANSPORT_PRIORITY value.
00047   Priority& priority();
00048   Priority  priority() const;
00049 
00050   /// Access the mapped DiffServ codepoint value.
00051   virtual short codepoint() const = 0;
00052 
00053   /// Access the mapped thread priority value.
00054   virtual short thread_priority() const = 0;
00055 
00056 private:
00057   /// The TRANSPORT_PRIORITY value.
00058   Priority priority_;
00059 };
00060 
00061 } // namespace DCPS
00062 } // namespace OpenDDS
00063 
00064 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00065 
00066 #if defined (__ACE_INLINE__)
00067 #include "PriorityMapper.inl"
00068 #endif /* __ACE_INLINE__ */
00069 
00070 #endif  /* PRIORITY_MAPPER_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1