Skip to content

Commit

Permalink
use implementation identifier in init and shutdown functions
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
wjwwood committed Nov 7, 2018
1 parent 839cdc3 commit e8c9d01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rmw/include/rmw/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ typedef struct RMW_PUBLIC_TYPE rmw_init_options_t {
* It is designed to be used with `rcl_init()` and `rcl_get_instance_id()`.
*/
uint64_t instance_id;
/// Implementation identifier, used to ensure two different implementations are not being mixed.
const char * implementation_identifier;
/// Implementation defined init options.
rmw_init_options_impl_t * impl;
} rmw_init_options_t;
Expand All @@ -64,6 +66,8 @@ typedef struct rmw_init_context_impl_t rmw_init_context_impl_t;
typedef struct RMW_PUBLIC_TYPE rmw_init_context_t {
/// Locally (process local) unique ID that represents this init/shutdown cycle.
uint64_t instance_id;
/// Implementation identifier, used to ensure two different implementations are not being mixed.
const char * implementation_identifier;
/// Implementation defined init context information.
rmw_init_context_impl_t * impl;
} rmw_init_context_t;
Expand Down Expand Up @@ -94,6 +98,8 @@ rmw_get_zero_initialized_init_context(void);
* \param[in] options initialization options to be used during initialization
* \param[out] context resulting context struct
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the implementation
* identifier does not match, or
* \return `RMW_RET_INVALID_ARGUMENT` if any arguments are null or invalid, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
Expand All @@ -119,6 +125,8 @@ rmw_init(const rmw_init_options_t * options, rmw_init_context_t * context);
*
* \param[in] context resulting context struct
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the implementation
* identifier does not match, or
* \return `RMW_RET_INVALID_ARGUMENT` if the argument is null or invalid, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
Expand Down
2 changes: 2 additions & 0 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ typedef int rmw_ret_t;
#define RMW_RET_BAD_ALLOC 10
/// Invalid argument return code.
#define RMW_RET_INVALID_ARGUMENT 11
/// Incorrect rmw implementation.
#define RMW_RET_INCORRECT_RMW_IMPLEMENTATION 12

// 24 bytes is the most memory needed to represent the GID by any current
// implementation. It may need to be increased in the future.
Expand Down

0 comments on commit e8c9d01

Please sign in to comment.