rclcpp  master
C++ ROS Client Library API
Public Member Functions | List of all members
rclcpp::executors::StaticExecutorEntitiesCollector Class Referencefinal

#include <static_executor_entities_collector.hpp>

Inheritance diagram for rclcpp::executors::StaticExecutorEntitiesCollector:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::executors::StaticExecutorEntitiesCollector:
Collaboration graph
[legend]

Public Member Functions

 StaticExecutorEntitiesCollector ()=default
 
 ~StaticExecutorEntitiesCollector ()
 
void init (rcl_wait_set_t *p_wait_set, rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy, rcl_guard_condition_t *executor_guard_condition)
 Initialize StaticExecutorEntitiesCollector. More...
 
bool is_init ()
 Finalize StaticExecutorEntitiesCollector to clear resources. More...
 
void fini ()
 
void execute (std::shared_ptr< void > &data) override
 Execute the waitable. More...
 
std::shared_ptr< void > take_data () override
 Take the data so that it can be consumed with execute. More...
 
void refresh_wait_set (std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))
 Function to add_handles_to_wait_set and wait for work and. More...
 
bool add_to_wait_set (rcl_wait_set_t *wait_set) override
 
size_t get_number_of_ready_guard_conditions () override
 Get the number of ready guard_conditions. More...
 
bool add_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 Add a callback group to an executor. More...
 
bool add_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, WeakCallbackGroupsToNodesMap &weak_groups_to_nodes)
 Add a callback group to an executor. More...
 
bool remove_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr)
 Remove a callback group from the executor. More...
 
bool remove_callback_group_from_map (rclcpp::CallbackGroup::SharedPtr group_ptr, WeakCallbackGroupsToNodesMap &weak_groups_to_nodes)
 Remove a callback group from the executor. More...
 
bool add_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 
bool remove_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 
std::vector< rclcpp::CallbackGroup::WeakPtr > get_all_callback_groups ()
 
std::vector< rclcpp::CallbackGroup::WeakPtr > get_manually_added_callback_groups ()
 Get callback groups that belong to executor. More...
 
std::vector< rclcpp::CallbackGroup::WeakPtr > get_automatically_added_callback_groups_from_nodes ()
 Get callback groups that belong to executor. More...
 
bool is_ready (rcl_wait_set_t *wait_set) override
 Complete all available queued work without blocking. More...
 
size_t get_number_of_timers ()
 Return number of timers. More...
 
size_t get_number_of_subscriptions ()
 Return number of subscriptions. More...
 
size_t get_number_of_services ()
 Return number of services. More...
 
size_t get_number_of_clients ()
 Return number of clients. More...
 
size_t get_number_of_waitables ()
 Return number of waitables. More...
 
rclcpp::SubscriptionBase::SharedPtr get_subscription (size_t i)
 
rclcpp::TimerBase::SharedPtr get_timer (size_t i)
 
rclcpp::ServiceBase::SharedPtr get_service (size_t i)
 
rclcpp::ClientBase::SharedPtr get_client (size_t i)
 
rclcpp::Waitable::SharedPtr get_waitable (size_t i)
 
- Public Member Functions inherited from rclcpp::Waitable
virtual ~Waitable ()=default
 
virtual size_t get_number_of_ready_subscriptions ()
 Get the number of ready subscriptions. More...
 
virtual size_t get_number_of_ready_timers ()
 Get the number of ready timers. More...
 
virtual size_t get_number_of_ready_clients ()
 Get the number of ready clients. More...
 
virtual size_t get_number_of_ready_events ()
 Get the number of ready events. More...
 
virtual size_t get_number_of_ready_services ()
 Get the number of ready services. More...
 
bool exchange_in_use_by_wait_set_state (bool in_use_state)
 Exchange the "in use by wait set" state for this timer. More...
 
- Public Member Functions inherited from std::enable_shared_from_this< StaticExecutorEntitiesCollector >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
~enable_shared_from_this (T... args)
 

Constructor & Destructor Documentation

◆ StaticExecutorEntitiesCollector()

rclcpp::executors::StaticExecutorEntitiesCollector::StaticExecutorEntitiesCollector ( )
default

◆ ~StaticExecutorEntitiesCollector()

rclcpp::executors::StaticExecutorEntitiesCollector::~StaticExecutorEntitiesCollector ( )

Member Function Documentation

◆ init()

void rclcpp::executors::StaticExecutorEntitiesCollector::init ( rcl_wait_set_t p_wait_set,
rclcpp::memory_strategy::MemoryStrategy::SharedPtr  memory_strategy,
rcl_guard_condition_t executor_guard_condition 
)

Initialize StaticExecutorEntitiesCollector.

Parameters
p_wait_setA reference to the wait set to be used in the executor
memory_strategyShared pointer to the memory strategy to set.
executor_guard_conditionexecutor's guard condition
Exceptions
std::runtime_errorif memory strategy is null

◆ is_init()

bool rclcpp::executors::StaticExecutorEntitiesCollector::is_init ( )
inline

Finalize StaticExecutorEntitiesCollector to clear resources.

◆ fini()

void rclcpp::executors::StaticExecutorEntitiesCollector::fini ( )

◆ execute()

void rclcpp::executors::StaticExecutorEntitiesCollector::execute ( std::shared_ptr< void > &  data)
overridevirtual

Execute the waitable.

Implements rclcpp::Waitable.

◆ take_data()

std::shared_ptr<void> rclcpp::executors::StaticExecutorEntitiesCollector::take_data ( )
overridevirtual

Take the data so that it can be consumed with execute.

For StaticExecutorEntitiesCollector, this always return nullptr.

See also
rclcpp::Waitable::take_data()

Implements rclcpp::Waitable.

◆ refresh_wait_set()

void rclcpp::executors::StaticExecutorEntitiesCollector::refresh_wait_set ( std::chrono::nanoseconds  timeout = std::chrono::nanoseconds(-1))

Function to add_handles_to_wait_set and wait for work and.

block until the wait set is ready or until the timeout has been exceeded.

Exceptions
std::runtime_errorif wait set couldn't be cleared or filled.
anyrcl errors from rcl_wait,
See also
rclcpp::exceptions::throw_from_rcl_error()

◆ add_to_wait_set()

bool rclcpp::executors::StaticExecutorEntitiesCollector::add_to_wait_set ( rcl_wait_set_t wait_set)
overridevirtual
Exceptions
std::runtime_errorif it couldn't add guard condition to wait set

Implements rclcpp::Waitable.

◆ get_number_of_ready_guard_conditions()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_ready_guard_conditions ( )
overridevirtual

Get the number of ready guard_conditions.

Returns a value of 0 by default. This should be overridden if the Waitable contains one or more guard_conditions.

Returns
The number of guard_conditions associated with the Waitable.

Reimplemented from rclcpp::Waitable.

◆ add_callback_group() [1/2]

bool rclcpp::executors::StaticExecutorEntitiesCollector::add_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr 
)

Add a callback group to an executor.

See also
rclcpp::Executor::add_callback_group

◆ add_callback_group() [2/2]

bool rclcpp::executors::StaticExecutorEntitiesCollector::add_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr,
WeakCallbackGroupsToNodesMap weak_groups_to_nodes 
)

Add a callback group to an executor.

See also
rclcpp::Executor::add_callback_group
Returns
boolean whether the node from the callback group is new

◆ remove_callback_group()

bool rclcpp::executors::StaticExecutorEntitiesCollector::remove_callback_group ( rclcpp::CallbackGroup::SharedPtr  group_ptr)

Remove a callback group from the executor.

See also
rclcpp::Executor::remove_callback_group

◆ remove_callback_group_from_map()

bool rclcpp::executors::StaticExecutorEntitiesCollector::remove_callback_group_from_map ( rclcpp::CallbackGroup::SharedPtr  group_ptr,
WeakCallbackGroupsToNodesMap weak_groups_to_nodes 
)

Remove a callback group from the executor.

See also
rclcpp::Executor::remove_callback_group_from_map

◆ add_node()

bool rclcpp::executors::StaticExecutorEntitiesCollector::add_node ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)
See also
rclcpp::Executor::add_node()
Exceptions
std::runtime_errorif node was already added

◆ remove_node()

bool rclcpp::executors::StaticExecutorEntitiesCollector::remove_node ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)
See also
rclcpp::Executor::remove_node()
Exceptions
std::runtime_errorif no guard condition is associated with node.

◆ get_all_callback_groups()

std::vector<rclcpp::CallbackGroup::WeakPtr> rclcpp::executors::StaticExecutorEntitiesCollector::get_all_callback_groups ( )

◆ get_manually_added_callback_groups()

std::vector<rclcpp::CallbackGroup::WeakPtr> rclcpp::executors::StaticExecutorEntitiesCollector::get_manually_added_callback_groups ( )

Get callback groups that belong to executor.

See also
rclcpp::Executor::get_manually_added_callback_groups()

◆ get_automatically_added_callback_groups_from_nodes()

std::vector<rclcpp::CallbackGroup::WeakPtr> rclcpp::executors::StaticExecutorEntitiesCollector::get_automatically_added_callback_groups_from_nodes ( )

Get callback groups that belong to executor.

See also
rclcpp::Executor::get_automatically_added_callback_groups_from_nodes()

◆ is_ready()

bool rclcpp::executors::StaticExecutorEntitiesCollector::is_ready ( rcl_wait_set_t wait_set)
overridevirtual

Complete all available queued work without blocking.

This function checks if after the guard condition was triggered (or a spurious wakeup happened) we are really ready to execute i.e. re-collect entities

Implements rclcpp::Waitable.

◆ get_number_of_timers()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_timers ( )
inline

Return number of timers.

Returns
number of timers

◆ get_number_of_subscriptions()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_subscriptions ( )
inline

Return number of subscriptions.

Returns
number of subscriptions

◆ get_number_of_services()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_services ( )
inline

Return number of services.

Returns
number of services

◆ get_number_of_clients()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_clients ( )
inline

Return number of clients.

Returns
number of clients

◆ get_number_of_waitables()

size_t rclcpp::executors::StaticExecutorEntitiesCollector::get_number_of_waitables ( )
inline

Return number of waitables.

Returns
number of waitables

◆ get_subscription()

rclcpp::SubscriptionBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_subscription ( size_t  i)
inline

Return a SubscritionBase Sharedptr by index.

Parameters
[in]iThe index of the SubscritionBase
Returns
a SubscritionBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size of the structrue.

◆ get_timer()

rclcpp::TimerBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_timer ( size_t  i)
inline

Return a TimerBase Sharedptr by index.

Parameters
[in]iThe index of the TimerBase
Returns
a TimerBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

◆ get_service()

rclcpp::ServiceBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_service ( size_t  i)
inline

Return a ServiceBase Sharedptr by index.

Parameters
[in]iThe index of the ServiceBase
Returns
a ServiceBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

◆ get_client()

rclcpp::ClientBase::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_client ( size_t  i)
inline

Return a ClientBase Sharedptr by index

Parameters
[in]iThe index of the ClientBase
Returns
a ClientBase shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

◆ get_waitable()

rclcpp::Waitable::SharedPtr rclcpp::executors::StaticExecutorEntitiesCollector::get_waitable ( size_t  i)
inline

Return a Waitable Sharedptr by index

Parameters
[in]iThe index of the Waitable
Returns
a Waitable shared pointer
Exceptions
std::out_of_rangeif the argument is higher than the size.

The documentation for this class was generated from the following file: