Fix issue in dds_create_topic_arbitrary (#422)
* Fix issue in dds_create_topic_arbitrary Changed the behaviour of dds_create_topic_arbitrary with respect to the sertopic parameter: the existing function dds_create_topic_arbitrary is marked deprecated and replaced by dds_create_topic_generic, which returns the sertopic that is actually used in as an out parameter. This can be eiter the provided sertopic (if this sertopic was not yet known in the domain) or an existing sertopic if the sertopic was registered earlier. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Fix memory leaks in case topic creation fails. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
This commit is contained in:
parent
dc57685ac3
commit
e412f6fab2
4 changed files with 60 additions and 29 deletions
|
@ -998,25 +998,29 @@ dds_create_topic(
|
|||
const dds_qos_t *qos,
|
||||
const dds_listener_t *listener);
|
||||
|
||||
|
||||
#define DDS_HAS_CREATE_TOPIC_GENERIC 1
|
||||
/**
|
||||
* @brief Creates a new topic with arbitrary type handling.
|
||||
* @brief Creates a new topic with provided type handling.
|
||||
*
|
||||
* The type name for the topic is taken from the provided "sertopic" object. Topic
|
||||
* matching is done on a combination of topic name and type name. Each successful
|
||||
* call to dds_create_topic creates a new topic entity sharing the same QoS
|
||||
* settings with all other topics of the same name.
|
||||
*
|
||||
* If sertopic is not yet known in the domain, it is added and its refcount
|
||||
* incremented; if an equivalent sertopic object is already known, then the known
|
||||
* one is used instead.
|
||||
* In case this function returns a valid handle, the ownership of the provided
|
||||
* sertopic is handed over to Cyclone. On return, the caller gets in the sertopic parameter a
|
||||
* pointer to the sertopic that is actually used by the topic. This can be the provided sertopic
|
||||
* (if this sertopic was not yet known in the domain), or a sertopic thas was
|
||||
* already known in the domain.
|
||||
*
|
||||
* @param[in] participant Participant on which to create the topic.
|
||||
* @param[in] sertopic Internal description of the topic type (includes name).
|
||||
* @param[in] qos QoS to set on the new topic (can be NULL).
|
||||
* @param[in] listener Any listener functions associated with the new topic (can be NULL).
|
||||
* @param[in] sedp_plist Topic description to be published as part of discovery (if NULL, not published).
|
||||
* @param[in] participant Participant on which to create the topic.
|
||||
* @param[in,out] sertopic Internal description of the topic type (includes name). On return, the sertopic parameter is set to the actual sertopic that is used by the topic.
|
||||
* @param[in] qos QoS to set on the new topic (can be NULL).
|
||||
* @param[in] listener Any listener functions associated with the new topic (can be NULL).
|
||||
* @param[in] sedp_plist Topic description to be published as part of discovery (if NULL, not published).
|
||||
*
|
||||
* @returns A valid, unique topic handle or an error code.
|
||||
* @returns A valid, unique topic handle or an error code. Iff a valid handle, the domain takes ownership of provided serdata.
|
||||
*
|
||||
* @retval >=0
|
||||
* A valid unique topic handle.
|
||||
|
@ -1031,6 +1035,14 @@ dds_create_topic(
|
|||
* topic's type name.
|
||||
*/
|
||||
DDS_EXPORT dds_entity_t
|
||||
dds_create_topic_generic (
|
||||
dds_entity_t participant,
|
||||
struct ddsi_sertopic **sertopic,
|
||||
const dds_qos_t *qos,
|
||||
const dds_listener_t *listener,
|
||||
const struct ddsi_plist *sedp_plist);
|
||||
|
||||
DDS_DEPRECATED_EXPORT dds_entity_t
|
||||
dds_create_topic_arbitrary (
|
||||
dds_entity_t participant,
|
||||
struct ddsi_sertopic *sertopic,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue