ROS 2 rclcpp + rcl - kilted  kilted
ROS 2 C++ Client Library with ROS Client Library
dynamic_message_type.hpp
1 // Copyright 2023 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_
16 #define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_
17 
18 #include <rcl/allocator.h>
19 #include <rosidl_dynamic_typesupport/types.h>
20 
21 #include <memory>
22 #include <string>
23 
24 #include "rclcpp/dynamic_typesupport/dynamic_serialization_support.hpp"
25 #include "rclcpp/macros.hpp"
26 #include "rclcpp/visibility_control.hpp"
27 
28 namespace rclcpp
29 {
30 namespace dynamic_typesupport
31 {
32 
35 class DynamicMessageType : public std::enable_shared_from_this<DynamicMessageType>
36 {
37 public:
38  RCLCPP_SMART_PTR_ALIASES_ONLY(DynamicMessageType)
39 
40  RCLCPP_PUBLIC
41  virtual ~DynamicMessageType();
42 
43 protected:
44  // NOTE(methylDragon):
45  // This is just here to extend the lifetime of the serialization support
46  // It isn't actually used by the builder since the builder should compose its own support
47  //
48  // ... Though ideally it should be the exact same support as the one stored in the
49  // `DynamicSerializationSupport`
50  DynamicSerializationSupport::SharedPtr serialization_support_;
51 
52  rosidl_dynamic_typesupport_dynamic_type_t rosidl_dynamic_type_;
53 
54 private:
55  RCLCPP_DISABLE_COPY(DynamicMessageType)
56 
57  RCLCPP_PUBLIC
59 };
60 
61 } // namespace dynamic_typesupport
62 } // namespace rclcpp
63 
64 #endif // RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_HPP_
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.