rclcpp  master
C++ ROS Client Library API
parameter_events_filter.hpp
Go to the documentation of this file.
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"
29 #include "rmw/rmw.h"
30 
31 namespace rclcpp
32 {
33 
35 {
36 public:
38  enum class EventType {NEW, DELETED, CHANGED};
41 
43 
59  rcl_interfaces::msg::ParameterEvent::SharedPtr event,
60  const std::vector<std::string> & names,
61  const std::vector<EventType> & types);
62 
64 
68  const std::vector<EventPair> & get_events() const;
69 
70 private:
71  // access only allowed via const accessor.
72  std::vector<EventPair> result_;
73  rcl_interfaces::msg::ParameterEvent::SharedPtr event_;
74 };
75 
76 } // namespace rclcpp
77 
78 #endif // RCLCPP__PARAMETER_EVENTS_FILTER_HPP_
ParameterEventsFilter(rcl_interfaces::msg::ParameterEvent::SharedPtr event, const std::vector< std::string > &names, const std::vector< EventType > &types)
Construct a filtered view of a parameter event.
Definition: allocator_common.hpp:24
std::pair< EventType, rcl_interfaces::msg::Parameter * > EventPair
Used for the listed results.
Definition: parameter_events_filter.hpp:40
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
Definition: parameter_events_filter.hpp:34
const std::vector< EventPair > & get_events() const
Get the result of the filter.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
EventType
Definition: parameter_events_filter.hpp:38