2.5. Server

class eprosima::is::sh::fastdds::Server : public virtual eprosima::is::ServiceProvider, private DataWriterListener, private DataReaderListener

This class represents a DDS Server, 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 Publisher, to send the request to the DDS dataspace; plus a Fast DDS Subscriber, to receive replies from the DDS application server and send them back to the Integration Service.

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

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

Construct a new Server object.

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

  • [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] config: Additional configuration that might be required to configure this Server.

Exceptions
  • DDSMiddlewareExeption: if some error occurs while creating the Fast DDS entities.

~Server() override

Destroy the Server object.

Server(const Server &rhs) = delete

Server shall not be copy constructible.

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

Server shall not be copy assignable.

Server(Server &&rhs) = delete

Server shall not be move constructible.

Server &operator=(Server &&rhs) = delete

Server shall not be move assignable.

void call_service(const xtypes::DynamicData &is_request, ServiceClient &client, std::shared_ptr<void> call_handle) override

Inherited from ServiceProvider.

bool add_config(const YAML::Node &configuration)

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.

Return

true if success.

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