QOS_Common.cpp

Go to the documentation of this file.
00001 
00002 #include "QOS_Common.h"
00003 
00004 void
00005 QosCommon::get_durability_kind (const ::dds::durabilityKind kind,
00006                                 ::DDS::DurabilityQosPolicyKind& dds_kind)
00007 {
00008   switch (kind.integral ())
00009     {
00010     case ::dds::durabilityKind::VOLATILE_DURABILITY_QOS_l:
00011       dds_kind = ::DDS::VOLATILE_DURABILITY_QOS;
00012       break;
00013     case ::dds::durabilityKind::TRANSIENT_LOCAL_DURABILITY_QOS_l:
00014       dds_kind = ::DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
00015       break;
00016     case ::dds::durabilityKind::TRANSIENT_DURABILITY_QOS_l:
00017       dds_kind = ::DDS::TRANSIENT_DURABILITY_QOS;
00018       break;
00019     case ::dds::durabilityKind::PERSISTENT_DURABILITY_QOS_l:
00020       dds_kind = ::DDS::PERSISTENT_DURABILITY_QOS;
00021       break;
00022     default:
00023       ACE_ERROR ((LM_DEBUG,
00024         ACE_TEXT ("QosCommon::get_durability_kind - ")
00025         ACE_TEXT ("Unknown durability kind found <%d>; returning VOLATILE_DURABILITY_QOS\n"),
00026         kind.integral ()));
00027       dds_kind = ::DDS::VOLATILE_DURABILITY_QOS;
00028       break;
00029     }
00030 }
00031 
00032 void
00033 QosCommon::get_history_kind (const ::dds::historyKind kind,
00034                              ::DDS::HistoryQosPolicyKind& dds_kind)
00035 {
00036   switch (kind.integral ())
00037     {
00038     case ::dds::historyKind::KEEP_ALL_HISTORY_QOS_l:
00039       dds_kind = ::DDS::KEEP_ALL_HISTORY_QOS;
00040       break;
00041     case ::dds::historyKind::KEEP_LAST_HISTORY_QOS_l:
00042       dds_kind = ::DDS::KEEP_LAST_HISTORY_QOS;
00043       break;
00044     default:
00045       ACE_ERROR ((LM_DEBUG,
00046         ACE_TEXT ("QosCommon::get_history_kind - ")
00047         ACE_TEXT ("Unknown history kind found <%d>; returning KEEP_ALL_HISTORY_QOS\n"),
00048         kind.integral ()));
00049       dds_kind = ::DDS::KEEP_ALL_HISTORY_QOS;
00050       break;
00051     }
00052 }
00053 
00054 void
00055 QosCommon::get_duration (::DDS::Duration_t& duration, const ACE_TCHAR * sec, const ACE_TCHAR * nsec)
00056 {
00057   if (ACE_OS::strcmp (sec, "DURATION_INFINITY") == 0 ||
00058       ACE_OS::strcmp (sec, "DURATION_INFINITE_SEC") == 0)
00059     {
00060       duration.sec = 0x7fffffff;
00061     }
00062   else
00063     {
00064       duration.sec = ACE_OS::atoi (sec);
00065     }
00066 
00067   if (ACE_OS::strcmp (nsec, "DURATION_INFINITY") == 0 ||
00068       ACE_OS::strcmp (nsec, "DURATION_INFINITE_NSEC") == 0)
00069     {
00070       duration.nanosec =  0x7fffffff;
00071     }
00072   else
00073     {
00074       duration.nanosec = ACE_OS::atoi (nsec);
00075     }
00076 }
00077 
00078 ::CORBA::Long
00079 QosCommon::get_qos_long(const ACE_TCHAR* value)
00080 {
00081   if (ACE_OS::strcmp (value, "LENGTH_UNLIMITED") == 0)
00082     {
00083       return -1;
00084     }
00085   else
00086     {
00087       return atoi (value);
00088     }
00089 }
00090 
00091 void
00092 QosCommon::get_liveliness_kind (const ::dds::livelinessKind kind,
00093                                 ::DDS::LivelinessQosPolicyKind& dds_kind)
00094 {
00095   switch (kind.integral ())
00096     {
00097     case ::dds::livelinessKind::AUTOMATIC_LIVELINESS_QOS_l:
00098       dds_kind = ::DDS::AUTOMATIC_LIVELINESS_QOS;
00099       break;
00100     case ::dds::livelinessKind::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS_l:
00101       dds_kind = ::DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
00102       break;
00103     case ::dds::livelinessKind::MANUAL_BY_TOPIC_LIVELINESS_QOS_l:
00104       dds_kind = ::DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
00105       break;
00106     default:
00107       ACE_ERROR ((LM_DEBUG,
00108         ACE_TEXT ("QosCommon::get_liveliness_kind - ")
00109         ACE_TEXT ("Unknown liveliness kind found <%d>; returning AUTOMATIC_LIVELINESS_QOS\n"),
00110         kind.integral ()));
00111       dds_kind = ::DDS::AUTOMATIC_LIVELINESS_QOS;
00112       break;
00113     }
00114 }
00115 
00116 void
00117 QosCommon::get_realiability_kind (const ::dds::reliabilityKind kind,
00118                                   ::DDS::ReliabilityQosPolicyKind& dds_kind)
00119 {
00120   switch (kind.integral ())
00121     {
00122     case ::dds::reliabilityKind::BEST_EFFORT_RELIABILITY_QOS_l:
00123       dds_kind = ::DDS::BEST_EFFORT_RELIABILITY_QOS;
00124       break;
00125     case ::dds::reliabilityKind::RELIABLE_RELIABILITY_QOS_l:
00126       dds_kind = ::DDS::RELIABLE_RELIABILITY_QOS;
00127       break;
00128     default:
00129       ACE_ERROR ((LM_DEBUG,
00130         ACE_TEXT ("QosCommon::get_liveliness_kind - ")
00131         ACE_TEXT ("Unknown reliability kind found <%d>; returning BEST_EFFORT_RELIABILITY_QOS\n"),
00132         kind.integral ()));
00133       dds_kind = ::DDS::BEST_EFFORT_RELIABILITY_QOS;
00134       break;
00135     }
00136 }
00137 
00138 void
00139 QosCommon::get_destination_order_kind (const ::dds::destinationOrderKind kind,
00140                                        ::DDS::DestinationOrderQosPolicyKind& dds_kind)
00141 {
00142   switch (kind.integral ())
00143     {
00144     case ::dds::destinationOrderKind::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS_l:
00145       dds_kind = ::DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
00146       break;
00147     case ::dds::destinationOrderKind::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS_l:
00148       dds_kind = ::DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
00149       break;
00150     default:
00151       ACE_ERROR ((LM_DEBUG,
00152         ACE_TEXT ("QosCommon::get_destination_order_kind - ")
00153         ACE_TEXT ("Unknown destination order kind found <%d>; returning BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS\n"),
00154         kind.integral ()));
00155       dds_kind = ::DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
00156       break;
00157     }
00158 }
00159 
00160 void
00161 QosCommon::get_ownership_kind (const ::dds::ownershipKind kind,
00162                                ::DDS::OwnershipQosPolicyKind& dds_kind)
00163 {
00164   switch (kind.integral ())
00165     {
00166     case ::dds::ownershipKind::SHARED_OWNERSHIP_QOS_l:
00167       dds_kind = ::DDS::SHARED_OWNERSHIP_QOS;
00168       break;
00169     case ::dds::ownershipKind::EXCLUSIVE_OWNERSHIP_QOS_l:
00170       dds_kind = ::DDS::EXCLUSIVE_OWNERSHIP_QOS;
00171       break;
00172     default:
00173       ACE_ERROR ((LM_DEBUG,
00174         ACE_TEXT ("QosCommon::get_ownership_kind - ")
00175         ACE_TEXT ("Unknown ownership kind found <%d>; returning SHARED_OWNERSHIP_QOS\n"),
00176         kind.integral ()));
00177       dds_kind = ::DDS::SHARED_OWNERSHIP_QOS;
00178       break;
00179     }
00180 }

Generated on Fri Feb 12 20:05:24 2016 for OpenDDS by  doxygen 1.4.7