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

Go to the source code of this file.

Classes

struct  rmw_init_options_t
 Options structure used during rmw_init(). More...
 

Typedefs

typedef struct rmw_init_options_impl_t rmw_init_options_impl_t
 Implementation defined options structure used during rmw_init(). More...
 
typedef struct RMW_PUBLIC_TYPE rmw_init_options_t rmw_init_options_t
 Options structure used during rmw_init(). More...
 

Functions

rmw_init_options_t rmw_get_zero_initialized_init_options (void)
 Return a zero initialized init options structure. More...
 
rmw_ret_t rmw_init_options_init (rmw_init_options_t *init_options, rcutils_allocator_t allocator)
 Initialize given init_options with the default values and implementation specific values. More...
 
rmw_ret_t rmw_init_options_copy (const rmw_init_options_t *src, rmw_init_options_t *dst)
 Copy the given source init options to the destination init options. More...
 
rmw_ret_t rmw_init_options_fini (rmw_init_options_t *init_options)
 Finalize the given init_options. More...
 

Typedef Documentation

◆ rmw_init_options_impl_t

Implementation defined options structure used during rmw_init().

This should be defined by the rmw implementation.

◆ rmw_init_options_t

Options structure used during rmw_init().

Function Documentation

◆ rmw_get_zero_initialized_init_options()

rmw_init_options_t rmw_get_zero_initialized_init_options ( void  )

Return a zero initialized init options structure.

◆ rmw_init_options_init()

rmw_ret_t rmw_init_options_init ( rmw_init_options_t init_options,
rcutils_allocator_t  allocator 
)

Initialize given init_options with the default values and implementation specific values.

The given allocator is used, if required, during setup of the init options, but is also used during initialization.

In either case the given allocator is stored in the returned init options.

The impl pointer should not be changed manually.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics Yes
Lock-Free Yes

This should be defined by the rmw implementation.

Parameters
[in,out]init_optionsobject to be setup
[in]allocatorto be used during setup and during initialization
Returns
RMW_RET_OK if setup is successful, or
RMW_RET_INVALID_ARGUMENT if init_options has already be initialized, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
RMW_RET_BAD_ALLOC if allocating memory failed, or
RMW_RET_ERROR if an unspecified error occurs.

◆ rmw_init_options_copy()

rmw_ret_t rmw_init_options_copy ( const rmw_init_options_t src,
rmw_init_options_t dst 
)

Copy the given source init options to the destination init options.

The allocator from the source is used for any allocations and stored in the destination.

The destination should either be zero initialized with rmw_get_zero_initialized_init_options() or should have had rmw_init_options_fini() called on it. Giving an already initialized init options for the destination will result in a failure with return code RMW_RET_INVALID_ARGUMENT.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics Yes
Lock-Free Yes

This should be defined by the rmw implementation.

Parameters
[in]srcrcl_init_options_t object to be copied from
[out]dstrcl_init_options_t object to be copied into
Returns
RMW_RET_OK if the copy is successful, or
RMW_RET_INCORRECT_RMW_IMPLEMENTATION if the implementation identifier for src does not match the implementation of this function, or
RMW_RET_INVALID_ARGUMENT if the dst has already be initialized, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
RMW_RET_BAD_ALLOC if allocating memory failed, or
RMW_RET_ERROR if an unspecified error occurs.

◆ rmw_init_options_fini()

rmw_ret_t rmw_init_options_fini ( rmw_init_options_t init_options)

Finalize the given init_options.

The given init_options must be non-NULL and valid, i.e. had rmw_init_options_init() called on it but not this function yet.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics Yes
Lock-Free Yes

This should be defined by the rmw implementation.

Parameters
[in,out]init_optionsobject to be setup
Returns
RMW_RET_OK if setup is successful, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
RMW_RET_ERROR if an unspecified error occurs.