Skip to content

Commit

Permalink
Rosidl_runtime_c type hash struct
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
  • Loading branch information
emersonknapp committed Feb 22, 2023
1 parent 2524e0a commit 5e82fe0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions rmw/include/rmw/topic_endpoint_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern "C"

#include "rcutils/allocator.h"
#include "rcutils/sha256.h"
#include "rosidl_runtime_c/type_hash.h"
#include "rmw/types.h"
#include "rmw/visibility_control.h"

Expand All @@ -34,10 +35,10 @@ typedef struct RMW_PUBLIC_TYPE rmw_topic_endpoint_info_s
const char * node_name;
/// Namespace of the node
const char * node_namespace;
/// The associated topic type
/// The associated topic type's name
const char * topic_type;
/// Hashed value for topic type's description
uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE];
rosidl_type_hash_t topic_type_hash;
/// The endpoint type
rmw_endpoint_type_t endpoint_type;
/// The GID of the endpoint
Expand Down Expand Up @@ -173,8 +174,7 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_topic_endpoint_info_set_topic_type_hash(
rmw_topic_endpoint_info_t * topic_endpoint_info,
const uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE]);

const rosidl_type_hash_t * type_hash);

/// Set the node name in the given topic endpoint info data structure.
/**
Expand Down
6 changes: 3 additions & 3 deletions rmw/src/topic_endpoint_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ rmw_topic_endpoint_info_set_topic_type(
rmw_ret_t
rmw_topic_endpoint_info_set_topic_type_hash(
rmw_topic_endpoint_info_t * topic_endpoint_info,
const uint8_t topic_type_hash[RCUTILS_SHA256_BLOCK_SIZE])
const rosidl_type_hash_t * type_hash)
{
RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(topic_endpoint_info, RMW_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(topic_type_hash, RMW_RET_INVALID_ARGUMENT);
memcpy(topic_endpoint_info->topic_type_hash, topic_type_hash, RCUTILS_SHA256_BLOCK_SIZE);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(type_hash, RMW_RET_INVALID_ARGUMENT);
topic_endpoint_info->topic_type_hash = *type_hash;
return RMW_RET_OK;
}

Expand Down

0 comments on commit 5e82fe0

Please sign in to comment.