-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to std::map for TopicTypeMap #546
Conversation
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clalancette I'm sure had a good reason to introduce tsl::ordered_map
in #536. Do you recall which tests were failing without it? Could it have been that the requirements were to return topic names in alphabetical order and not insertion order and that the failing test actually added topics in alphabetical order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also delete
https://github.com/ros2/rmw_zenoh/blob/rolling/rmw_zenoh_cpp/src/detail/ordered_map.hpp and https://github.com/ros2/rmw_zenoh/blob/rolling/rmw_zenoh_cpp/src/detail/ordered_hash.hpp
And update CI to not reference those file
rmw_zenoh/.github/workflows/style.yaml
Lines 22 to 24 in caaedde
run: /ros_entrypoint.sh ament_uncrustify rmw_zenoh_cpp/ --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp | |
- name: cpplint | |
run: /ros_entrypoint.sh ament_cpplint rmw_zenoh_cpp/ --exclude rmw_zenoh_cpp/src/detail/ordered_hash.hpp rmw_zenoh_cpp/src/detail/ordered_map.hpp |
@@ -85,7 +85,7 @@ struct GraphNode | |||
// Map topic name to TopicTypeMap | |||
// This uses a map that remembers insertion order because some parts of the client libraries | |||
// expect that these are returned in the order that they were created. | |||
using TopicMap = tsl::ordered_map<std::string, TopicTypeMap>; | |||
using TopicMap = std::map<std::string, TopicTypeMap>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update documentation above.
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
Oof, this is a tough one. I made a big mistake in PR #250 in that I did not specify which tests were failing. And there definitely were failing tests at that point that adding the ordered map fixed. So I went ahead and rebuilt a workspace with this PR in it, and ran all tests. With this in place, every test passed. So whatever it was that was failing before, was fixed in a different way. Thus, I think we can go forward with this change (with one change, which I'll put in a review). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also remove the MIT license from the package.xml, as it is no longer needed.
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
rmw_zenoh_cpp/CMakeLists.txt
Outdated
@@ -94,8 +94,6 @@ if(BUILD_TESTING) | |||
find_package(ament_cmake_uncrustify REQUIRED) | |||
find_package(ament_cmake_xmllint REQUIRED) | |||
|
|||
set(_linter_excludes src/detail/ordered_hash.hpp src/detail/ordered_map.hpp) | |||
|
|||
ament_copyright(EXCLUDE src/detail/simplified_xxhash3.cpp src/detail/simplified_xxhash3.hpp) | |||
ament_cpplint(EXCLUDE ${_linter_excludes}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I just noticed this one. Since we are no longer setting _linter_excludes
, this should be:
ament_cpplint(EXCLUDE ${_linter_excludes}) | |
ament_cpplint() |
(same for ament_uncrustify
down below, which I can't put a comment in due to GitHub limitations)
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks @ahcorde
// This uses a map that remembers insertion order because some parts of the client libraries | ||
// expect that these are returned in the order that they were created. | ||
using TopicMap = tsl::ordered_map<std::string, TopicTypeMap>; | ||
// This uses a map that sort element by name because some parts of the client libraries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
// This uses a map that sort element by name because some parts of the client libraries | |
// This uses a map that sorts keys alphabetically because some parts of the client libraries |
Thank you for the review @clalancette 👍 |
https://github.com/Mergifyio backport jazzy humble |
✅ Backports have been created
|
Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Yuyuan Yuan <[email protected]> (cherry picked from commit db25318)
Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Yuyuan Yuan <[email protected]> (cherry picked from commit db25318) # Conflicts: # rmw_zenoh_cpp/CMakeLists.txt
Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Yuyuan Yuan <[email protected]> (cherry picked from commit db25318) Co-authored-by: Alejandro Hernández Cordero <[email protected]>
* Switch to std::map for TopicTypeMap (#546) Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Yuyuan Yuan <[email protected]> (cherry picked from commit db25318) Co-authored-by: Alejandro Hernández Cordero <[email protected]>
I open this PR just for visibility, it's related with this PR #536 and in particular with this comment #536 (comment)