Qos_Helper.inl

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 #include "Service_Participant.h"
00009 
00010 #include "ace/OS_NS_string.h"
00011 #include "ace/Truncate.h"
00012 
00013 namespace {
00014 
00015 const ACE_UINT32 NSECS_IN_SEC = 1000000000;
00016 
00017 } // namespace
00018 
00019 namespace OpenDDS {
00020 namespace DCPS {
00021 
00022 // These operators are used in some inline functions below.  Some
00023 // compilers require the inline definition to appear before its use.
00024 #ifndef OPENDDS_SAFETY_PROFILE
00025 ACE_INLINE
00026 bool operator==(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00027 {
00028   return t1.sec == t2.sec && t1.nanosec == t2.nanosec;
00029 }
00030 
00031 ACE_INLINE
00032 bool operator!=(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00033 {
00034   return !(t1 == t2);
00035 }
00036 #endif
00037 
00038 ACE_INLINE
00039 bool operator<(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00040 {
00041   // @note We wouldn't have to handle the case for INFINITY explicitly
00042   //       if both the Duration_t sec and nanosec fields were the
00043   //       maximum values for their corresponding types.
00044   //       Unfortunately, the OMG DDS specification defines the
00045   //       infinite nanosec value to be somewhere in the middle.
00046   DDS::Duration_t const DDS_DURATION_INFINITY = {
00047     DDS::DURATION_INFINITE_SEC,
00048     DDS::DURATION_INFINITE_NSEC
00049   };
00050 
00051   // We assume that either both the DDS::Duration_t::sec and
00052   // DDS::Duration_t::nanosec fields are INFINITY or neither of them
00053   // are.  It doesn't make sense for only one of the fields to be
00054   // INFINITY.
00055   return
00056     t1 != DDS_DURATION_INFINITY
00057     && (t2 == DDS_DURATION_INFINITY
00058         || t1.sec < t2.sec
00059         || (t1.sec == t2.sec && t1.nanosec < t2.nanosec));
00060 }
00061 
00062 ACE_INLINE
00063 bool operator<=(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00064 {
00065   // If t2 is *not* less than t1, t1 must be less than
00066   // or equal to t2.
00067   // This is more concise than:
00068   //   t1 < t2 || t1 == t2
00069   return !(t2 < t1);
00070 }
00071 
00072 ACE_INLINE
00073 bool operator>(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00074 {
00075   return t2 < t1;
00076 }
00077 
00078 ACE_INLINE
00079 bool operator>=(const DDS::Duration_t& t1, const DDS::Duration_t& t2)
00080 {
00081   return t2 <= t1;
00082 }
00083 
00084 ACE_INLINE
00085 bool operator!(const DDS::Time_t& t)
00086 {
00087   return t.sec == DDS::TIME_INVALID_SEC
00088          || t.nanosec == DDS::TIME_INVALID_NSEC;
00089 }
00090 
00091 #ifndef OPENDDS_SAFETY_PROFILE
00092 ACE_INLINE bool
00093 operator==(const DDS::Time_t& t1, const DDS::Time_t& t2)
00094 {
00095   return !(t1 < t2) && !(t2 < t1);
00096 }
00097 
00098 ACE_INLINE bool
00099 operator!=(const DDS::Time_t& t1, const DDS::Time_t& t2)
00100 {
00101   return !(t1 == t2);
00102 }
00103 #endif
00104 
00105 ACE_INLINE bool
00106 operator<(const DDS::Time_t& t1, const DDS::Time_t& t2)
00107 {
00108   if (!t1 || !t2) return false;
00109 
00110   return t1.sec < t2.sec
00111          || (t1.sec == t2.sec && t1.nanosec < t2.nanosec);
00112 }
00113 
00114 ACE_INLINE bool
00115 operator<=(const DDS::Time_t& t1, const DDS::Time_t& t2)
00116 {
00117   return !(t2 < t1);
00118 }
00119 
00120 ACE_INLINE bool
00121 operator>(const DDS::Time_t& t1, const DDS::Time_t& t2)
00122 {
00123   return t2 < t1;
00124 }
00125 
00126 ACE_INLINE bool
00127 operator>=(const DDS::Time_t& t1, const DDS::Time_t& t2)
00128 {
00129   return t2 <= t1;
00130 }
00131 
00132 ACE_INLINE DDS::Time_t
00133 operator-(const DDS::Time_t& t1, const DDS::Time_t& t2)
00134 {
00135   DDS::Time_t t = { t1.sec - t2.sec, t1.nanosec - t2.nanosec };
00136 
00137   if (t2.nanosec > t1.nanosec)
00138     {
00139       t.nanosec = (t1.nanosec + NSECS_IN_SEC) - t2.nanosec;
00140       t.sec = (t1.sec - 1) - t2.sec;
00141     }
00142 
00143   return t;
00144 }
00145 
00146 #ifndef OPENDDS_SAFETY_PROFILE
00147 ACE_INLINE
00148 bool operator==(const DDS::UserDataQosPolicy& qos1,
00149                 const DDS::UserDataQosPolicy& qos2)
00150 {
00151   return qos1.value == qos2.value;
00152 }
00153 
00154 ACE_INLINE
00155 bool operator==(const DDS::TopicDataQosPolicy & qos1,
00156                 const DDS::TopicDataQosPolicy & qos2)
00157 {
00158   return qos1.value == qos2.value;
00159 }
00160 
00161 ACE_INLINE
00162 bool operator==(const DDS::GroupDataQosPolicy& qos1,
00163                 const DDS::GroupDataQosPolicy& qos2)
00164 {
00165   return qos1.value == qos2.value;
00166 }
00167 
00168 ACE_INLINE
00169 bool operator==(const DDS::TransportPriorityQosPolicy& qos1,
00170                 const DDS::TransportPriorityQosPolicy& qos2)
00171 {
00172   return qos1.value == qos2.value;
00173 }
00174 
00175 ACE_INLINE
00176 bool operator==(const DDS::LifespanQosPolicy& qos1,
00177                 const DDS::LifespanQosPolicy& qos2)
00178 {
00179   return qos1.duration == qos2.duration;
00180 }
00181 
00182 ACE_INLINE
00183 bool
00184 operator==(const DDS::DurabilityQosPolicy& qos1,
00185            const DDS::DurabilityQosPolicy& qos2)
00186 {
00187   return qos1.kind == qos2.kind;
00188 }
00189 
00190 ACE_INLINE
00191 bool
00192 operator==(DDS::DurabilityServiceQosPolicy const & qos1,
00193            DDS::DurabilityServiceQosPolicy const & qos2)
00194 {
00195   return
00196     qos1.service_cleanup_delay == qos2.service_cleanup_delay
00197     && qos1.history_kind == qos2.history_kind
00198     && qos1.history_depth == qos2.history_depth
00199     && qos1.max_samples == qos2.max_samples
00200     && qos1.max_instances == qos2.max_instances
00201     && qos1.max_samples_per_instance == qos2.max_samples_per_instance;
00202 }
00203 
00204 ACE_INLINE
00205 bool operator==(const DDS::PresentationQosPolicy& qos1,
00206                 const DDS::PresentationQosPolicy& qos2)
00207 {
00208   return
00209     qos1.access_scope == qos2.access_scope
00210     && qos1.coherent_access == qos2.coherent_access
00211     && qos1.ordered_access == qos2.ordered_access;
00212 }
00213 
00214 ACE_INLINE
00215 bool operator==(const DDS::DeadlineQosPolicy& qos1,
00216                 const DDS::DeadlineQosPolicy& qos2)
00217 {
00218   return qos1.period == qos2.period;
00219 }
00220 
00221 ACE_INLINE
00222 bool operator==(const DDS::LatencyBudgetQosPolicy& qos1,
00223                 const DDS::LatencyBudgetQosPolicy& qos2)
00224 {
00225   return qos1.duration == qos2.duration;
00226 }
00227 
00228 ACE_INLINE
00229 bool operator==(const DDS::OwnershipQosPolicy& qos1,
00230                 const DDS::OwnershipQosPolicy& qos2)
00231 {
00232   return qos1.kind == qos2.kind;
00233 }
00234 
00235 ACE_INLINE
00236 bool operator==(const DDS::OwnershipStrengthQosPolicy& qos1,
00237                 const DDS::OwnershipStrengthQosPolicy& qos2)
00238 {
00239   return qos1.value == qos2.value;
00240 }
00241 
00242 ACE_INLINE
00243 bool operator==(const DDS::LivelinessQosPolicy& qos1,
00244                 const DDS::LivelinessQosPolicy& qos2)
00245 {
00246   return
00247     qos1.kind == qos2.kind
00248     && qos1.lease_duration == qos2.lease_duration;
00249 }
00250 
00251 ACE_INLINE
00252 bool operator==(const DDS::TimeBasedFilterQosPolicy& qos1,
00253                 const DDS::TimeBasedFilterQosPolicy& qos2)
00254 {
00255   return qos1.minimum_separation == qos2.minimum_separation;
00256 }
00257 
00258 ACE_INLINE
00259 bool operator==(const DDS::PartitionQosPolicy& qos1,
00260                 const DDS::PartitionQosPolicy& qos2)
00261 {
00262   CORBA::ULong const len = qos1.name.length();
00263 
00264   if (len == qos2.name.length()) {
00265     for (CORBA::ULong i = 0; i < len; ++i) {
00266       if (0 != ACE_OS::strcmp(qos1.name[i], qos2.name[i])) {
00267         return false;
00268       }
00269     }
00270 
00271     return true;
00272   }
00273 
00274   return false;
00275 }
00276 
00277 ACE_INLINE
00278 bool operator==(const DDS::ReliabilityQosPolicy& qos1,
00279                 const DDS::ReliabilityQosPolicy& qos2)
00280 {
00281   return
00282     qos1.kind == qos2.kind
00283     && qos1.max_blocking_time == qos2.max_blocking_time;
00284 }
00285 
00286 ACE_INLINE
00287 bool operator==(const DDS::DestinationOrderQosPolicy& qos1,
00288                 const DDS::DestinationOrderQosPolicy& qos2)
00289 {
00290   return qos1.kind == qos2.kind;
00291 }
00292 
00293 ACE_INLINE
00294 bool operator==(const DDS::HistoryQosPolicy& qos1,
00295                 const DDS::HistoryQosPolicy& qos2)
00296 {
00297   return
00298     qos1.kind == qos2.kind
00299     && qos1.depth == qos2.depth;
00300 }
00301 
00302 ACE_INLINE
00303 bool operator==(const DDS::ResourceLimitsQosPolicy& qos1,
00304                 const DDS::ResourceLimitsQosPolicy& qos2)
00305 {
00306   return
00307     qos1.max_samples == qos2.max_samples
00308     && qos1.max_instances == qos2.max_instances
00309     && qos1.max_samples_per_instance == qos2.max_samples_per_instance;
00310 }
00311 
00312 ACE_INLINE
00313 bool operator==(const DDS::EntityFactoryQosPolicy& qos1,
00314                 const DDS::EntityFactoryQosPolicy& qos2)
00315 {
00316   return
00317     qos1.autoenable_created_entities == qos2.autoenable_created_entities;
00318 }
00319 
00320 ACE_INLINE
00321 bool operator==(const DDS::WriterDataLifecycleQosPolicy& qos1,
00322                 const DDS::WriterDataLifecycleQosPolicy& qos2)
00323 {
00324   return
00325     qos1.autodispose_unregistered_instances == qos2.autodispose_unregistered_instances;
00326 }
00327 
00328 ACE_INLINE
00329 bool operator==(const DDS::ReaderDataLifecycleQosPolicy& qos1,
00330                 const DDS::ReaderDataLifecycleQosPolicy& qos2)
00331 {
00332   return
00333     (qos1.autopurge_nowriter_samples_delay == qos2.autopurge_nowriter_samples_delay)
00334     && (qos1.autopurge_disposed_samples_delay == qos2.autopurge_disposed_samples_delay);
00335 
00336 }
00337 
00338 ACE_INLINE
00339 bool operator==(const DDS::DomainParticipantQos& qos1,
00340                 const DDS::DomainParticipantQos& qos2)
00341 {
00342   return
00343     qos1.user_data == qos2.user_data
00344     && qos1.entity_factory == qos2.entity_factory;
00345 }
00346 
00347 ACE_INLINE
00348 bool operator==(const DDS::TopicQos& qos1,
00349                 const DDS::TopicQos& qos2)
00350 {
00351   return
00352     qos1.topic_data == qos2.topic_data
00353     && qos1.durability == qos2.durability
00354     && qos1.durability_service == qos2.durability_service
00355     && qos1.deadline == qos2.deadline
00356     && qos1.latency_budget == qos2.latency_budget
00357     && qos1.liveliness == qos2.liveliness
00358     && qos1.reliability == qos2.reliability
00359     && qos1.destination_order == qos2.destination_order
00360     && qos1.history == qos2.history
00361     && qos1.resource_limits == qos2.resource_limits
00362     && qos1.transport_priority == qos2.transport_priority
00363     && qos1.lifespan == qos2.lifespan
00364     && qos1.ownership == qos2.ownership;
00365 }
00366 
00367 ACE_INLINE
00368 bool operator==(const DDS::DataWriterQos& qos1,
00369                 const DDS::DataWriterQos& qos2)
00370 {
00371   return
00372     qos1.durability == qos2.durability
00373     && qos1.durability_service == qos2.durability_service
00374     && qos1.deadline == qos2.deadline
00375     && qos1.latency_budget == qos2.latency_budget
00376     && qos1.liveliness == qos2.liveliness
00377     && qos1.reliability == qos2.reliability
00378     && qos1.destination_order == qos2.destination_order
00379     && qos1.history == qos2.history
00380     && qos1.resource_limits == qos2.resource_limits
00381     && qos1.transport_priority == qos2.transport_priority
00382     && qos1.lifespan == qos2.lifespan
00383     && qos1.user_data == qos2.user_data
00384     && qos1.ownership == qos2.ownership
00385 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
00386     && qos1.ownership_strength == qos2.ownership_strength
00387 #endif
00388     && qos1.writer_data_lifecycle == qos2.writer_data_lifecycle;
00389 }
00390 
00391 ACE_INLINE
00392 bool operator==(const DDS::PublisherQos& qos1,
00393                 const DDS::PublisherQos& qos2)
00394 {
00395   return
00396     qos1.presentation == qos2.presentation
00397     && qos1.partition == qos2.partition
00398     && qos1.group_data == qos2.group_data
00399     && qos1.entity_factory == qos2.entity_factory;
00400 }
00401 
00402 ACE_INLINE
00403 bool operator==(const DDS::DataReaderQos& qos1,
00404                 const DDS::DataReaderQos& qos2)
00405 {
00406   return
00407     qos1.durability == qos2.durability
00408     && qos1.deadline == qos2.deadline
00409     && qos1.latency_budget == qos2.latency_budget
00410     && qos1.liveliness == qos2.liveliness
00411     && qos1.reliability == qos2.reliability
00412     && qos1.destination_order == qos2.destination_order
00413     && qos1.history == qos2.history
00414     && qos1.resource_limits == qos2.resource_limits
00415     && qos1.user_data == qos2.user_data
00416     && qos1.time_based_filter == qos2.time_based_filter
00417     && qos1.reader_data_lifecycle == qos2.reader_data_lifecycle;
00418 }
00419 
00420 ACE_INLINE
00421 bool operator==(const DDS::SubscriberQos& qos1,
00422                 const DDS::SubscriberQos& qos2)
00423 {
00424   return
00425     qos1.presentation == qos2.presentation
00426     && qos1.partition == qos2.partition
00427     && qos1.group_data == qos2.group_data
00428     && qos1.entity_factory == qos2.entity_factory;
00429 }
00430 
00431 ACE_INLINE
00432 bool operator==(const DDS::DomainParticipantFactoryQos& qos1,
00433                 const DDS::DomainParticipantFactoryQos& qos2)
00434 {
00435   return qos1.entity_factory == qos2.entity_factory;
00436 }
00437 
00438 ACE_INLINE
00439 bool operator!=(const DDS::UserDataQosPolicy& qos1,
00440                 const DDS::UserDataQosPolicy& qos2)
00441 {
00442   return !(qos1 == qos2);
00443 }
00444 
00445 ACE_INLINE
00446 bool operator!=(const DDS::TopicDataQosPolicy & qos1,
00447                 const DDS::TopicDataQosPolicy & qos2)
00448 {
00449   return !(qos1 == qos2);
00450 }
00451 
00452 ACE_INLINE
00453 bool operator!=(const DDS::GroupDataQosPolicy& qos1,
00454                 const DDS::GroupDataQosPolicy& qos2)
00455 {
00456   return !(qos1 == qos2);
00457 }
00458 
00459 ACE_INLINE
00460 bool operator!=(const DDS::TransportPriorityQosPolicy& qos1,
00461                 const DDS::TransportPriorityQosPolicy& qos2)
00462 {
00463   return !(qos1 == qos2);
00464 }
00465 
00466 ACE_INLINE
00467 bool operator!=(const DDS::LifespanQosPolicy& qos1,
00468                 const DDS::LifespanQosPolicy& qos2)
00469 {
00470   return !(qos1 == qos2);
00471 }
00472 
00473 ACE_INLINE
00474 bool
00475 operator!=(const DDS::DurabilityQosPolicy& qos1,
00476            const DDS::DurabilityQosPolicy& qos2)
00477 {
00478   return !(qos1 == qos2);
00479 }
00480 
00481 ACE_INLINE
00482 bool
00483 operator!=(const DDS::DurabilityServiceQosPolicy& qos1,
00484            const DDS::DurabilityServiceQosPolicy& qos2)
00485 {
00486   return !(qos1 == qos2);
00487 }
00488 
00489 ACE_INLINE
00490 bool operator!=(const DDS::PresentationQosPolicy& qos1,
00491                 const DDS::PresentationQosPolicy& qos2)
00492 {
00493   return !(qos1 == qos2);
00494 }
00495 
00496 ACE_INLINE
00497 bool operator!=(const DDS::DeadlineQosPolicy& qos1,
00498                 const DDS::DeadlineQosPolicy& qos2)
00499 {
00500   return !(qos1 == qos2);
00501 }
00502 
00503 ACE_INLINE
00504 bool operator!=(const DDS::LatencyBudgetQosPolicy& qos1,
00505                 const DDS::LatencyBudgetQosPolicy& qos2)
00506 {
00507   return !(qos1 == qos2);
00508 }
00509 
00510 ACE_INLINE
00511 bool operator!=(const DDS::OwnershipQosPolicy& qos1,
00512                 const DDS::OwnershipQosPolicy& qos2)
00513 {
00514   return !(qos1 == qos2);
00515 }
00516 
00517 ACE_INLINE
00518 bool operator!=(const DDS::OwnershipStrengthQosPolicy& qos1,
00519                 const DDS::OwnershipStrengthQosPolicy& qos2)
00520 {
00521   return !(qos1 == qos2);
00522 }
00523 
00524 ACE_INLINE
00525 bool operator!=(const DDS::LivelinessQosPolicy& qos1,
00526                 const DDS::LivelinessQosPolicy& qos2)
00527 {
00528   return !(qos1 == qos2);
00529 }
00530 
00531 ACE_INLINE
00532 bool operator!=(const DDS::TimeBasedFilterQosPolicy& qos1,
00533                 const DDS::TimeBasedFilterQosPolicy& qos2)
00534 {
00535   return !(qos1 == qos2);
00536 }
00537 
00538 ACE_INLINE
00539 bool operator!=(const DDS::PartitionQosPolicy& qos1,
00540                 const DDS::PartitionQosPolicy& qos2)
00541 {
00542   return !(qos1 == qos2);
00543 }
00544 
00545 ACE_INLINE
00546 bool operator!=(const DDS::ReliabilityQosPolicy& qos1,
00547                 const DDS::ReliabilityQosPolicy& qos2)
00548 {
00549   return !(qos1 == qos2);
00550 }
00551 
00552 ACE_INLINE
00553 bool operator!=(const DDS::DestinationOrderQosPolicy& qos1,
00554                 const DDS::DestinationOrderQosPolicy& qos2)
00555 {
00556   return !(qos1 == qos2);
00557 }
00558 
00559 ACE_INLINE
00560 bool operator!=(const DDS::HistoryQosPolicy& qos1,
00561                 const DDS::HistoryQosPolicy& qos2)
00562 {
00563   return !(qos1 == qos2);
00564 }
00565 
00566 ACE_INLINE
00567 bool operator!=(const DDS::ResourceLimitsQosPolicy& qos1,
00568                 const DDS::ResourceLimitsQosPolicy& qos2)
00569 {
00570   return !(qos1 == qos2);
00571 }
00572 
00573 ACE_INLINE
00574 bool operator!=(const DDS::EntityFactoryQosPolicy& qos1,
00575                 const DDS::EntityFactoryQosPolicy& qos2)
00576 {
00577   return !(qos1 == qos2);
00578 }
00579 
00580 ACE_INLINE
00581 bool operator!=(const DDS::WriterDataLifecycleQosPolicy& qos1,
00582                 const DDS::WriterDataLifecycleQosPolicy& qos2)
00583 {
00584   return !(qos1 == qos2);
00585 }
00586 
00587 ACE_INLINE
00588 bool operator!=(const DDS::ReaderDataLifecycleQosPolicy& qos1,
00589                 const DDS::ReaderDataLifecycleQosPolicy& qos2)
00590 {
00591   return !(qos1 == qos2);
00592 }
00593 
00594 ACE_INLINE
00595 bool operator!=(const DDS::DomainParticipantQos& qos1,
00596                 const DDS::DomainParticipantQos& qos2)
00597 {
00598   return !(qos1 == qos2);
00599 }
00600 
00601 ACE_INLINE
00602 bool operator!=(const DDS::TopicQos& qos1,
00603                 const DDS::TopicQos& qos2)
00604 {
00605   return !(qos1 == qos2);
00606 }
00607 
00608 ACE_INLINE
00609 bool operator!=(const DDS::DataWriterQos& qos1,
00610                 const DDS::DataWriterQos& qos2)
00611 {
00612   return !(qos1 == qos2);
00613 }
00614 
00615 ACE_INLINE
00616 bool operator!=(const DDS::PublisherQos& qos1,
00617                 const DDS::PublisherQos& qos2)
00618 {
00619   return !(qos1 == qos2);
00620 }
00621 
00622 ACE_INLINE
00623 bool operator!=(const DDS::DataReaderQos& qos1,
00624                 const DDS::DataReaderQos& qos2)
00625 {
00626   return !(qos1 == qos2);
00627 }
00628 
00629 ACE_INLINE
00630 bool operator!=(const DDS::SubscriberQos& qos1,
00631                 const DDS::SubscriberQos& qos2)
00632 {
00633   return !(qos1 == qos2);
00634 }
00635 
00636 ACE_INLINE
00637 bool operator!=(const DDS::DomainParticipantFactoryQos& qos1,
00638                 const DDS::DomainParticipantFactoryQos& qos2)
00639 {
00640   return !(qos1 == qos2);
00641 }
00642 #endif
00643 
00644 // ------------------------------------------------------------------
00645 
00646 ACE_INLINE
00647 ACE_Time_Value time_to_time_value(const DDS::Time_t& t)
00648 {
00649   ACE_Time_Value tv(t.sec, t.nanosec / 1000);
00650   return tv;
00651 }
00652 
00653 ACE_INLINE
00654 DDS::Time_t time_value_to_time(const ACE_Time_Value& tv)
00655 {
00656   DDS::Time_t t;
00657   t.sec = ACE_Utils::truncate_cast<CORBA::Long>(tv.sec());
00658   t.nanosec = tv.usec() * 1000;
00659   return t;
00660 }
00661 
00662 
00663 ACE_INLINE
00664 ACE_Time_Value duration_to_time_value(const DDS::Duration_t& t)
00665 {
00666   CORBA::LongLong sec = t.sec + t.nanosec/1000/ACE_ONE_SECOND_IN_USECS;
00667   CORBA::ULong usec = t.nanosec/1000 % ACE_ONE_SECOND_IN_USECS;
00668 
00669   if (sec > ACE_Time_Value::max_time.sec()) {
00670     return ACE_Time_Value::max_time;
00671   }
00672   else {
00673     return ACE_Time_Value(ACE_Utils::truncate_cast<time_t>(sec), usec);
00674   }
00675 }
00676 
00677 
00678 ACE_INLINE
00679 ACE_Time_Value duration_to_absolute_time_value(const DDS::Duration_t& t,
00680                                                const ACE_Time_Value& now)
00681 {
00682   CORBA::LongLong sec
00683     = t.sec + now.sec() + (t.nanosec/1000 + now.usec())/ACE_ONE_SECOND_IN_USECS;
00684   CORBA::ULong usec = (t.nanosec/1000 + now.usec()) % ACE_ONE_SECOND_IN_USECS;
00685 
00686   if (sec > ACE_Time_Value::max_time.sec()) {
00687     return ACE_Time_Value::max_time;
00688   }
00689   else {
00690     return ACE_Time_Value(ACE_Utils::truncate_cast<time_t>(sec), usec);
00691   }
00692 }
00693 
00694 
00695 ACE_INLINE
00696 DDS::Duration_t time_value_to_duration(const ACE_Time_Value& tv)
00697 {
00698   DDS::Duration_t t;
00699   t.sec = ACE_Utils::truncate_cast<CORBA::Long>(tv.sec());
00700   t.nanosec = tv.usec() * 1000;
00701   return t;
00702 }
00703 
00704 ACE_INLINE
00705 DDS::Duration_t time_to_duration(const DDS::Time_t& t)
00706 {
00707   DDS::Duration_t d = { t.sec, t.nanosec };
00708   return d;
00709 }
00710 
00711 ACE_INLINE
00712 CORBA::Long
00713 get_instance_sample_list_depth(
00714   DDS::HistoryQosPolicyKind history_kind,
00715   long                        history_depth,
00716   long                        max_samples_per_instance)
00717 {
00718   CORBA::Long depth = 0;
00719 
00720   if (history_kind == DDS::KEEP_ALL_HISTORY_QOS) {
00721     // The spec says history_depth is "has no effect"
00722     // when history_kind = KEEP_ALL so use
00723     // max_samples_per_instance.
00724     depth = max_samples_per_instance;
00725 
00726   } else { // history.kind == DDS::KEEP_LAST_HISTORY_QOS
00727     depth = history_depth;
00728   }
00729 
00730   if (depth == DDS::LENGTH_UNLIMITED) {
00731     // DDS::LENGTH_UNLIMITED is negative so make it a positive
00732     // value that is for all intents and purposes unlimited and we
00733     // can use it for comparisons.  Use 2147483647L because that
00734     // is the greatest value a signed CORBA::Long (a signed 32 bit
00735     // integer) can have.
00736     // WARNING: The client risks running out of memory in this case.
00737     depth = 0x7fffffff; // ACE_Numeric_Limits<CORBA::Long>::max ();
00738   }
00739 
00740   return depth;
00741 }
00742 
00743 ACE_INLINE
00744 bool valid_duration(const DDS::Duration_t& t)
00745 {
00746   DDS::Duration_t const DDS_DURATION_INFINITY = {
00747     DDS::DURATION_INFINITE_SEC,
00748     DDS::DURATION_INFINITE_NSEC
00749   };
00750 
00751   // Only accept infinite or positive finite durations.  (Zero
00752   // excluded).
00753   //
00754   // Note that it doesn't make much sense for users to set
00755   // durations less than 10 milliseconds since the underlying
00756   // timer resolution is generally no better than that.
00757   return
00758     t == DDS_DURATION_INFINITY
00759     || t.sec > 0
00760     || (t.sec >= 0 && t.nanosec > 0);
00761 }
00762 
00763 ACE_INLINE
00764 bool non_negative_duration(const DDS::Duration_t& t)
00765 {
00766   return
00767     (t.sec == DDS::DURATION_ZERO_SEC  // Allow zero duration.
00768      && t.nanosec == DDS::DURATION_ZERO_NSEC)
00769     || valid_duration(t);
00770 }
00771 
00772 // ------------------------------------------------------------
00773 
00774 ACE_INLINE
00775 bool
00776 Qos_Helper::consistent(
00777   const DDS::ResourceLimitsQosPolicy& resource_limits,
00778   const DDS::HistoryQosPolicy& history)
00779 {
00780   CORBA::Long const max_samples_per_instance =
00781     resource_limits.max_samples_per_instance;
00782   CORBA::Long const max_samples = resource_limits.max_samples;
00783 
00784   return
00785     (max_samples_per_instance == DDS::LENGTH_UNLIMITED
00786      || (max_samples_per_instance >= history.depth
00787          && (max_samples == DDS::LENGTH_UNLIMITED
00788              || max_samples >= max_samples_per_instance)));
00789 }
00790 
00791 ACE_INLINE
00792 bool
00793 Qos_Helper::consistent(const DDS::DeadlineQosPolicy& deadline,
00794                        const DDS::TimeBasedFilterQosPolicy& time_based_filter)
00795 {
00796   return time_based_filter.minimum_separation <= deadline.period;
00797 }
00798 
00799 ACE_INLINE
00800 bool Qos_Helper::consistent(const DDS::DomainParticipantQos& /* qos */)
00801 {
00802   return true;
00803 }
00804 
00805 ACE_INLINE
00806 bool Qos_Helper::consistent(const DDS::TopicQos& qos)
00807 {
00808   // Leverage existing validation functions for related QoS
00809   // policies.
00810 
00811 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
00812   DDS::HistoryQosPolicy const ds_history = {
00813     qos.durability_service.history_kind,
00814     qos.durability_service.history_depth
00815   };
00816 
00817   DDS::ResourceLimitsQosPolicy const ds_resource_limits = {
00818     qos.durability_service.max_samples,
00819     qos.durability_service.max_instances,
00820     qos.durability_service.max_samples_per_instance
00821   };
00822 
00823   return
00824     consistent(qos.resource_limits, qos.history)
00825     && consistent(ds_resource_limits, ds_history);
00826 #else
00827   ACE_UNUSED_ARG(qos);
00828   return true;
00829 #endif
00830 }
00831 
00832 ACE_INLINE
00833 bool
00834 Qos_Helper::consistent(const DDS::DataWriterQos& qos)
00835 {
00836   // Leverage existing validation functions for related QoS
00837   // policies.
00838 
00839 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
00840   DDS::HistoryQosPolicy const ds_history = {
00841     qos.durability_service.history_kind,
00842     qos.durability_service.history_depth
00843   };
00844 
00845   DDS::ResourceLimitsQosPolicy const ds_resource_limits = {
00846     qos.durability_service.max_samples,
00847     qos.durability_service.max_instances,
00848     qos.durability_service.max_samples_per_instance
00849   };
00850 
00851   return
00852     consistent(qos.resource_limits, qos.history)
00853     && consistent(ds_resource_limits, ds_history);
00854 #else
00855   ACE_UNUSED_ARG(qos);
00856   return true;
00857 #endif
00858 }
00859 
00860 ACE_INLINE
00861 bool
00862 Qos_Helper::consistent(const DDS::PublisherQos& /* qos */)
00863 {
00864   return true;
00865 }
00866 
00867 ACE_INLINE
00868 bool
00869 Qos_Helper::consistent(const DDS::DataReaderQos& qos)
00870 {
00871   return
00872     consistent(qos.deadline, qos.time_based_filter) &&
00873     consistent(qos.resource_limits, qos.history);
00874 }
00875 
00876 ACE_INLINE
00877 bool
00878 Qos_Helper::consistent(const DDS::SubscriberQos& /* qos */)
00879 {
00880   return true;
00881 }
00882 
00883 ACE_INLINE
00884 bool
00885 Qos_Helper::consistent(const DDS::DomainParticipantFactoryQos& /* qos */)
00886 {
00887   return true;
00888 }
00889 
00890 // Note: Since in the first implmenation of DSS in TAO
00891 //       a limited number of QoS values are allowed to be
00892 //       modified, the validity tests are simplified to mostly
00893 //       being a check that they are the defaults defined in
00894 //       the specification.
00895 //       SO INVALID ALSO INCLUDES UNSUPPORTED QoS.
00896 // TBD - when QoS become support the valid checks should check
00897 //       the ranges of the values of the QoS.
00898 
00899 // The spec does not have specification about the content of
00900 // UserDataQosPolicy,TopicDataQosPolicy and GroupDataQosPolicy
00901 // so they are valid with any value.
00902 ACE_INLINE
00903 bool Qos_Helper::valid(const DDS::UserDataQosPolicy& /* qos */)
00904 {
00905   return true;
00906 }
00907 
00908 ACE_INLINE
00909 bool Qos_Helper::valid(const DDS::TopicDataQosPolicy & /* qos */)
00910 {
00911   return true;
00912 }
00913 
00914 ACE_INLINE
00915 bool Qos_Helper::valid(const DDS::GroupDataQosPolicy& /* qos */)
00916 {
00917   return true;
00918 }
00919 
00920 // All values of TRANSPORT_PRIORITY.value are accepted.
00921 ACE_INLINE
00922 bool Qos_Helper::valid(const DDS::TransportPriorityQosPolicy& /* qos */)
00923 {
00924   return true;
00925 }
00926 
00927 ACE_INLINE
00928 bool Qos_Helper::valid(const DDS::LifespanQosPolicy& qos)
00929 {
00930   return valid_duration(qos.duration);
00931 }
00932 
00933 ACE_INLINE
00934 bool
00935 Qos_Helper::valid(const DDS::DurabilityQosPolicy& qos)
00936 {
00937   return
00938     (qos.kind == DDS::VOLATILE_DURABILITY_QOS
00939      || qos.kind == DDS::TRANSIENT_LOCAL_DURABILITY_QOS
00940      || qos.kind == DDS::TRANSIENT_DURABILITY_QOS
00941      || qos.kind == DDS::PERSISTENT_DURABILITY_QOS);
00942 }
00943 
00944 ACE_INLINE
00945 bool Qos_Helper::valid(const DDS::PresentationQosPolicy& qos)
00946 {
00947   return
00948     (qos.access_scope == DDS::INSTANCE_PRESENTATION_QOS
00949      || qos.access_scope == DDS::TOPIC_PRESENTATION_QOS
00950      || qos.access_scope == DDS::GROUP_PRESENTATION_QOS);
00951 }
00952 
00953 ACE_INLINE
00954 bool Qos_Helper::valid(const DDS::DeadlineQosPolicy& qos)
00955 {
00956   return valid_duration(qos.period);
00957 }
00958 
00959 ACE_INLINE
00960 bool Qos_Helper::valid(const DDS::LatencyBudgetQosPolicy& /* qos */)
00961 {
00962   return true;
00963 }
00964 
00965 ACE_INLINE
00966 bool Qos_Helper::valid(const DDS::OwnershipQosPolicy& qos)
00967 {
00968   return
00969     qos.kind == DDS::SHARED_OWNERSHIP_QOS
00970 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
00971     || qos.kind == DDS::EXCLUSIVE_OWNERSHIP_QOS
00972 #endif
00973     ;
00974 }
00975 
00976 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
00977 ACE_INLINE
00978 bool Qos_Helper::valid(const DDS::OwnershipStrengthQosPolicy& /*qos*/)
00979 {
00980   return true;
00981 }
00982 #endif
00983 
00984 ACE_INLINE
00985 bool Qos_Helper::valid(const DDS::LivelinessQosPolicy& qos)
00986 {
00987   return
00988     (qos.kind == DDS::AUTOMATIC_LIVELINESS_QOS
00989      || qos.kind == DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS
00990      || qos.kind == DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS)
00991 
00992     && valid_duration(qos.lease_duration);
00993 }
00994 
00995 ACE_INLINE
00996 bool Qos_Helper::valid(const DDS::TimeBasedFilterQosPolicy& /*qos*/)
00997 {
00998   return true;
00999 }
01000 
01001 ACE_INLINE
01002 bool
01003 Qos_Helper::valid(const DDS::PartitionQosPolicy& /* qos */)
01004 {
01005   // All strings are valid, although we may not accept all
01006   // wildcard patterns.  For now we treat unsupported wildcard
01007   // patterns literally instead of as wildcards.
01008   return true;
01009 }
01010 
01011 ACE_INLINE
01012 bool Qos_Helper::valid(const DDS::ReliabilityQosPolicy& qos)
01013 {
01014   return
01015     qos.kind == DDS::BEST_EFFORT_RELIABILITY_QOS
01016     || qos.kind == DDS::RELIABLE_RELIABILITY_QOS;
01017 }
01018 
01019 ACE_INLINE
01020 bool Qos_Helper::valid(const DDS::DestinationOrderQosPolicy& qos)
01021 {
01022   return qos.kind == DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS
01023          || qos.kind == DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
01024 }
01025 
01026 ACE_INLINE
01027 bool
01028 Qos_Helper::valid(const DDS::HistoryQosPolicy& qos)
01029 {
01030   return
01031     (qos.kind == DDS::KEEP_LAST_HISTORY_QOS
01032      || qos.kind == DDS::KEEP_ALL_HISTORY_QOS)
01033     && (qos.depth == DDS::LENGTH_UNLIMITED
01034         || qos.depth > 0);
01035 }
01036 
01037 ACE_INLINE
01038 bool
01039 Qos_Helper::valid(const DDS::ResourceLimitsQosPolicy& qos)
01040 {
01041   return
01042     (qos.max_samples == DDS::LENGTH_UNLIMITED
01043      || qos.max_samples > 0)
01044     && (qos.max_instances == DDS::LENGTH_UNLIMITED
01045         || qos.max_instances > 0)
01046     && (qos.max_samples_per_instance == DDS::LENGTH_UNLIMITED
01047         || qos.max_samples_per_instance > 0);
01048 }
01049 
01050 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01051 ACE_INLINE
01052 bool
01053 Qos_Helper::valid(const DDS::DurabilityServiceQosPolicy& qos)
01054 {
01055   // Leverage existing validation functions for related QoS
01056   // policies.
01057   DDS::HistoryQosPolicy const history = {
01058     qos.history_kind,
01059     qos.history_depth
01060   };
01061 
01062   DDS::ResourceLimitsQosPolicy const resource_limits = {
01063     qos.max_samples,
01064     qos.max_instances,
01065     qos.max_samples_per_instance
01066   };
01067 
01068   return
01069     non_negative_duration(qos.service_cleanup_delay)
01070     && valid(history)
01071     && valid(resource_limits);
01072 }
01073 #endif
01074 
01075 ACE_INLINE
01076 bool Qos_Helper::valid(const DDS::EntityFactoryQosPolicy& /*qos*/)
01077 {
01078   return true;
01079 }
01080 
01081 ACE_INLINE
01082 bool Qos_Helper::valid(const DDS::WriterDataLifecycleQosPolicy&)
01083 {
01084   return true;
01085 }
01086 
01087 ACE_INLINE
01088 bool Qos_Helper::valid(const DDS::ReaderDataLifecycleQosPolicy&)
01089 {
01090   return true;
01091 }
01092 
01093 ACE_INLINE
01094 bool Qos_Helper::valid(const DDS::DomainParticipantQos& qos)
01095 {
01096   return valid(qos.user_data) && valid(qos.entity_factory);
01097 }
01098 
01099 ACE_INLINE
01100 bool Qos_Helper::valid(const DDS::TopicQos& qos)
01101 {
01102   return
01103     valid(qos.topic_data)
01104     && valid(qos.durability)
01105 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01106     && valid(qos.durability_service)
01107 #endif
01108     && valid(qos.deadline)
01109     && valid(qos.latency_budget)
01110     && valid(qos.liveliness)
01111     && valid(qos.destination_order)
01112     && valid(qos.history)
01113     && valid(qos.resource_limits)
01114     && valid(qos.transport_priority)
01115     && valid(qos.lifespan)
01116     && valid(qos.ownership);
01117 }
01118 
01119 ACE_INLINE
01120 bool Qos_Helper::valid(const DDS::DataWriterQos& qos)
01121 {
01122   return
01123     valid(qos.durability)
01124 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01125     && valid(qos.durability_service)
01126 #endif
01127     && valid(qos.deadline)
01128     && valid(qos.latency_budget)
01129     && valid(qos.liveliness)
01130     && valid(qos.destination_order)
01131     && valid(qos.history)
01132     && valid(qos.resource_limits)
01133     && valid(qos.transport_priority)
01134     && valid(qos.lifespan)
01135     && valid(qos.user_data)
01136     && valid(qos.ownership)
01137 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
01138     && valid(qos.ownership_strength)
01139 #endif
01140     && valid(qos.writer_data_lifecycle);
01141 }
01142 
01143 ACE_INLINE
01144 bool Qos_Helper::valid(const DDS::PublisherQos& qos)
01145 {
01146   return
01147     valid(qos.presentation)
01148     && valid(qos.partition)
01149     && valid(qos.group_data)
01150     && valid(qos.entity_factory);
01151 }
01152 
01153 ACE_INLINE
01154 bool Qos_Helper::valid(const DDS::DataReaderQos& qos)
01155 {
01156   return
01157     valid(qos.durability)
01158     && valid(qos.deadline)
01159     && valid(qos.latency_budget)
01160     && valid(qos.liveliness)
01161     && valid(qos.reliability)
01162     && valid(qos.destination_order)
01163     && valid(qos.history)
01164     && valid(qos.resource_limits)
01165     && valid(qos.user_data)
01166     && valid(qos.time_based_filter)
01167     && valid(qos.reader_data_lifecycle)
01168     && valid(qos.ownership);
01169 }
01170 
01171 ACE_INLINE
01172 bool Qos_Helper::valid(const DDS::SubscriberQos& qos)
01173 {
01174   return
01175     valid(qos.presentation)
01176     && valid(qos.partition)
01177     && valid(qos.group_data)
01178     && valid(qos.entity_factory);
01179 }
01180 
01181 ACE_INLINE
01182 bool Qos_Helper::valid(const DDS::DomainParticipantFactoryQos& qos)
01183 {
01184   return valid(qos.entity_factory);
01185 }
01186 
01187 ACE_INLINE
01188 bool Qos_Helper::changeable(const DDS::UserDataQosPolicy& /* qos1 */,
01189                             const DDS::UserDataQosPolicy& /* qos2 */)
01190 {
01191   return true;
01192 }
01193 
01194 ACE_INLINE
01195 bool Qos_Helper::changeable(const DDS::TopicDataQosPolicy & /* qos1 */,
01196                             const DDS::TopicDataQosPolicy & /* qos2 */)
01197 {
01198   return true;
01199 }
01200 
01201 ACE_INLINE
01202 bool Qos_Helper::changeable(const DDS::GroupDataQosPolicy& /* qos1 */,
01203                             const DDS::GroupDataQosPolicy& /* qos2 */)
01204 {
01205   return true;
01206 }
01207 
01208 ACE_INLINE
01209 bool Qos_Helper::changeable(
01210   const DDS::TransportPriorityQosPolicy& qos1,
01211   const DDS::TransportPriorityQosPolicy& qos2)
01212 {
01213   // formal/07-01-01 specifies that this is changeable.  OpenDDS as
01214   // of Version 1.3 does not support dynamic modification of the
01215   // priority of a single DataWriter TRANSPORT_PRIORITY.value.
01216   //
01217   // return true;
01218   return qos1 == qos2;
01219 }
01220 
01221 ACE_INLINE
01222 bool
01223 Qos_Helper::changeable(const DDS::LifespanQosPolicy& /* qos1 */,
01224                        const DDS::LifespanQosPolicy& /* qos2 */)
01225 {
01226   return true;
01227 }
01228 
01229 ACE_INLINE
01230 bool Qos_Helper::changeable(const DDS::DurabilityQosPolicy& qos1,
01231                             const DDS::DurabilityQosPolicy& qos2)
01232 {
01233   return qos1 == qos2;
01234 }
01235 
01236 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01237 ACE_INLINE
01238 bool
01239 Qos_Helper::changeable(const DDS::DurabilityServiceQosPolicy& qos1,
01240                        const DDS::DurabilityServiceQosPolicy& qos2)
01241 {
01242   return qos1 == qos2;
01243 }
01244 #endif
01245 
01246 ACE_INLINE
01247 bool Qos_Helper::changeable(const DDS::PresentationQosPolicy& qos1,
01248                             const DDS::PresentationQosPolicy& qos2)
01249 {
01250   if (qos1 == qos2)
01251     return true;
01252 
01253   else
01254     return false;
01255 }
01256 
01257 // ---------------------------------------------------------------
01258 /**
01259  * TBD: These QoS are not supported currently, they are
01260  *      changeable, but need a compatibility check between the
01261  *      publisher and subscriber ends when changing the QoS.
01262  */
01263 // ---------------------------------------------------------------
01264 ACE_INLINE
01265 bool Qos_Helper::changeable(const DDS::DeadlineQosPolicy& /* qos1 */,
01266                             const DDS::DeadlineQosPolicy& /* qos2 */)
01267 {
01268   return true;
01269 }
01270 
01271 ACE_INLINE
01272 bool Qos_Helper::changeable(
01273   const DDS::LatencyBudgetQosPolicy& /* qos1 */,
01274   const DDS::LatencyBudgetQosPolicy& /* qos2 */)
01275 {
01276   return true;
01277 }
01278 
01279 ACE_INLINE
01280 bool Qos_Helper::changeable(const DDS::OwnershipQosPolicy& qos1,
01281                             const DDS::OwnershipQosPolicy& qos2)
01282 {
01283   return qos1 == qos2;
01284 }
01285 // ---------------------------------------------------------------
01286 
01287 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
01288 ACE_INLINE
01289 bool Qos_Helper::changeable(
01290   const DDS::OwnershipStrengthQosPolicy& /* qos1 */,
01291   const DDS::OwnershipStrengthQosPolicy& /* qos2 */)
01292 {
01293   return true;
01294 }
01295 #endif
01296 
01297 ACE_INLINE
01298 bool Qos_Helper::changeable(const DDS::LivelinessQosPolicy& qos1,
01299                             const DDS::LivelinessQosPolicy& qos2)
01300 {
01301   return qos1 == qos2;
01302 }
01303 
01304 ACE_INLINE
01305 bool Qos_Helper::changeable(
01306   const DDS::TimeBasedFilterQosPolicy& /* qos1 */,
01307   const DDS::TimeBasedFilterQosPolicy& /* qos2*/)
01308 {
01309   return true;
01310 }
01311 
01312 ACE_INLINE
01313 bool
01314 Qos_Helper::changeable(const DDS::PartitionQosPolicy& /* qos1 */,
01315                        const DDS::PartitionQosPolicy& /* qos2 */)
01316 {
01317   return true;
01318 }
01319 
01320 ACE_INLINE
01321 bool Qos_Helper::changeable(const DDS::ReliabilityQosPolicy& qos1,
01322                             const DDS::ReliabilityQosPolicy& qos2)
01323 {
01324   return qos1 == qos2;
01325 }
01326 
01327 ACE_INLINE
01328 bool Qos_Helper::changeable(const DDS::DestinationOrderQosPolicy& qos1,
01329                             const DDS::DestinationOrderQosPolicy& qos2)
01330 {
01331   return qos1 == qos2;
01332 }
01333 
01334 ACE_INLINE
01335 bool Qos_Helper::changeable(const DDS::HistoryQosPolicy& qos1,
01336                             const DDS::HistoryQosPolicy& qos2)
01337 {
01338   return qos1 == qos2;
01339 }
01340 
01341 ACE_INLINE
01342 bool Qos_Helper::changeable(const DDS::ResourceLimitsQosPolicy& qos1,
01343                             const DDS::ResourceLimitsQosPolicy& qos2)
01344 {
01345   return qos1 == qos2;
01346 }
01347 
01348 ACE_INLINE
01349 bool Qos_Helper::changeable(
01350   const DDS::EntityFactoryQosPolicy& /* qos1 */,
01351   const DDS::EntityFactoryQosPolicy& /* qos2 */)
01352 {
01353   return true;
01354 }
01355 
01356 ACE_INLINE
01357 bool Qos_Helper::changeable(
01358   const DDS::WriterDataLifecycleQosPolicy& /* qos1 */,
01359   const DDS::WriterDataLifecycleQosPolicy& /* qos2 */)
01360 {
01361   return true;
01362 }
01363 
01364 ACE_INLINE
01365 bool Qos_Helper::changeable(
01366   const DDS::ReaderDataLifecycleQosPolicy& /* qos1 */,
01367   const DDS::ReaderDataLifecycleQosPolicy& /* qos2 */)
01368 {
01369   return true;
01370 }
01371 
01372 ACE_INLINE
01373 bool Qos_Helper::changeable(const DDS::DomainParticipantQos& qos1,
01374                             const DDS::DomainParticipantQos& qos2)
01375 {
01376   return
01377     changeable(qos1.user_data, qos2.user_data)
01378     && changeable(qos1.entity_factory, qos2.entity_factory);
01379 }
01380 
01381 ACE_INLINE
01382 bool Qos_Helper::changeable(const DDS::TopicQos& qos1,
01383                             const DDS::TopicQos& qos2)
01384 {
01385   return
01386     changeable(qos1.topic_data, qos2.topic_data)
01387     && changeable(qos1.durability, qos2.durability)
01388 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01389     && changeable(qos1.durability_service, qos2.durability_service)
01390 #endif
01391     && changeable(qos1.deadline, qos2.deadline)
01392     && changeable(qos1.latency_budget, qos2.latency_budget)
01393     && changeable(qos1.liveliness, qos2.liveliness)
01394     && changeable(qos1.destination_order, qos2.destination_order)
01395     && changeable(qos1.history, qos2.history)
01396     && changeable(qos1.resource_limits, qos2.resource_limits)
01397     && changeable(qos1.transport_priority, qos2.transport_priority)
01398     && changeable(qos1.lifespan, qos2.lifespan)
01399     && changeable(qos1.ownership, qos2.ownership);
01400 }
01401 
01402 ACE_INLINE
01403 bool Qos_Helper::changeable(const DDS::DataWriterQos& qos1,
01404                             const DDS::DataWriterQos& qos2)
01405 {
01406   return
01407     changeable(qos1.durability, qos2.durability)
01408 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01409     && changeable(qos1.durability_service, qos2.durability_service)
01410 #endif
01411     && changeable(qos1.deadline, qos2.deadline)
01412     && changeable(qos1.latency_budget, qos2.latency_budget)
01413     && changeable(qos1.liveliness, qos2.liveliness)
01414     && changeable(qos1.destination_order, qos2.destination_order)
01415     && changeable(qos1.history, qos2.history)
01416     && changeable(qos1.resource_limits, qos2.resource_limits)
01417     && changeable(qos1.transport_priority, qos2.transport_priority)
01418     && changeable(qos1.lifespan, qos2.lifespan)
01419     && changeable(qos1.user_data, qos2.user_data)
01420     && changeable(qos1.ownership, qos2.ownership)
01421 #ifndef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
01422     && changeable(qos1.ownership_strength, qos2.ownership_strength)
01423 #endif
01424     && changeable(qos1.writer_data_lifecycle, qos2.writer_data_lifecycle);
01425 }
01426 
01427 ACE_INLINE
01428 bool Qos_Helper::changeable(const DDS::PublisherQos& qos1,
01429                             const DDS::PublisherQos& qos2)
01430 {
01431   return
01432     changeable(qos1.presentation, qos2.presentation)
01433     && changeable(qos1.partition, qos2.partition)
01434     && changeable(qos1.group_data, qos2.group_data)
01435     && changeable(qos1.entity_factory, qos2.entity_factory);
01436 }
01437 
01438 ACE_INLINE
01439 bool Qos_Helper::changeable(const DDS::DataReaderQos& qos1,
01440                             const DDS::DataReaderQos& qos2)
01441 {
01442   return
01443     changeable(qos1.durability, qos2.durability)
01444     && changeable(qos1.deadline, qos2.deadline)
01445     && changeable(qos1.latency_budget, qos2.latency_budget)
01446     && changeable(qos1.liveliness, qos2.liveliness)
01447     && changeable(qos1.reliability, qos2.reliability)
01448     && changeable(qos1.destination_order, qos2.destination_order)
01449     && changeable(qos1.history, qos2.history)
01450     && changeable(qos1.resource_limits, qos2.resource_limits)
01451     && changeable(qos1.user_data, qos2.user_data)
01452     && changeable(qos1.time_based_filter, qos2.time_based_filter)
01453     && changeable(qos1.reader_data_lifecycle, qos2.reader_data_lifecycle)
01454     && changeable(qos1.ownership, qos2.ownership);
01455 }
01456 
01457 ACE_INLINE
01458 bool Qos_Helper::changeable(const DDS::SubscriberQos& qos1,
01459                             const DDS::SubscriberQos& qos2)
01460 {
01461   return
01462     changeable(qos1.presentation, qos2.presentation)
01463     && changeable(qos1.partition, qos2.partition)
01464     && changeable(qos1.group_data, qos2.group_data)
01465     && changeable(qos1.entity_factory, qos2.entity_factory);
01466 }
01467 
01468 ACE_INLINE
01469 bool Qos_Helper::changeable(const DDS::DomainParticipantFactoryQos& qos1,
01470                             const DDS::DomainParticipantFactoryQos& qos2)
01471 {
01472   return changeable(qos1.entity_factory, qos2.entity_factory);
01473 }
01474 
01475 ACE_INLINE
01476 bool Qos_Helper::copy_from_topic_qos(DDS::DataReaderQos& a_datareader_qos,
01477                                      const DDS::TopicQos& a_topic_qos)
01478 {
01479   if (!Qos_Helper::valid(a_topic_qos) || !Qos_Helper::consistent(a_topic_qos)) {
01480         return false;
01481   }
01482     // the caller can get the default before calling this
01483     // method if it wants to.
01484   a_datareader_qos.durability = a_topic_qos.durability;
01485   a_datareader_qos.deadline = a_topic_qos.deadline;
01486   a_datareader_qos.latency_budget = a_topic_qos.latency_budget;
01487   a_datareader_qos.liveliness = a_topic_qos.liveliness;
01488   a_datareader_qos.reliability = a_topic_qos.reliability;
01489   a_datareader_qos.destination_order = a_topic_qos.destination_order;
01490   a_datareader_qos.history = a_topic_qos.history;
01491   a_datareader_qos.resource_limits = a_topic_qos.resource_limits;
01492   a_datareader_qos.ownership = a_topic_qos.ownership;
01493   return true;
01494 }
01495 
01496 ACE_INLINE
01497 bool Qos_Helper::copy_from_topic_qos(DDS::DataWriterQos& a_datawriter_qos,
01498                                      const DDS::TopicQos& a_topic_qos)
01499 {
01500   if (!Qos_Helper::valid(a_topic_qos) || !Qos_Helper::consistent(a_topic_qos)) {
01501     return false;
01502   }
01503   // Some members in the DataWriterQos are not contained
01504   // in the TopicQos. The caller needs initialize them.
01505   a_datawriter_qos.durability = a_topic_qos.durability;
01506 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01507   a_datawriter_qos.durability_service = a_topic_qos.durability_service;
01508 #endif
01509   a_datawriter_qos.deadline = a_topic_qos.deadline;
01510   a_datawriter_qos.latency_budget = a_topic_qos.latency_budget;
01511   a_datawriter_qos.liveliness = a_topic_qos.liveliness;
01512   a_datawriter_qos.reliability = a_topic_qos.reliability;
01513   a_datawriter_qos.destination_order = a_topic_qos.destination_order;
01514   a_datawriter_qos.history = a_topic_qos.history;
01515   a_datawriter_qos.resource_limits = a_topic_qos.resource_limits;
01516   a_datawriter_qos.transport_priority = a_topic_qos.transport_priority;
01517   a_datawriter_qos.lifespan = a_topic_qos.lifespan;
01518   a_datawriter_qos.ownership = a_topic_qos.ownership;
01519   return true;
01520 }
01521 
01522 } // namespace DCPS
01523 } // namespace OpenDDS

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