pips_namespace_create_topic()

Updated: April 19, 2023

Create a topic in the current namespace

Synopsis:

#include <pips/publication.h>
pips_topic_t* pips_namespace_create_topic(pips_namespace_t *nmspace,
                                          const char *topic_name,
                                          const char *opt_type_name)

Arguments:

nmspace
A pointer to the parent namespace in which the new topic will be created as a child entity
topic_name
The name of the topic to create. This must be unique to the current namespace.
opt_type_name
An optional name specifying a registered type of which the new topic will be an instance. This can be NULL to use the provider's default type.

Library:

pips-client

Description:

This function creates a topic in the current namespace using the publish/subscribe provider associated with the namespace. If a particular type is requested, the new topic will be an instance of that type; otherwise, it will be an instance of the provider's default type.

Returns:

On success, a pointer to the pips_topic_t structure representing the new topic. The caller owns this 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 generated by the framework:
  • EINVAL: The topic name is invalid.
  • ENODEV: The namespace is invalid or has no associated provider.
  • ENOENT: The specified type name was not registered with the provider.

Additional error codes may be set by the provider implementation.