-
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.
Centralize topic name creation logic and update to match FastRTPS 1.8…
… API (#272) Signed-off-by: Emerson Knapp <eknapp@amazon.com>
- Loading branch information
1 parent
6c1c91a
commit 1d0d526
Showing
11 changed files
with
80 additions
and
73 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
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
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
48 changes: 48 additions & 0 deletions
48
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/names.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// 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 RMW_FASTRTPS_SHARED_CPP__NAMES_HPP_ | ||
#define RMW_FASTRTPS_SHARED_CPP__NAMES_HPP_ | ||
|
||
#include "fastrtps/utils/fixed_size_string.hpp" | ||
#include "rmw/types.h" | ||
#include "namespace_prefix.hpp" | ||
|
||
/// Construct a topic name according to proper conventions. | ||
/** | ||
* \param[in] qos_profile The QoS profile for the topic. | ||
* \param[in] prefix Required prefix for topic name. | ||
* \param[in] base Required name of the topic. | ||
* \param[in] suffix Optional suffix for topic name. | ||
*/ | ||
inline | ||
eprosima::fastrtps::string_255 | ||
_create_topic_name( | ||
const rmw_qos_profile_t * qos_profile, | ||
const char * prefix, | ||
const char * base, | ||
const char * suffix = nullptr) | ||
{ | ||
std::ostringstream topicName; | ||
if (!qos_profile->avoid_ros_namespace_conventions && prefix) { | ||
topicName << prefix; | ||
} | ||
topicName << base; | ||
if (suffix) { | ||
topicName << suffix; | ||
} | ||
return topicName.str(); | ||
} | ||
|
||
#endif // RMW_FASTRTPS_SHARED_CPP__NAMES_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