-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Took off dds_qos_policy_to_rmw_qos from qos.h to a new header inside src called qos_converter - renamed test file to be more representative of the function it is testing - refactored test code to use Value-Parameterised Gtests Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
- Loading branch information
Showing
8 changed files
with
375 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "qos_converter.hpp" | ||
#include "rmw/types.h" | ||
|
||
#include "fastrtps/qos/WriterQos.h" | ||
#include "fastrtps/qos/ReaderQos.h" | ||
|
||
template<typename DDSQoSPolicyT> | ||
void | ||
dds_qos_policy_to_rmw_qos( | ||
const DDSQoSPolicyT & dds_qos, | ||
rmw_qos_profile_t * qos) | ||
{ | ||
switch (dds_qos.m_reliability.kind) { | ||
case eprosima::fastrtps::BEST_EFFORT_RELIABILITY_QOS: | ||
qos->reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT; | ||
break; | ||
case eprosima::fastrtps::RELIABLE_RELIABILITY_QOS: | ||
qos->reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; | ||
break; | ||
default: | ||
qos->reliability = RMW_QOS_POLICY_RELIABILITY_UNKNOWN; | ||
break; | ||
} | ||
|
||
switch (dds_qos.m_durability.kind) { | ||
case eprosima::fastrtps::TRANSIENT_LOCAL_DURABILITY_QOS: | ||
qos->durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; | ||
break; | ||
case eprosima::fastrtps::VOLATILE_DURABILITY_QOS: | ||
qos->durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; | ||
break; | ||
default: | ||
qos->durability = RMW_QOS_POLICY_DURABILITY_UNKNOWN; | ||
break; | ||
} | ||
|
||
qos->deadline.sec = dds_qos.m_deadline.period.seconds; | ||
qos->deadline.nsec = dds_qos.m_deadline.period.nanosec; | ||
|
||
qos->lifespan.sec = dds_qos.m_lifespan.duration.seconds; | ||
qos->lifespan.nsec = dds_qos.m_lifespan.duration.nanosec; | ||
|
||
switch (dds_qos.m_liveliness.kind) { | ||
case eprosima::fastrtps::AUTOMATIC_LIVELINESS_QOS: | ||
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_AUTOMATIC; | ||
break; | ||
case eprosima::fastrtps::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS: | ||
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE; | ||
break; | ||
case eprosima::fastrtps::MANUAL_BY_TOPIC_LIVELINESS_QOS: | ||
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC; | ||
break; | ||
default: | ||
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_UNKNOWN; | ||
break; | ||
} | ||
qos->liveliness_lease_duration.sec = dds_qos.m_liveliness.lease_duration.seconds; | ||
qos->liveliness_lease_duration.nsec = dds_qos.m_liveliness.lease_duration.nanosec; | ||
} | ||
|
||
template | ||
void dds_qos_policy_to_rmw_qos<eprosima::fastrtps::WriterQos>( | ||
const eprosima::fastrtps::WriterQos & dds_qos, | ||
rmw_qos_profile_t * qos); | ||
|
||
template | ||
void dds_qos_policy_to_rmw_qos<eprosima::fastrtps::ReaderQos>( | ||
const eprosima::fastrtps::ReaderQos & dds_qos, | ||
rmw_qos_profile_t * qos); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
|
||
#ifndef QOS_CONVERTER_HPP_ | ||
#define QOS_CONVERTER_HPP_ | ||
|
||
namespace eprosima | ||
{ | ||
namespace fastrtps | ||
{ | ||
class ReaderQos; | ||
class WriterQos; | ||
} // namespace fastrtps | ||
} // namespace eprosima | ||
|
||
struct rmw_qos_profile_t; | ||
|
||
/* | ||
* Converts the low-level QOS Policy; of type WriterQos or ReaderQos into rmw_qos_profile_t. | ||
* Since WriterQos or ReaderQos does not have information about history and depth, these values are not set | ||
* by this function. | ||
* | ||
* \param[in] dds_qos of type WriterQos or ReaderQos | ||
* \param[out] qos the equivalent of the data in WriterQos or ReaderQos in rmw_qos_profile_t | ||
*/ | ||
template<typename DDSQoSPolicyT> | ||
void | ||
dds_qos_policy_to_rmw_qos( | ||
const DDSQoSPolicyT & dds_qos, | ||
rmw_qos_profile_t * qos); | ||
|
||
extern template | ||
void dds_qos_policy_to_rmw_qos<eprosima::fastrtps::WriterQos>( | ||
const eprosima::fastrtps::WriterQos & dds_qos, | ||
rmw_qos_profile_t * qos); | ||
|
||
extern template | ||
void dds_qos_policy_to_rmw_qos<eprosima::fastrtps::ReaderQos>( | ||
const eprosima::fastrtps::ReaderQos & dds_qos, | ||
rmw_qos_profile_t * qos); | ||
|
||
#endif // QOS_CONVERTER_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
find_package(ament_cmake_gtest REQUIRED) | ||
ament_add_gtest(test_dds_qos_policy_to_rmw test_dds_qos_policy_to_rmw.cpp) | ||
if(TARGET test_dds_qos_policy_to_rmw) | ||
ament_target_dependencies(test_dds_qos_policy_to_rmw) | ||
target_link_libraries(test_dds_qos_policy_to_rmw ${PROJECT_NAME}) | ||
ament_add_gtest(test_dds_qos_to_rmw test_dds_qos_to_rmw.cpp) | ||
if(TARGET test_dds_qos_to_rmw) | ||
ament_target_dependencies(test_dds_qos_to_rmw) | ||
target_link_libraries(test_dds_qos_to_rmw ${PROJECT_NAME}) | ||
endif() |
Oops, something went wrong.