ROS 2 rclcpp + rcl - rolling  rolling-20536064
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 
30 namespace rclcpp
31 {
32 
34 {
35 public:
36  RCLCPP_SMART_PTR_DEFINITIONS(ParameterEventsFilter)
37  enum class EventType {NEW, DELETED, CHANGED};
39  using EventPair = std::pair<EventType, const rcl_interfaces::msg::Parameter *>;
40 
42 
61  RCLCPP_PUBLIC
63  std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event,
64  const std::vector<std::string> & names,
65  const std::vector<EventType> & types);
66 
68 
71  RCLCPP_PUBLIC
72  const std::vector<EventPair> & get_events() const;
73 
74 private:
75  // access only allowed via const accessor.
76  std::vector<EventPair> result_;
77  std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event_;
78 };
79 
80 } // namespace rclcpp
81 
82 #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.