pips_create_topic()

Updated: April 19, 2023

Create a named topic

Synopsis:

#include <pips/publication.h>
pips_topic_t* pips_create_topic(const char *const topic_name,
                                const char *const opt_type_name,
                                const char *const opt_provider_name)

Arguments:

topic_name
The symbolic name to assign to the new topic
opt_type_name
The name of the data type represented by the topic. This argument can be NULL, in which case the default registered type will be used.
opt_provider_name
The name of the provider to use to interact with the topic. This argument can be NULL, in which case the default registered provider will be used.

Library:

pips-client

Description:

This function creates a named topic of the specified type. Then, it initializes the type's peer implementation in the publish/subscribe middleware associated with either the specified provider or the default provider if no provider name is given.

Returns:

On success, a pointer to the pips_topic_t structure representing the new topic. The caller owns the topic and hence, is responsible for deleting its memory using pips_delete_topic(). On error, this function returns NULL and sets errno.

Errors:

The following errors can be returned by the framework:
  • EINVAL: The topic name or type is invalid.
  • ENODEV: The specified provider was not registered with PiPS.
  • ENOENT: The specified type was not registered with the provider.

Additional error codes may be set by the provider implementation.