pips_group_add_member()

Updated: April 19, 2023

Add a member to a group

Synopsis:

#include <pips/publication.h>
pips_group_member_t* pips_group_add_member(pips_group_t *const group,
                                           pips_topic_t *const topic,
                                           const char *opt_name,
                                           void *const opt_usr_data)

Arguments:

group
A pointer to the current group topic
topic
A pointer to the topic to add to the group
opt_name
An optional symbolic name to associate with the group member. If this argument is NULL, the topic's name is used.
opt_usr_data
An optional pointer to specialized user data to associate with the group member

Library:

pips-client

Description:

This function adds the given topic to the current group. Publications created using this group will receive events from peers of the new member topic.

The member can be named explicitly. If no name is provided, the topic name is used. Members can be added to the group even if a publication has already been created for it; the associated publication will be updated accordingly.

Prerequisites

The topic specified in group must have been allocated as a group topic using pips_create_group().

Returns:

On success, a pointer to a handle to the member structure created by the group to manage the member topic. The memory returned by this function becomes owned by the caller, who is responsible for deleting it from the group. On error, NULL (errno is set).

Errors:

  • ENODEV: The group is invalid.
  • EINVAL: The topic to add to the group is invalid.