2.1. Client

class eprosima::is::sh::fastdds::Client : public virtual eprosima::is::ServiceClient, private DataWriterListener, private DataReaderListener

This class represents a DDS Client, built over the publisher/subscriber layer of Fast DDS using the DDS-RPC paradigm, within the Integration Service framework.

It is composed of a Fast DDS Subscriber, to listen for requests coming from the DDS dataspace; plus a Fast DDS Publisher, to send replies from the Integration Service back to the DDS service client application.

Its topic type definition and data instances for request and reply types are represented by means of the Fast DDS Dynamic Types API, which allows to get rid of TypeSupport for each used type and eases users the task of defining and using their own custom types on the go, by means of a valid IDL definition.

This class inherits from Fast DDS Data Reader Listener and from Fast DDS Data Writer Listener for reacting to datawriter and datareader events, such as matching with subscribers and publishers or receiving new data from them.

The request petitions are associated with each received reply by means of the sample identity and the related sample identity attributes.

Public Functions

Client(eprosima::is::sh::fastdds::Participant *participant, const std::string &service_name, const xtypes::DynamicType &request_type, const xtypes::DynamicType &reply_type, ServiceClientSystem::RequestCallback *callback, const YAML::Node &config)

Construct a new Client object.

  • [in] participant: The associated Integration Service Participant, which holds the DDS entities that compose this Client.

  • [in] service_name: The service name. It will produce two topics: <service_name>_Request and <service_name>_Reply.

  • [in] request_type: A dynamic type definition of the request topic’s type.

  • [in] reply_type: A dynamic type definition of the reply topic’s type.

  • [in] callback: Callback that gets triggered when a client has made a request.

  • [in] config: Additional configuration that might be required to configure this Client.

~Client() override

Destroy the Client object.

Client(const Client &rhs) = delete

Client shall not be copy constructible.

Client &operator=(const Client &rhs) = delete

Client shall not be copy assignable.

Client(Client &&rhs) = delete

Client shall not be move constructible.

Client &operator=(Client &&rhs) = delete

Client shall not be move assignable.

void receive_response(std::shared_ptr<void> call_handle, const xtypes::DynamicData &response) override

Inherited from ServiceClient.

bool add_config(const YAML::Node &configuration, ServiceClientSystem::RequestCallback *callback)

Handle type remappings for DDS request and reply types. It allows to resolve complex type remappings, which remap to a specific type member, for example, an UnionType member, by means of the dot . operator.

  • [in] configuration: The YAML configuration containing the remapping to be applied.

  • [in] callback: The callback that gets triggered when a client has made a request.