Class ForwardManagement

Class Documentation

class ForwardManagement

Manage all service client proxies. Maintain the correspondence between the original Request ID and the proxy request sequence.

Public Types

using SharedPtr = std::shared_ptr<ForwardManagement>
using SharedClientProxy = rclcpp::GenericClient::SharedPtr
using SharedServiceProxy = rclcpp::GenericService::SharedPtr
using SharedRequestID = std::shared_ptr<rmw_request_id_t>
using ProxyRequestSequence = int64_t

Public Functions

explicit ForwardManagement(LoadBalancingStrategy strategy = LoadBalancingStrategy::ROUND_ROBIN)
inline ~ForwardManagement()
bool register_client_proxy(SharedClientProxy &client)

Register a service client proxy.

Parameters:

A – shared generic client to be registered

Returns:

False if Client proxy already existed, otherwise True.

bool unregister_client_proxy(SharedClientProxy &client)

Unregister a service client proxy.

Parameters:

client – A shared generic client to be unregistered

Returns:

False if Client proxy is unregistered, otherwise True.

std::optional<SharedClientProxy> request_client_proxy()

Choose a service client proxy according to load balancing strategy.

Returns:

A shared pointer to a service client proxy.

bool add_one_record_to_corresponding_table(SharedClientProxy &client_proxy, ProxyRequestSequence proxy_request_sequence, SharedRequestID &shared_request_id)

Add a record that describes the correspondence between the client proxy, proxy request sequence, and the original request ID.

Parameters:
  • client_proxy – A shared pointer to a service client proxy

  • proxy_request_sequence – The sequence number of request managed by ServiceClientProxyManager

  • shared_request_id – A shared pointer to rmw_request_id_t

Returns:

False if the client proxy with proxy request sequence already existed, otherwise True.

std::optional<SharedRequestID> get_request_info_from_corresponding_table(SharedClientProxy &client_proxy, ProxyRequestSequence proxy_request_sequence)

Get the original request ID according to the client proxy with proxy request sequence.

Parameters:
  • client_proxy – A shared pointer to a service client proxy

  • proxy_request_sequence – The sequence number of request managed by ServiceClientProxyManager

Returns:

A shared pointer to rmw_request_id_t.

Public Static Attributes

static std::unordered_map<std::string, LoadBalancingStrategy> supported_load_balancing_strategy