ROS 2 rclcpp + rcl - kilted  kilted
ROS 2 C++ Client Library with ROS Client Library
ros_message_intra_process_buffer.hpp
1 // Copyright 2021 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__EXPERIMENTAL__ROS_MESSAGE_INTRA_PROCESS_BUFFER_HPP_
16 #define RCLCPP__EXPERIMENTAL__ROS_MESSAGE_INTRA_PROCESS_BUFFER_HPP_
17 
18 #include <memory>
19 #include <string>
20 
21 #include "rcl/error_handling.h"
22 
23 #include "rclcpp/any_subscription_callback.hpp"
24 #include "rclcpp/context.hpp"
25 #include "rclcpp/experimental/subscription_intra_process_base.hpp"
26 #include "tracetools/tracetools.h"
27 
28 namespace rclcpp
29 {
30 namespace experimental
31 {
32 
33 template<
34  typename RosMessageT,
35  typename Alloc = std::allocator<void>,
36  typename Deleter = std::default_delete<void>
37 >
39 {
40 public:
41  using ROSMessageTypeAllocatorTraits = allocator::AllocRebind<RosMessageT, Alloc>;
42  using ROSMessageTypeAllocator = typename ROSMessageTypeAllocatorTraits::allocator_type;
43  using ROSMessageTypeDeleter = allocator::Deleter<ROSMessageTypeAllocator, RosMessageT>;
44 
45  using ConstMessageSharedPtr = std::shared_ptr<const RosMessageT>;
46  using MessageUniquePtr = std::unique_ptr<RosMessageT, ROSMessageTypeDeleter>;
47 
49  rclcpp::Context::SharedPtr context,
50  const std::string & topic_name,
51  const rclcpp::QoS & qos_profile)
52  : SubscriptionIntraProcessBase(context, topic_name, qos_profile)
53  {}
54 
56  {}
57 
58  virtual void
59  provide_intra_process_message(ConstMessageSharedPtr message) = 0;
60 
61  virtual void
62  provide_intra_process_message(MessageUniquePtr message) = 0;
63 };
64 
65 } // namespace experimental
66 } // namespace rclcpp
67 
68 #endif // RCLCPP__EXPERIMENTAL__ROS_MESSAGE_INTRA_PROCESS_BUFFER_HPP_
Encapsulation of Quality of Service settings.
Definition: qos.hpp:116
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.