-
Notifications
You must be signed in to change notification settings - Fork 479
Dynamic Subscription (REP-2011 Subset): Stubs for rclcpp #2165
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
50f61d9
Implement subscription base changes
methylDragon 1bc7172
Add stubbed out classes
methylDragon ee1964f
Execute the stubbing
methylDragon 0fb986b
Undo variable rename in test
methylDragon dfb51cc
Add new subscription type and refine code
methylDragon 1243d80
Refine stubs
methylDragon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
73 changes: 73 additions & 0 deletions
73
rclcpp/include/rclcpp/dynamic_typesupport/dynamic_message.hpp
This file contains hidden or 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,73 @@ | ||
| // Copyright 2023 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_HPP_ | ||
| #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_HPP_ | ||
|
|
||
| #include <rcl/allocator.h> | ||
| #include <rcl/types.h> | ||
| #include <rosidl_dynamic_typesupport/types.h> | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "rclcpp/dynamic_typesupport/dynamic_message_type.hpp" | ||
| #include "rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp" | ||
| #include "rclcpp/macros.hpp" | ||
| #include "rclcpp/visibility_control.hpp" | ||
|
|
||
| namespace rclcpp | ||
| { | ||
| namespace dynamic_typesupport | ||
| { | ||
|
|
||
| class DynamicMessageType; | ||
| class DynamicMessageTypeBuilder; | ||
|
|
||
| /// Utility wrapper class for rosidl_dynamic_typesupport_dynamic_data_t | ||
| /// STUBBED OUT | ||
clalancette marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| class DynamicMessage : public std::enable_shared_from_this<DynamicMessage> | ||
| { | ||
| public: | ||
| RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicMessage) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual ~DynamicMessage(); | ||
|
|
||
| protected: | ||
| // NOTE(methylDragon): | ||
| // This is just here to extend the lifetime of the serialization support | ||
| // It isn't actually used by the builder since the builder should compose its own support | ||
| // | ||
| // ... Though ideally it should be the exact same support as the one stored in the | ||
| // DynamicSerializationSupport | ||
| DynamicSerializationSupport::SharedPtr serialization_support_; | ||
|
|
||
| rosidl_dynamic_typesupport_dynamic_data_t rosidl_dynamic_data_; | ||
| bool is_loaned_; | ||
|
|
||
| // Used for returning the loaned value, and lifetime management | ||
| DynamicMessage::SharedPtr parent_data_; | ||
|
|
||
| private: | ||
| RCLCPP_DISABLE_COPY(DynamicMessage) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| DynamicMessage(); | ||
| }; | ||
|
|
||
| } // namespace dynamic_typesupport | ||
| } // namespace rclcpp | ||
|
|
||
| #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_HPP_ | ||
67 changes: 67 additions & 0 deletions
67
rclcpp/include/rclcpp/dynamic_typesupport/dynamic_message_type.hpp
This file contains hidden or 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,67 @@ | ||
| // Copyright 2023 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_ | ||
| #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_ | ||
|
|
||
| #include <rcl/allocator.h> | ||
| #include <rosidl_dynamic_typesupport/types.h> | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp" | ||
| #include "rclcpp/macros.hpp" | ||
| #include "rclcpp/visibility_control.hpp" | ||
|
|
||
| namespace rclcpp | ||
| { | ||
| namespace dynamic_typesupport | ||
| { | ||
|
|
||
| class DynamicMessage; | ||
| class DynamicMessageTypeBuilder; | ||
|
|
||
| /// Utility wrapper class for `rosidl_dynamic_typesupport_dynamic_type_t` | ||
| /// STUBBED OUT | ||
| class DynamicMessageType : public std::enable_shared_from_this<DynamicMessageType> | ||
| { | ||
| public: | ||
| RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicMessageType) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual ~DynamicMessageType(); | ||
|
|
||
| protected: | ||
| // NOTE(methylDragon): | ||
| // This is just here to extend the lifetime of the serialization support | ||
| // It isn't actually used by the builder since the builder should compose its own support | ||
| // | ||
| // ... Though ideally it should be the exact same support as the one stored in the | ||
| // `DynamicSerializationSupport` | ||
| DynamicSerializationSupport::SharedPtr serialization_support_; | ||
|
|
||
| rosidl_dynamic_typesupport_dynamic_type_t rosidl_dynamic_type_; | ||
|
|
||
| private: | ||
| RCLCPP_DISABLE_COPY(DynamicMessageType) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| DynamicMessageType(); | ||
| }; | ||
|
|
||
| } // namespace dynamic_typesupport | ||
| } // namespace rclcpp | ||
|
|
||
| #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_ |
68 changes: 68 additions & 0 deletions
68
rclcpp/include/rclcpp/dynamic_typesupport/dynamic_message_type_builder.hpp
This file contains hidden or 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,68 @@ | ||
| // Copyright 2023 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_BUILDER_HPP_ | ||
| #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_BUILDER_HPP_ | ||
|
|
||
| #include <rcl/allocator.h> | ||
| #include <rosidl_dynamic_typesupport/types.h> | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp" | ||
| #include "rclcpp/macros.hpp" | ||
| #include "rclcpp/visibility_control.hpp" | ||
|
|
||
| namespace rclcpp | ||
| { | ||
| namespace dynamic_typesupport | ||
| { | ||
|
|
||
| class DynamicMessage; | ||
| class DynamicMessageType; | ||
|
|
||
| /// Utility wrapper class for `rosidl_dynamic_typesupport_dynamic_type_builder_t *` | ||
| /// STUBBED OUT | ||
| class DynamicMessageTypeBuilder : public std::enable_shared_from_this<DynamicMessageTypeBuilder> | ||
| { | ||
| public: | ||
| RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicMessageTypeBuilder) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual ~DynamicMessageTypeBuilder(); | ||
|
|
||
| protected: | ||
| // NOTE(methylDragon): | ||
| // This is just here to extend the lifetime of the serialization support | ||
| // It isn't actually used by the builder since the builder should compose its own support | ||
| // | ||
| // ... Though ideally it should be the exact same support as the one stored in the | ||
| // `DynamicSerializationSupport` | ||
| DynamicSerializationSupport::SharedPtr serialization_support_; | ||
|
|
||
| rosidl_dynamic_typesupport_dynamic_type_builder_t rosidl_dynamic_type_builder_; | ||
|
|
||
| private: | ||
| RCLCPP_DISABLE_COPY(DynamicMessageTypeBuilder) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| DynamicMessageTypeBuilder(); | ||
| }; | ||
|
|
||
| } // namespace dynamic_typesupport | ||
| } // namespace rclcpp | ||
|
|
||
|
|
||
| #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_BUILDER_HPP_ |
67 changes: 67 additions & 0 deletions
67
rclcpp/include/rclcpp/dynamic_typesupport/dynamic_message_type_support.hpp
This file contains hidden or 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,67 @@ | ||
| // Copyright 2023 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_SUPPORT_HPP_ | ||
| #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_SUPPORT_HPP_ | ||
|
|
||
| #include <rcl/allocator.h> | ||
|
|
||
| #include <rosidl_dynamic_typesupport/dynamic_message_type_support_struct.h> | ||
| #include <rosidl_dynamic_typesupport/types.h> | ||
| #include <rosidl_runtime_c/message_type_support_struct.h> | ||
| #include <rosidl_runtime_c/type_description/type_description__struct.h> | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "rclcpp/dynamic_typesupport/dynamic_message.hpp" | ||
| #include "rclcpp/dynamic_typesupport/dynamic_message_type.hpp" | ||
| #include "rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp" | ||
|
|
||
| #include "rclcpp/macros.hpp" | ||
| #include "rclcpp/visibility_control.hpp" | ||
|
|
||
| namespace rclcpp | ||
| { | ||
| namespace dynamic_typesupport | ||
| { | ||
|
|
||
| /// Utility wrapper class for `rosidl_message_type_support_t` containing managed | ||
| /// STUBBED OUT | ||
| class DynamicMessageTypeSupport : public std::enable_shared_from_this<DynamicMessageTypeSupport> | ||
| { | ||
| public: | ||
| RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicMessageTypeSupport) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual ~DynamicMessageTypeSupport(); | ||
|
|
||
| protected: | ||
| DynamicSerializationSupport::SharedPtr serialization_support_; | ||
| DynamicMessageType::SharedPtr dynamic_message_type_; | ||
| DynamicMessage::SharedPtr dynamic_message_; | ||
|
|
||
| rosidl_message_type_support_t rosidl_message_type_support_; | ||
|
|
||
| private: | ||
| RCLCPP_DISABLE_COPY(DynamicMessageTypeSupport) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| DynamicMessageTypeSupport(); | ||
| }; | ||
|
|
||
| } // namespace dynamic_typesupport | ||
| } // namespace rclcpp | ||
|
|
||
| #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_SUPPORT_HPP_ |
69 changes: 69 additions & 0 deletions
69
rclcpp/include/rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp
This file contains hidden or 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,69 @@ | ||
| // Copyright 2023 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // 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 RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_SERIALIZATION_SUPPORT_HPP_ | ||
| #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_SERIALIZATION_SUPPORT_HPP_ | ||
|
|
||
| #include <rcl/allocator.h> | ||
| #include <rosidl_dynamic_typesupport/api/serialization_support.h> | ||
| #include <rosidl_dynamic_typesupport/types.h> | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "rclcpp/macros.hpp" | ||
| #include "rclcpp/visibility_control.hpp" | ||
|
|
||
| namespace rclcpp | ||
| { | ||
| namespace dynamic_typesupport | ||
| { | ||
|
|
||
| /// Utility wrapper class for rosidl_dynamic_typesupport_serialization_support_t | ||
| /** | ||
| * This class: | ||
| * - Exposes getter methods for the struct | ||
| * - Exposes the underlying serialization support API | ||
| * | ||
| * Ownership: | ||
| * - This class, similarly to the rosidl_dynamic_typesupport_serialization_support_t, must outlive | ||
| * all downstream usages of the serialization support. | ||
| */ | ||
| class DynamicSerializationSupport : public std::enable_shared_from_this<DynamicSerializationSupport> | ||
| { | ||
| public: | ||
| RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicSerializationSupport) | ||
|
|
||
| RCLCPP_PUBLIC | ||
| explicit DynamicSerializationSupport(rcl_allocator_t allocator = rcl_get_default_allocator()); | ||
|
|
||
| RCLCPP_PUBLIC | ||
| DynamicSerializationSupport( | ||
| const std::string & serialization_library_name, | ||
| rcl_allocator_t allocator = rcl_get_default_allocator()); | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual ~DynamicSerializationSupport(); | ||
|
|
||
| protected: | ||
| rosidl_dynamic_typesupport_serialization_support_t rosidl_serialization_support_; | ||
|
|
||
| private: | ||
| RCLCPP_DISABLE_COPY(DynamicSerializationSupport) | ||
| }; | ||
|
|
||
| } // namespace dynamic_typesupport | ||
| } // namespace rclcpp | ||
|
|
||
| #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_SERIALIZATION_SUPPORT_HPP_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.