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
61  take_data() = 0;
62 
63  virtual void
64  execute(std::shared_ptr<void> & data) = 0;
65 
66  virtual bool
67  use_take_shared_method() const = 0;
68 
70  const char *
71  get_topic_name() const;
72 
75  get_actual_qos() const;
76 
77 protected:
80 
81 private:
82  virtual void
83  trigger_guard_condition() = 0;
84 
85  std::string topic_name_;
86  rmw_qos_profile_t qos_profile_;
87 };
88 
89 } // namespace experimental
90 } // namespace rclcpp
91 
92 #endif // RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_BASE_HPP_
rclcpp::experimental::SubscriptionIntraProcessBase::reentrant_mutex_
std::recursive_mutex reentrant_mutex_
Definition: subscription_intra_process_base.hpp:78
std::string
std::shared_ptr< void >
rclcpp::experimental::SubscriptionIntraProcessBase::add_to_wait_set
bool add_to_wait_set(rcl_wait_set_t *wait_set)
Add the Waitable to a wait set.
rmw.h
std::recursive_mutex
RCLCPP_SMART_PTR_ALIASES_ONLY
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
rcl_guard_condition_t
rclcpp::experimental::SubscriptionIntraProcessBase
Definition: subscription_intra_process_base.hpp:36
rclcpp::Waitable
Definition: waitable.hpp:29
rclcpp::experimental::SubscriptionIntraProcessBase::get_topic_name
const char * get_topic_name() const
rclcpp
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
RCLCPP_PUBLIC
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
rclcpp::experimental::SubscriptionIntraProcessBase::~SubscriptionIntraProcessBase
virtual ~SubscriptionIntraProcessBase()=default
rclcpp::experimental::SubscriptionIntraProcessBase::use_take_shared_method
virtual bool use_take_shared_method() const =0
rclcpp::experimental::SubscriptionIntraProcessBase::is_ready
virtual bool is_ready(rcl_wait_set_t *wait_set)=0
Check if the Waitable is ready.
rcl_wait_set_t
rclcpp::experimental::SubscriptionIntraProcessBase::get_number_of_ready_guard_conditions
size_t get_number_of_ready_guard_conditions()
Get the number of ready guard_conditions.
Definition: subscription_intra_process_base.hpp:50
rclcpp::experimental::SubscriptionIntraProcessBase::execute
virtual void execute(std::shared_ptr< void > &data)=0
Execute data that is passed in.
type_support_decl.hpp
rmw_qos_profile_t
rclcpp::experimental::SubscriptionIntraProcessBase::take_data
virtual std::shared_ptr< void > take_data()=0
Take the data so that it can be consumed with execute.
rclcpp::experimental::SubscriptionIntraProcessBase::gc_
rcl_guard_condition_t gc_
Definition: subscription_intra_process_base.hpp:79
rclcpp::experimental::SubscriptionIntraProcessBase::SubscriptionIntraProcessBase
SubscriptionIntraProcessBase(const std::string &topic_name, rmw_qos_profile_t qos_profile)
Definition: subscription_intra_process_base.hpp:42
waitable.hpp
rclcpp::experimental::SubscriptionIntraProcessBase::get_actual_qos
rmw_qos_profile_t get_actual_qos() const