rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__WAIT_SET_POLICIES__DYNAMIC_STORAGE_HPP_
16 #define RCLCPP__WAIT_SET_POLICIES__DYNAMIC_STORAGE_HPP_
36 namespace wait_set_policies
166 template<
class ArrayOfExtraGuardConditions>
171 const ArrayOfExtraGuardConditions & extra_guard_conditions,
176 rclcpp::Context::SharedPtr context
181 extra_guard_conditions,
191 timers_(timers.cbegin(), timers.cend()),
193 clients_(clients.cbegin(), clients.cend()),
195 services_(services.cbegin(), services.cend()),
197 waitables_(waitables.cbegin(), waitables.cend()),
203 template<
class ArrayOfExtraGuardConditions>
210 extra_guard_conditions,
218 template<
class EntityT,
class SequenceOfEntitiesT>
226 [&entity](
const auto & inner) {return &entity == inner.lock().get();});
229 template<
class EntityT,
class SequenceOfEntitiesT>
237 [&entity](
const auto & inner) {return &entity == inner.lock().get();});
380 [](
const auto & weak_ptr) {
382 return weak_ptr.expired();
402 auto lock_all = [](
const auto & weak_ptrs,
auto & shared_ptrs) {
403 shared_ptrs.resize(weak_ptrs.size());
405 for (
const auto & weak_ptr : weak_ptrs) {
406 shared_ptrs[index++] = weak_ptr.lock();
416 auto lock_all_waitables = [](
const auto & weak_ptrs,
auto & shared_ptrs) {
417 shared_ptrs.resize(weak_ptrs.size());
419 for (
const auto & weak_ptr : weak_ptrs) {
422 weak_ptr.associated_entity.lock()};
436 auto reset_all = [](
auto & shared_ptrs) {
437 for (
auto & shared_ptr : shared_ptrs) {
472 #endif // RCLCPP__WAIT_SET_POLICIES__DYNAMIC_STORAGE_HPP_
std::weak_ptr< rclcpp::Waitable > waitable
Definition: dynamic_storage.hpp:136
void storage_flag_for_resize()
Definition: storage_policy_common.hpp:406
std::shared_ptr< rclcpp::SubscriptionBase > lock() const
Definition: dynamic_storage.hpp:86
SequenceOfWeakWaitables waitables_
Definition: dynamic_storage.hpp:465
void storage_add_waitable(std::shared_ptr< rclcpp::Waitable > &&waitable, std::shared_ptr< void > &&associated_entity)
Definition: dynamic_storage.hpp:347
void storage_add_guard_condition(std::shared_ptr< rclcpp::GuardCondition > &&guard_condition)
Definition: dynamic_storage.hpp:263
size_t ownership_reference_counter_
Definition: dynamic_storage.hpp:448
WeakSubscriptionEntry(const std::shared_ptr< rclcpp::SubscriptionBase > &subscription_in, const rclcpp::SubscriptionWaitSetMask &mask_in) noexcept
Definition: dynamic_storage.hpp:73
void storage_release_ownerships()
Definition: dynamic_storage.hpp:429
~DynamicStorage()=default
void reset() noexcept
Definition: dynamic_storage.hpp:62
Definition: dynamic_storage.hpp:133
bool expired() const noexcept
Definition: dynamic_storage.hpp:158
Common structure for storage policies, which provides rcl wait set access.
Definition: storage_policy_common.hpp:39
SequenceOfWeakServices services_
Definition: dynamic_storage.hpp:462
Options used to determine what parts of a subscription get added to or removed from a wait set.
Definition: subscription_wait_set_mask.hpp:24
WaitablesIterable shared_waitables_
Definition: dynamic_storage.hpp:466
SequenceOfWeakClients clients_
Definition: dynamic_storage.hpp:459
void storage_remove_client(std::shared_ptr< rclcpp::ClientBase > &&client)
Definition: dynamic_storage.hpp:315
WaitableEntry(std::shared_ptr< rclcpp::Waitable > waitable_in=nullptr, std::shared_ptr< void > associated_entity_in=nullptr) noexcept
Conversion constructor, which is intentionally not marked explicit.
Definition: dynamic_storage.hpp:119
void storage_acquire_ownerships()
Definition: dynamic_storage.hpp:395
std::weak_ptr< void > associated_entity
Definition: dynamic_storage.hpp:137
SubscriptionEntry(std::shared_ptr< rclcpp::SubscriptionBase > subscription_in=nullptr, const rclcpp::SubscriptionWaitSetMask &mask_in={})
Conversion constructor, which is intentionally not marked explicit.
Definition: dynamic_storage.hpp:54
WaitSet policy that provides dynamically sized storage.
Definition: dynamic_storage.hpp:40
std::weak_ptr< rclcpp::SubscriptionBase > subscription
Definition: dynamic_storage.hpp:70
ClientsIterable shared_clients_
Definition: dynamic_storage.hpp:460
Definition: dynamic_storage.hpp:45
void storage_remove_guard_condition(std::shared_ptr< rclcpp::GuardCondition > &&guard_condition)
Definition: dynamic_storage.hpp:273
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
void storage_remove_waitable(std::shared_ptr< rclcpp::Waitable > &&waitable)
Definition: dynamic_storage.hpp:360
SequenceOfWeakSubscriptions subscriptions_
Definition: dynamic_storage.hpp:450
void storage_remove_subscription(std::shared_ptr< rclcpp::SubscriptionBase > &&subscription)
Definition: dynamic_storage.hpp:252
GuardConditionsIterable shared_guard_conditions_
Definition: dynamic_storage.hpp:454
void storage_prune_deleted_entities() noexcept
Definition: dynamic_storage.hpp:376
static bool storage_has_entity(const EntityT &entity, const SequenceOfEntitiesT &entities)
Definition: dynamic_storage.hpp:221
void storage_add_service(std::shared_ptr< rclcpp::ServiceBase > &&service)
Definition: dynamic_storage.hpp:326
SequenceOfWeakTimers timers_
Definition: dynamic_storage.hpp:456
void storage_add_client(std::shared_ptr< rclcpp::ClientBase > &&client)
Definition: dynamic_storage.hpp:305
DynamicStorage(const SubscriptionsIterable &subscriptions, const GuardConditionsIterable &guard_conditions, const ArrayOfExtraGuardConditions &extra_guard_conditions, const TimersIterable &timers, const ClientsIterable &clients, const ServicesIterable &services, const WaitablesIterable &waitables, rclcpp::Context::SharedPtr context)
Definition: dynamic_storage.hpp:168
rclcpp::SubscriptionWaitSetMask mask
Definition: dynamic_storage.hpp:71
WeakWaitableEntry(const std::shared_ptr< rclcpp::Waitable > &waitable_in, const std::shared_ptr< void > &associated_entity_in) noexcept
Definition: dynamic_storage.hpp:139
ServicesIterable shared_services_
Definition: dynamic_storage.hpp:463
WeakWaitableEntry(const WaitableEntry &other)
Definition: dynamic_storage.hpp:146
std::shared_ptr< rclcpp::SubscriptionBase > subscription
Definition: dynamic_storage.hpp:50
Definition: dynamic_storage.hpp:112
WeakSubscriptionEntry(const SubscriptionEntry &other)
Definition: dynamic_storage.hpp:80
SequenceOfWeakGuardConditions guard_conditions_
Definition: dynamic_storage.hpp:453
std::shared_ptr< void > associated_entity
Definition: dynamic_storage.hpp:116
SubscriptionsIterable shared_subscriptions_
Definition: dynamic_storage.hpp:451
Definition: dynamic_storage.hpp:67
void storage_rebuild_rcl_wait_set(const ArrayOfExtraGuardConditions &extra_guard_conditions)
Definition: dynamic_storage.hpp:205
void storage_add_subscription(std::shared_ptr< rclcpp::SubscriptionBase > &&subscription)
Definition: dynamic_storage.hpp:241
void reset() noexcept
Definition: dynamic_storage.hpp:127
std::shared_ptr< rclcpp::Waitable > lock() const
Definition: dynamic_storage.hpp:152
void storage_add_timer(std::shared_ptr< rclcpp::TimerBase > &&timer)
Definition: dynamic_storage.hpp:284
StoragePolicyCommon(const SubscriptionsIterable &subscriptions, const GuardConditionsIterable &guard_conditions, const ExtraGuardConditionsIterable &extra_guard_conditions, const TimersIterable &timers, const ClientsIterable &clients, const ServicesIterable &services, const WaitablesIterable &waitables, rclcpp::Context::SharedPtr context)
Definition: storage_policy_common.hpp:52
rclcpp::SubscriptionWaitSetMask mask
Definition: dynamic_storage.hpp:51
void storage_rebuild_rcl_wait_set_with_sets(const SubscriptionsIterable &subscriptions, const GuardConditionsIterable &guard_conditions, const ExtraGuardConditionsIterable &extra_guard_conditions, const TimersIterable &timers, const ClientsIterable &clients, const ServicesIterable &services, const WaitablesIterable &waitables)
Rebuild the wait set, preparing it for the next wait call.
Definition: storage_policy_common.hpp:168
static auto storage_find_entity(const EntityT &entity, const SequenceOfEntitiesT &entities)
Definition: dynamic_storage.hpp:232
void storage_remove_service(std::shared_ptr< rclcpp::ServiceBase > &&service)
Definition: dynamic_storage.hpp:336
TimersIterable shared_timers_
Definition: dynamic_storage.hpp:457
void storage_remove_timer(std::shared_ptr< rclcpp::TimerBase > &&timer)
Definition: dynamic_storage.hpp:294
std::shared_ptr< rclcpp::Waitable > waitable
Definition: dynamic_storage.hpp:115
bool expired() const noexcept
Definition: dynamic_storage.hpp:92