rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
Classes | Typedefs | Functions
topic_endpoint_info_array.h File Reference
#include "rcutils/allocator.h"
#include "rmw/topic_endpoint_info.h"
#include "rmw/visibility_control.h"
Include dependency graph for topic_endpoint_info_array.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_array_t
 Array of topic endpoint information. More...
 

Typedefs

typedef struct RMW_PUBLIC_TYPE rmw_topic_endpoint_info_array_t rmw_topic_endpoint_info_array_t
 Array of topic endpoint information. More...
 

Functions

rmw_topic_endpoint_info_array_t rmw_get_zero_initialized_topic_endpoint_info_array (void)
 Return a zero initialized array of topic endpoint information. More...
 
rmw_ret_t rmw_topic_endpoint_info_array_check_zero (rmw_topic_endpoint_info_array_t *topic_endpoint_info_array)
 Check that the given topic_endpoint_info_array is zero initialized. More...
 
rmw_ret_t rmw_topic_endpoint_info_array_init_with_size (rmw_topic_endpoint_info_array_t *topic_endpoint_info_array, size_t size, rcutils_allocator_t *allocator)
 Initialize an array of topic endpoint information. More...
 
rmw_ret_t rmw_topic_endpoint_info_array_fini (rmw_topic_endpoint_info_array_t *topic_endpoint_info_array, rcutils_allocator_t *allocator)
 Finalize an array of topic endpoint information. More...
 

Typedef Documentation

◆ rmw_topic_endpoint_info_array_t

Array of topic endpoint information.

Function Documentation

◆ rmw_get_zero_initialized_topic_endpoint_info_array()

rmw_topic_endpoint_info_array_t rmw_get_zero_initialized_topic_endpoint_info_array ( void  )

Return a zero initialized array of topic endpoint information.

◆ rmw_topic_endpoint_info_array_check_zero()

rmw_ret_t rmw_topic_endpoint_info_array_check_zero ( rmw_topic_endpoint_info_array_t topic_endpoint_info_array)

Check that the given topic_endpoint_info_array is zero initialized.


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Thread-safety
Access to the array of topic endpoint information is read-only, but it is not synchronized. Concurrent topic_endpoint_info_array reads are safe, but concurrent reads and writes are not.
Parameters
[in]topic_endpoint_info_arrayArray to be checked.
Returns
RMW_RET_OK if array is zero initialized, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info_array is NULL, or
RMW_RET_ERROR if topic_endpoint_info_array is not zero initialized.
Remarks
This function sets the RMW error state on failure.

◆ rmw_topic_endpoint_info_array_init_with_size()

rmw_ret_t rmw_topic_endpoint_info_array_init_with_size ( rmw_topic_endpoint_info_array_t topic_endpoint_info_array,
size_t  size,
rcutils_allocator_t allocator 
)

Initialize an array of topic endpoint information.

This function allocates space to hold size topic endpoint information elements. Both info_array and size members are updated accordingly.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Thread-safety
Initialization is a reentrant procedure, but:
  • Access to the array of topic endpoint information is not synchronized. It is not safe to read or write topic_endpoint_info_array during initialization.
  • 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_info_arrayArray to be initialized on success, but left unchanged on failure.
[in]sizeSize of the array.
[in]allocatorAllocator to be used to populate names_and_types.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info_array is NULL, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info_array is not a zero initialized array, or
RMW_RET_INVALID_ARGUMENT if allocator is invalid, by rcutils_allocator_is_valid() definition, or
RMW_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_array_fini()

rmw_ret_t rmw_topic_endpoint_info_array_fini ( rmw_topic_endpoint_info_array_t topic_endpoint_info_array,
rcutils_allocator_t allocator 
)

Finalize an array of topic endpoint information.

This function deallocates the given array storage, and then zero initializes it. If a logical error, such as RMW_RET_INVALID_ARGUMENT, ensues, this function will return early, leaving the given array 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 array of topic endpoint information is not synchronized. It is not safe to read or write topic_endpoint_info_array during finalization.
  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.
Precondition
Given allocator must be the same used to initialize the given topic_endpoint_info_array.
Parameters
[in,out]topic_endpoint_info_arrayobject to be finalized.
[in]allocatorAllocator used to populate the given topic_endpoint_info_array.
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if topic_endpoint_info_array 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.