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

Go to the source code of this file.

Classes

struct  rmw_names_and_types_t
 Associative array of topic or service names and types. More...
 

Typedefs

typedef struct RMW_PUBLIC_TYPE rmw_names_and_types_t rmw_names_and_types_t
 Associative array of topic or service names and types. More...
 

Functions

rmw_names_and_types_t rmw_get_zero_initialized_names_and_types (void)
 Return a rmw_names_and_types_t struct with members initialized to NULL. More...
 
rmw_ret_t rmw_names_and_types_check_zero (rmw_names_and_types_t *names_and_types)
 Check that a rmw_topic_names_and_types_t struct is zero initialized. More...
 
rmw_ret_t rmw_names_and_types_init (rmw_names_and_types_t *names_and_types, size_t size, rcutils_allocator_t *allocator)
 Initialize a rmw_names_and_types_t object. More...
 
rmw_ret_t rmw_names_and_types_fini (rmw_names_and_types_t *names_and_types)
 Finalize a rmw_names_and_types_t object. More...
 

Typedef Documentation

◆ rmw_names_and_types_t

Associative array of topic or service names and types.

Function Documentation

◆ rmw_get_zero_initialized_names_and_types()

rmw_names_and_types_t rmw_get_zero_initialized_names_and_types ( void  )

Return a rmw_names_and_types_t struct with members initialized to NULL.

◆ rmw_names_and_types_check_zero()

rmw_ret_t rmw_names_and_types_check_zero ( rmw_names_and_types_t names_and_types)

Check that a rmw_topic_names_and_types_t struct is zero initialized.

Sets error message if names_and_types is not zero initialized

Parameters
[in]names_and_typesObject to check
Returns
RMW_RET_OK if zero initialized, RMW_RET_INVALID_ARGUMENT otherwise

◆ rmw_names_and_types_init()

rmw_ret_t rmw_names_and_types_init ( rmw_names_and_types_t names_and_types,
size_t  size,
rcutils_allocator_t allocator 
)

Initialize a rmw_names_and_types_t object.

This function initializes the string array for the names and allocates space for all the string arrays for the types according to the given size, but it does not initialize the string array for each setup of types. However, the string arrays for each set of types is zero initialized.

If a non RMW_RET_OK return value is returned, the RMW error message will be set

Parameters
[in,out]names_and_typesobject to be initialized
[in]sizethe number of names and sets of types to be stored
[in]allocatorto be used to allocate and deallocate memory
Returns
RMW_RET_OK on successfully running the check, or
RMW_RET_INVALID_ARGUMENT if names_and_types is NULL, or
RMW_BAD_ALLOC if memory allocation fails, or
RMW_RET_ERROR when an unspecified error occurs.

◆ rmw_names_and_types_fini()

rmw_ret_t rmw_names_and_types_fini ( rmw_names_and_types_t names_and_types)

Finalize a rmw_names_and_types_t object.

The names_and_types_t objects are populated by one of the rmw_get_*_names_and_types() functions. During which memory is allocated to store the names and types. This function will reclaim any resources within the object so it is safe to destroy without leaking memory.

The allocator within the rmw_names_and_types_t object is used to deallocate memory.

If a non RMW_RET_OK return value is returned, the RMW error message will be set

Parameters
[in,out]names_and_typesobject to be finalized
Returns
RMW_RET_OK on successfully running the check, or
RMW_RET_INVALID_ARGUMENT if names_and_types is NULL, or
RMW_RET_ERROR when an unspecified error occurs.