rclcpp  master
C++ ROS Client Library API
subscription_intra_process_base.hpp
Go to the documentation of this file.
1 // Copyright 2019 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__SUBSCRIPTION_INTRA_PROCESS_BASE_HPP_
16 #define RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_BASE_HPP_
17 
18 #include <rmw/rmw.h>
19 
20 #include <functional>
21 #include <memory>
22 #include <mutex>
23 #include <string>
24 #include <utility>
25 
26 #include "rcl/error_handling.h"
27 
29 #include "rclcpp/waitable.hpp"
30 
31 namespace rclcpp
32 {
33 namespace experimental
34 {
35 
37 {
38 public:
40 
43  : topic_name_(topic_name), qos_profile_(qos_profile)
44  {}
45 
46  virtual ~SubscriptionIntraProcessBase() = default;
47 
49  size_t
51 
53  bool
54  add_to_wait_set(rcl_wait_set_t * wait_set);
55 
56  virtual bool
57  is_ready(rcl_wait_set_t * wait_set) = 0;
58 
59  virtual void
60  execute() = 0;
61 
62  virtual bool
63  use_take_shared_method() const = 0;
64 
66  const char *
67  get_topic_name() const;
68 
71  get_actual_qos() const;
72 
73 protected:
76 
77 private:
78  virtual void
79  trigger_guard_condition() = 0;
80 
81  std::string topic_name_;
82  rmw_qos_profile_t qos_profile_;
83 };
84 
85 } // namespace experimental
86 } // namespace rclcpp
87 
88 #endif // RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_BASE_HPP_
Definition: subscription_intra_process_base.hpp:36
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
virtual bool is_ready(rcl_wait_set_t *wait_set)=0
Check if the Waitable is ready.
rcl_guard_condition_t gc_
Definition: subscription_intra_process_base.hpp:75
bool add_to_wait_set(rcl_wait_set_t *wait_set)
Add the Waitable to a wait set.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Definition: waitable.hpp:26
size_t get_number_of_ready_guard_conditions()
Get the number of ready guard_conditions.
Definition: subscription_intra_process_base.hpp:50
virtual void execute()=0
Execute any entities of the Waitable that are ready.
SubscriptionIntraProcessBase(const std::string &topic_name, rmw_qos_profile_t qos_profile)
Definition: subscription_intra_process_base.hpp:42
std::recursive_mutex reentrant_mutex_
Definition: subscription_intra_process_base.hpp:74