Skip to content

Commit

Permalink
Add define to indicate that sequence numbers aren't supported. Fix co…
Browse files Browse the repository at this point in the history
…mpilation issue

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno committed Mar 4, 2022
1 parent caab676 commit 3ad6037
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ typedef struct RMW_PUBLIC_TYPE rmw_gid_s
uint8_t data[RMW_GID_STORAGE_SIZE];
} rmw_gid_t;

#define RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED INT64_MAX

/// Information describing an rmw message
typedef struct RMW_PUBLIC_TYPE rmw_message_info_s
{
Expand All @@ -530,21 +532,24 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_s
* The exact point at which the timestamp is taken is not specified, but
* it should be taken consistently at the same point in the
* process of receiving a message each time.
*/
rmw_time_point_value_t received_timestamp;
/// Sequence number of the received message set by the publisher.
/**
* This sequence number is set by the publisher and therefore uniquely identifies
* a message when combined with the publisher GID.
*
* If the rmw implementation doesn't support sequence numbers, it's value will be UINT64_MAX.
* If the rmw implementation doesn't support sequence numbers, it's value will be
* RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED.
*/
int64_t publication_sequence_number;
/// Sequence number of the received message set by the subscription.
/**
* This sequence number is set by the subscription regardless of which
* publish sent the message.
*
* If the rmw implementation doesn't support sequence numbers, it's value will be UINT64_MAX.
* If the rmw implementation doesn't support sequence numbers, it's value will be
* RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED.
*/
int64_t reception_sequence_number;
/// Global unique identifier of the publisher that sent the message.
Expand Down
4 changes: 3 additions & 1 deletion rmw/src/types.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ RMW_WARN_UNUSED
rmw_message_info_t
rmw_get_zero_initialized_message_info(void)
{
rmw_message_info_t zero_initialized_message_info = {0, 0, INT64_MAX, INT64_MAX, {NULL, {0}}, false};
rmw_message_info_t zero_initialized_message_info = {
0, 0, RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED, RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED,
{NULL, {0}}, false};
return zero_initialized_message_info;
}

0 comments on commit 3ad6037

Please sign in to comment.