Updated: April 19, 2023 |
Create a publication for all topics in a namespace
#include <pips/publication.h>
pips_publication_t* pips_namespace_create_publication(pips_namespace_t *const nmspace, const int max_depth, void *const opt_usr_data, pips_publication_new_data_handler_t *const opt_new_data_handler)
This function collects all topics that are children of the current namespace into a new group, then creates a publication for this group. The topics in the namespace will be added in a depth-first order up to the given maximum depth.
The publication will be configured with the PIPS_SUBSCRIBE flag set to receive samples (updates) from publishers of the grouped topics. Other publication modes are not supported with groups (e.g., PIPS_PUBLISH, PIPS_EXCL).
The caller is responsible for retrieving the group topic by calling pips_publication_get_topic() before deleting the publication, so they can also delete the group itself by calling pips_delete_topic(); otherwise, memory will be leaked.
On success, a pointer to a new publication for the new group whose members are the topics contained in the current namespace. The publication instance becomes owned by the caller, who is responsible for requesting the PiPS middleware to finalize the data and for deleting the publication. On error, NULL (errno is set by the provider implementation).