pips_namespace_group_topics()

Updated: April 19, 2023

Collect a namespace's topics into a given group

Synopsis:

#include <pips/publication.h>
int pips_namespace_group_topics(const pips_namespace_t *nmspace,
                                pips_group_t *group,
                                const int max_depth)

Arguments:

nmspace
A pointer to the namespace from which to collect topics
group
A pointer to the group to which the topics will be added. If this argument is NULL, the topics that would otherwise be added will be counted.
max_depth
The maximum depth that the function should search to in the current namespace. If this value is negative, the search will be unbounded. If it's zero, the function won't search recursively, meaning no child entities that are namespaces will be searched.

Library:

pips-client

Description:

This function finds all topics contained in the current namespace and adds them to the given group. The topics can be added recursively, in which case the topics of sub-namespaces will also be added to the group, up to a specified depth. If no group is provided, this function counts the number of topics that would otherwise be added.

Returns:

On success, the number of topics added to the group, if its capacity is sufficient for them. If its capacity of N is less than the number of topics found, only the first N topics will be added to the group, but the total number of topics found will be returned. On error, this function returns -1 and sets errno.

Errors:

  • EINVAL: The namespace is invalid.
  • ENOTTY: The given topic instance was not a group.