rcl  master
C API providing common ROS client library functionality.
Classes | Typedefs | Functions
init_options.h File Reference
#include "rmw/init.h"
#include "rcl/allocator.h"
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/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  rcl_init_options_t
 Encapsulation of init options and implementation defined init options. More...
 

Typedefs

typedef struct rcl_init_options_t rcl_init_options_t
 Encapsulation of init options and implementation defined init options. More...
 

Functions

rcl_init_options_t rcl_get_zero_initialized_init_options (void)
 Return a zero initialized rcl_init_options_t struct. More...
 
rcl_ret_t rcl_init_options_init (rcl_init_options_t *init_options, rcl_allocator_t allocator)
 Initialize given init_options with the default values and implementation specific values. More...
 
rcl_ret_t rcl_init_options_copy (const rcl_init_options_t *src, rcl_init_options_t *dst)
 Copy the given source init_options to the destination init_options. More...
 
rcl_ret_t rcl_init_options_fini (rcl_init_options_t *init_options)
 Finalize the given init_options. More...
 
rmw_init_options_trcl_init_options_get_rmw_init_options (rcl_init_options_t *init_options)
 Return the rmw init options which are stored internally. More...
 

Typedef Documentation

◆ rcl_init_options_t

Encapsulation of init options and implementation defined init options.

Function Documentation

◆ rcl_get_zero_initialized_init_options()

rcl_init_options_t rcl_get_zero_initialized_init_options ( void  )

Return a zero initialized rcl_init_options_t struct.

◆ rcl_init_options_init()

rcl_ret_t rcl_init_options_init ( rcl_init_options_t init_options,
rcl_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
Parameters
[in,out]init_optionsobject to be setup
[in]allocatorto be used during setup and during initialization
Returns
RCL_RET_OK if setup is successful, or
RCL_RET_ALREADY_INIT if init_options has already be initialized, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_init_options_copy()

rcl_ret_t rcl_init_options_copy ( const rcl_init_options_t src,
rcl_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 rcl_get_zero_initialized_init_options() or should have had rcl_init_options_fini() called on it. Giving an already initialized init options for the destination will result in a failure with return code RCL_RET_ALREADY_INIT.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics Yes
Lock-Free Yes
Parameters
[in]srcrcl_init_options_t object to be copied from
[out]dstrcl_init_options_t object to be copied into
Returns
RCL_RET_OK if the copy is successful, or
RCL_RET_ALREADY_INIT if the dst has already be initialized, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_init_options_fini()

rcl_ret_t rcl_init_options_fini ( rcl_init_options_t init_options)

Finalize the given init_options.

The given init_options must be non-NULL and valid, i.e. had rcl_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
Parameters
[in,out]init_optionsobject to be setup
Returns
RCL_RET_OK if setup is successful, or
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_init_options_get_rmw_init_options()

rmw_init_options_t* rcl_init_options_get_rmw_init_options ( rcl_init_options_t init_options)

Return the rmw init options which are stored internally.

This function can fail and return NULL if:

  • init_options is NULL
  • init_options is invalid, e.g. init_options->impl is NULL

If NULL is returned an error message will have been set.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics Yes
Lock-Free Yes
Parameters
[in]init_optionsobject from which the rmw init options should be retrieved
Returns
pointer to the the rmw init options, or
NULL if there was an error