eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
799 stars 349 forks source link

Need clarification on the domain_id passed to dds_create_participant #1997

Closed t0ny-peng closed 1 month ago

t0ny-peng commented 1 month ago

I'm reading the doc for dds_create_participant and have some questions about its function doc.

 * @brief Creates a new instance of a DDS participant in a domain
 * @ingroup domain_participant
 * @component participant
 *
 * If domain is set (not DDS_DOMAIN_DEFAULT) then it must match if the domain has also
 * been configured or an error status will be returned.
 * Currently only a single domain can be configured by providing configuration file.
 * If no configuration file exists, the default domain is configured as 0.
 *
 *
 * @param[in]  domain The domain in which to create the participant (can be DDS_DOMAIN_DEFAULT).
 *                       DDS_DOMAIN_DEFAULT is for using the domain in the configuration.
 * @param[in]  qos The QoS to set on the new participant (can be NULL).
 * @param[in]  listener Any listener functions associated with the new participant (can be NULL).

 * @returns A valid participant handle or an error code.
 *
 * @retval >0
 * ...
 DDS_EXPORT dds_entity_t
dds_create_participant(
  const dds_domainid_t domain,
  const dds_qos_t *qos,
  const dds_listener_t *listener);

I'm curious what this line means: If domain is set (not DDS_DOMAIN_DEFAULT) then it must match if the domain has also been configured or an error status will be returned.. E.g., if a non-DDS_DOMAIN_DEFAULT domain id 10 is passed, which has already be configured before by dds_create_domain_with_rawconfig, which part in the function parameter must match what?

Thanks!

eboasson commented 1 month ago

I am afraid I can't tell you what that sentence means ...

I think the description in #1999 will help you understand what it does. Feel free to comment on it or suggest further improvements!