rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
Classes | Typedefs | Functions
topic_endpoint_info.h File Reference
#include "rcutils/allocator.h"
#include "rmw/types.h"
#include "rmw/visibility_control.h"
Include dependency graph for topic_endpoint_info.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rmw_topic_endpoint_info_t
 

Typedefs

typedef struct RMW_PUBLIC_TYPE rmw_topic_endpoint_info_t rmw_topic_endpoint_info_t
 

Functions

rmw_topic_endpoint_info_t rmw_get_zero_initialized_topic_endpoint_info (void)
 Return zero initialized topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_fini (rmw_topic_endpoint_info_t *topic_endpoint_info, rcutils_allocator_t *allocator)
 Finalize a topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_topic_type (rmw_topic_endpoint_info_t *topic_endpoint_info, const char *topic_type, rcutils_allocator_t *allocator)
 Set the topic type in the given topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_node_name (rmw_topic_endpoint_info_t *topic_endpoint_info, const char *node_name, rcutils_allocator_t *allocator)
 Set the node name in the given topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_node_namespace (rmw_topic_endpoint_info_t *topic_endpoint_info, const char *node_namespace, rcutils_allocator_t *allocator)
 Set the node namespace in the given topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_endpoint_type (rmw_topic_endpoint_info_t *topic_endpoint_info, rmw_endpoint_type_t type)
 Set the endpoint type in the given topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_gid (rmw_topic_endpoint_info_t *topic_endpoint_info, const uint8_t gid[], size_t size)
 Set the endpoint gid in the given topic endpoint info data structure. More...
 
rmw_ret_t rmw_topic_endpoint_info_set_qos_profile (rmw_topic_endpoint_info_t *topic_endpoint_info, const rmw_qos_profile_t *qos_profile)
 Set the endpoint QoS profile in the given topic endpoint info data structure. More...
 

Typedef Documentation

◆ rmw_topic_endpoint_info_t

A data structure that encapsulates the node name, node namespace, topic_type, gid, and qos_profile of publishers and subscriptions for a topic.

Function Documentation

◆ rmw_get_zero_initialized_topic_endpoint_info()

rmw_topic_endpoint_info_t rmw_get_zero_initialized_topic_endpoint_info ( void  )

Return zero initialized topic endpoint info data structure.

Endpoint type will be invalid. Endpoint QoS profile will be the system default.

◆ rmw_topic_endpoint_info_fini()

rmw_ret_t rmw_topic_endpoint_info_fini ( rmw_topic_endpoint_info_t topic_endpoint_info,
rcutils_allocator_t allocator 
)

Finalize a topic endpoint info data structure.

This function deallocates all allocated members of the given data structure, and then zero initializes it. If a logical error, such as RMW_RET_INVALID_ARGUMENT, ensues, this function will return early, leaving the given data structure unchanged. Otherwise, it will proceed despite errors.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Finalization is a reentrant procedure, but:
  • Access to the topic endpoint info data structure is not synchronized. It is not safe to read or write topic_endpoint during finalization.
  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.
Parameters
[in,out]topic_endpoint_infoData structure to be finalized.
[in]allocatorAllocator used to populate the given topic_endpoint_info.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if allocator is invalid, by rcutils_allocator_is_valid() definition, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_topic_type()

rmw_ret_t rmw_topic_endpoint_info_set_topic_type ( rmw_topic_endpoint_info_t topic_endpoint_info,
const char *  topic_type,
rcutils_allocator_t allocator 
)

Set the topic type in the given topic endpoint info data structure.

This functions allocates memory and copies the value of the topic_type argument to set the data structure topic_type member.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but:
  • Access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the topic_type member of the given topic_endpoint while setting it.
  • Access to C-style string arguments is read-only but it is not synchronized. Concurrent topic_type reads are safe, but concurrent reads and writes are not.
  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.
Precondition
Given topic_type is a valid C-style string i.e. NULL terminated.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]topic_typeType name to be set.
[in]allocatorAllocator to be used.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if topic_type is NULL, or
RMW_RET_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_node_name()

rmw_ret_t rmw_topic_endpoint_info_set_node_name ( rmw_topic_endpoint_info_t topic_endpoint_info,
const char *  node_name,
rcutils_allocator_t allocator 
)

Set the node name in the given topic endpoint info data structure.

This functions allocates memory and copies the value of the node_name argument to set the data structure node_name member.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but:
  • Access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the node_name member of the given topic_endpoint while setting it.
  • Access to C-style string arguments is read-only but it is not synchronized. Concurrent node_name reads are safe, but concurrent reads and writes are not.
  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.
Precondition
Given node_name is a valid C-style string i.e. NULL terminated.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]node_nameNode name to be set.
[in]allocatorAllocator to be used.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if node_name is NULL, or
RMW_RET_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_node_namespace()

rmw_ret_t rmw_topic_endpoint_info_set_node_namespace ( rmw_topic_endpoint_info_t topic_endpoint_info,
const char *  node_namespace,
rcutils_allocator_t allocator 
)

Set the node namespace in the given topic endpoint info data structure.

This functions allocates memory and copies the value of the node_namespace argument to set the data structure node_namespace member.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but:
  • Access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the node_namespace member of the given topic_endpoint while setting it.
  • Access to C-style string arguments is read-only but it is not synchronized. Concurrent node_namespace reads are safe, but concurrent reads and writes are not.
  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.
Precondition
Given node_namespace is a valid C-style string i.e. NULL terminated.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]node_namespaceNode namespace to be set.
[in]allocatorAllocator to be used.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if node_namespace is NULL, or
RMW_RET_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_endpoint_type()

rmw_ret_t rmw_topic_endpoint_info_set_endpoint_type ( rmw_topic_endpoint_info_t topic_endpoint_info,
rmw_endpoint_type_t  type 
)

Set the endpoint type in the given topic endpoint info data structure.

This functions assigns the value of the type argument to the data structure endpoint_type member.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the endpoint_type member of the given topic_endpoint while setting it.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]typeEndpoint type to be set.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_gid()

rmw_ret_t rmw_topic_endpoint_info_set_gid ( rmw_topic_endpoint_info_t topic_endpoint_info,
const uint8_t  gid[],
size_t  size 
)

Set the endpoint gid in the given topic endpoint info data structure.

This functions copies the value of the gid argument to the data structure endpoint_gid member.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the gid member of the given topic_endpoint while setting it.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]gidEndpoint gid to be set.
[in]sizeSize of the given gid.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if gid is NULL, or
RMW_RET_INVALID_ARGUMENT if size is greater than RMW_GID_STORAGE_SIZE, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_set_qos_profile()

rmw_ret_t rmw_topic_endpoint_info_set_qos_profile ( rmw_topic_endpoint_info_t topic_endpoint_info,
const rmw_qos_profile_t qos_profile 
)

Set the endpoint QoS profile in the given topic endpoint info data structure.

This functions assigns the value of the qos_profile argument to the data structure qos_profile member.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Setting a member is a reentrant procedure, but access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the qos_profile member of the given topic_endpoint while setting it.
Parameters
[in,out]topic_endpoint_infoData structure to be populated.
[in]qos_profileQoS profile to be set.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info is NULL, or
RMW_RET_INVALID_ARGUMENT if qos_profile is NULL, or
RMW_RET_ERROR when an unspecified error occurs.
Remarks
This function sets the RMW error state on failure.