Template Class SubscriptionIntraProcess
Defined in File subscription_intra_process.hpp
Inheritance Relationships
Base Type
public rclcpp::experimental::SubscriptionIntraProcessBuffer< SubscribedType, std::allocator< SubscribedType >, std::default_delete< SubscribedType >, SubscribedType >
(Template Class SubscriptionIntraProcessBuffer)
Class Documentation
-
template<typename MessageT, typename SubscribedType, typename SubscribedTypeAlloc = std::allocator<SubscribedType>, typename SubscribedTypeDeleter = std::default_delete<SubscribedType>, typename ROSMessageType = SubscribedType, typename Alloc = std::allocator<void>>
class SubscriptionIntraProcess : public rclcpp::experimental::SubscriptionIntraProcessBuffer<SubscribedType, std::allocator<SubscribedType>, std::default_delete<SubscribedType>, SubscribedType> Public Types
-
using MessageAllocTraits = typename SubscriptionIntraProcessBufferT::SubscribedTypeAllocatorTraits
-
using MessageAlloc = typename SubscriptionIntraProcessBufferT::SubscribedTypeAllocator
-
using MessageUniquePtr = typename SubscriptionIntraProcessBufferT::SubscribedTypeUniquePtr
-
using BufferUniquePtr = typename SubscriptionIntraProcessBufferT::BufferUniquePtr
Public Functions
-
virtual ~SubscriptionIntraProcess() = default
-
inline virtual void add_to_wait_set(rcl_wait_set_t &wait_set) override
Add the Waitable to a wait set.
- Parameters:
wait_set – [in] A handle to the wait set to add the Waitable to.
- Throws:
rclcpp::execptions::RCLError – from rcl_wait_set_add_*()
-
inline virtual std::shared_ptr<void> take_data() override
Take the data so that it can be consumed with
execute
.NOTE: take_data is a partial fix to a larger design issue with the multithreaded executor. This method is likely to be removed when a more permanent fix is implemented. A longterm fix is currently being discussed here: https://github.com/ros2/rclcpp/pull/1276
This method takes the data from the underlying data structure and writes it to the void shared pointer
data
that is passed into the method. Thedata
can then be executed with theexecute
method.Before calling this method, the Waitable should be added to a wait set, waited on, and then updated.
Example usage:
// ... create a wait set and a Waitable // Add the Waitable to the wait set waitable.add_to_wait_set(wait_set); // Wait rcl_ret_t wait_ret = rcl_wait(wait_set); // ... error handling // Update the Waitable waitable.update(wait_set); // Execute any entities of the Waitable that may be ready std::shared_ptr<void> data = waitable.take_data();
Execute data that is passed in.
Before calling this method, the Waitable should be added to a wait set, waited on, and then updated - and the
take_data
method should be called.Example usage:
// ... create a wait set and a Waitable // Add the Waitable to the wait set waitable.add_to_wait_set(wait_set); // Wait rcl_ret_t wait_ret = rcl_wait(wait_set); // ... error handling // Update the Waitable waitable.update(wait_set); // Execute any entities of the Waitable that may be ready std::shared_ptr<void> data = waitable.take_data(); waitable.execute(data);
Protected Functions
Protected Attributes
-
AnySubscriptionCallback<MessageT, Alloc> any_callback_
-
using MessageAllocTraits = typename SubscriptionIntraProcessBufferT::SubscribedTypeAllocatorTraits