ROS 2 rclcpp + rcl - kilted  kilted
ROS 2 C++ Client Library with ROS Client Library
parameter_events_filter.hpp
1 // Copyright 2017 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__PARAMETER_EVENTS_FILTER_HPP_
16 #define RCLCPP__PARAMETER_EVENTS_FILTER_HPP_
17 
18 #include <memory>
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 #include "rcl_interfaces/msg/parameter.hpp"
24 #include "rcl_interfaces/msg/parameter_event.hpp"
25 #include "rcl_interfaces/msg/parameter_value.hpp"
26 #include "rclcpp/macros.hpp"
27 #include "rclcpp/parameter.hpp"
28 #include "rclcpp/visibility_control.hpp"
29 #include "rmw/rmw.h"
30 
31 namespace rclcpp
32 {
33 
35 {
36 public:
37  RCLCPP_SMART_PTR_DEFINITIONS(ParameterEventsFilter)
38  enum class EventType {NEW, DELETED, CHANGED};
40  using EventPair = std::pair<EventType, const rcl_interfaces::msg::Parameter *>;
41 
43 
62  RCLCPP_PUBLIC
64  std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event,
65  const std::vector<std::string> & names,
66  const std::vector<EventType> & types);
67 
69 
72  RCLCPP_PUBLIC
73  const std::vector<EventPair> & get_events() const;
74 
75 private:
76  // access only allowed via const accessor.
77  std::vector<EventPair> result_;
78  std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event_;
79 };
80 
81 } // namespace rclcpp
82 
83 #endif // RCLCPP__PARAMETER_EVENTS_FILTER_HPP_
RCLCPP_PUBLIC const std::vector< EventPair > & get_events() const
Get the result of the filter.
std::pair< EventType, const rcl_interfaces::msg::Parameter * > EventPair
Used for the listed results.
RCLCPP_PUBLIC ParameterEventsFilter(std::shared_ptr< const rcl_interfaces::msg::ParameterEvent > event, const std::vector< std::string > &names, const std::vector< EventType > &types)
Construct a filtered view of a parameter event.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.