Skip to content

Class nebula::agnocast_wrapper::Client

template <typename ServiceT>

ClassList > nebula > agnocast_wrapper > Client

  • #include <client.hpp>

Inherited by the following classes: nebula::agnocast_wrapper::ROS2Client

Classes

Type Name
struct FutureAndRequestId
struct SharedFutureAndRequestId

Public Types

Type Name
typedef std::future< NEBULA_CLIENT_RESPONSE_PTR(ServiceT)> Future
typedef std::shared_future< NEBULA_CLIENT_RESPONSE_PTR(ServiceT)> SharedFuture
typedef std::shared_ptr< Client< ServiceT > > SharedPtr
typedef NEBULA_CLIENT_RESPONSE_PTR(ServiceT) SharedResponse

Public Functions

Type Name
virtual NEBULA_CLIENT_REQUEST_PTR (ServiceT) = 0
virtual FutureAndRequestId async_send_request (NEBULA_CLIENT_REQUEST_PTR(ServiceT) && request) = 0
virtual SharedFutureAndRequestId async_send_request (NEBULA_CLIENT_REQUEST_PTR(ServiceT) && request, std::function< void(SharedFuture)> callback) = 0
FutureAndRequestId async_send_request (const std::shared_ptr< typename ServiceT::Request > & request)
SharedFutureAndRequestId async_send_request (const std::shared_ptr< typename ServiceT::Request > & request, std::function< void(SharedFuture)> callback)
virtual const char * get_service_name () const = 0
virtual bool service_is_ready () const = 0
bool wait_for_service (std::chrono::duration< RepT, RatioT > timeout=std::chrono::nanoseconds(-1)) const
virtual ~Client () = default

Protected Functions

Type Name
virtual bool wait_for_service_impl (std::chrono::nanoseconds timeout) const = 0

Protected Static Functions

Type Name
void throw_if_null (const std::shared_ptr< typename ServiceT::Request > & request)

Public Types Documentation

typedef Future

using nebula::agnocast_wrapper::Client< ServiceT >::Future =  std::future<NEBULA_CLIENT_RESPONSE_PTR(ServiceT)>;

typedef SharedFuture

using nebula::agnocast_wrapper::Client< ServiceT >::SharedFuture =  std::shared_future<NEBULA_CLIENT_RESPONSE_PTR(ServiceT)>;

typedef SharedPtr

using nebula::agnocast_wrapper::Client< ServiceT >::SharedPtr =  std::shared_ptr<Client<ServiceT> >;

typedef SharedResponse

using nebula::agnocast_wrapper::Client< ServiceT >::SharedResponse =  NEBULA_CLIENT_RESPONSE_PTR(ServiceT);

Public Functions Documentation

function NEBULA_CLIENT_REQUEST_PTR

virtual nebula::agnocast_wrapper::Client::NEBULA_CLIENT_REQUEST_PTR (
    ServiceT
) = 0

function async_send_request [1/4]

virtual FutureAndRequestId nebula::agnocast_wrapper::Client::async_send_request (
    NEBULA_CLIENT_REQUEST_PTR (ServiceT) && request
) = 0

function async_send_request [2/4]

virtual SharedFutureAndRequestId nebula::agnocast_wrapper::Client::async_send_request (
    NEBULA_CLIENT_REQUEST_PTR (ServiceT) && request,
    std::function< void( SharedFuture )> callback
) = 0

function async_send_request [3/4]

inline FutureAndRequestId nebula::agnocast_wrapper::Client::async_send_request (
    const std::shared_ptr< typename ServiceT::Request > & request
) 

For callers that hold the request as a plain std::shared_ptr lvalue and cannot change its type. A null request is rejected before any backend allocates for it, where rclcpp::Client would dereference it.

By const reference rather than by value so that async_send_request(std::move(req)) still binds to the rvalue-reference overloads.

The two builds do not accept the same forms here. At ENABLE_AGNOCAST=0 NEBULA_CLIENT_REQUEST_PTR(S) is std::shared_ptr<S::Request>, so an owned request passed as an lvalue async_send_request(req), where req came from allocate_output_service_request() binds to this overload and compiles. At =1 that same call does not compile: the owned request is a message_ptr, which matches neither overload. Always std::move an owned request.


function async_send_request [4/4]

inline SharedFutureAndRequestId nebula::agnocast_wrapper::Client::async_send_request (
    const std::shared_ptr< typename ServiceT::Request > & request,
    std::function< void( SharedFuture )> callback
) 

function get_service_name

virtual const char * nebula::agnocast_wrapper::Client::get_service_name () const = 0

function service_is_ready

virtual bool nebula::agnocast_wrapper::Client::service_is_ready () const = 0

function wait_for_service

template<typename RepT, typename RatioT>
inline bool nebula::agnocast_wrapper::Client::wait_for_service (
    std::chrono::duration< RepT, RatioT > timeout=std::chrono::nanoseconds(-1)
) const

function ~Client

virtual nebula::agnocast_wrapper::Client::~Client () = default

Protected Functions Documentation

function wait_for_service_impl

virtual bool nebula::agnocast_wrapper::Client::wait_for_service_impl (
    std::chrono::nanoseconds timeout
) const = 0

Protected Static Functions Documentation

function throw_if_null

static inline void nebula::agnocast_wrapper::Client::throw_if_null (
    const std::shared_ptr< typename ServiceT::Request > & request
) 


The documentation for this class was generated from the following file src/nebula_core/nebula_core_ros/include/nebula_core_ros/agnocast_wrapper/client.hpp