Function rcl_lifecycle_state_init

Function Documentation

rcl_ret_t rcl_lifecycle_state_init(rcl_lifecycle_state_t *state, uint8_t id, const char *label, const rcl_allocator_t *allocator)

Initialize a rcl_lifecycle_state_init.

This function initializes a state based on an id and a label.

The given rcl_lifecycle_state_t must be zero initialized with the function rcl_lifecycle_get_zero_initialized_state() and must not be already initialized by this function. The allocator will be used to allocate the label string.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • state[inout] pointer to the state struct to be initialized

  • id[in] identifier of the state

  • label[in] label of the state

  • allocator[in] a valid allocator used to initialized the lifecycle state

Returns:

RCL_RET_OK if state was initialized successfully, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.