Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iox-#1036 Builder pattern for message queue #2014

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
iox-#1036 Make types more robust
elBoberido committed Sep 1, 2023
commit 3b67f474df4c9c0303d608727ccfc5789b9a15f3
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ class MessageQueue
/// @todo iox-#1036 Remove when all channels are ported to the builder pattern
static expected<MessageQueue, IpcChannelError> create(const IpcChannelName_t& name,
const IpcChannelSide channelSide,
const size_t maxMsgSize = MAX_MESSAGE_SIZE,
const uint64_t maxMsgSize = MAX_MESSAGE_SIZE,
const uint64_t maxMsgNumber = MAX_MESSAGE_NUMBER) noexcept;

/// @todo iox-#1036 Remove when all channels are ported to the builder pattern
@@ -143,7 +143,7 @@ class MessageQueueBuilder
IOX_BUILDER_PARAMETER(IpcChannelSide, channelSide, IpcChannelSide::CLIENT)

/// @brief Defines the max message size of the message queue
IOX_BUILDER_PARAMETER(size_t, maxMsgSize, MessageQueue::MAX_MESSAGE_SIZE)
IOX_BUILDER_PARAMETER(uint64_t, maxMsgSize, MessageQueue::MAX_MESSAGE_SIZE)

/// @brief Defines the max number of messages for the message queue.
IOX_BUILDER_PARAMETER(uint64_t, maxMsgNumber, MessageQueue::MAX_MESSAGE_NUMBER)
6 changes: 3 additions & 3 deletions iceoryx_dust/source/posix_wrapper/message_queue.cpp
Original file line number Diff line number Diff line change
@@ -61,8 +61,8 @@ expected<MessageQueue, IpcChannelError> MessageQueueBuilder::create() const noex
// fields have a different order in QNX, so we need to initialize by name
mq_attr attributes;
attributes.mq_flags = 0;
attributes.mq_maxmsg = static_cast<long>(m_maxMsgNumber);
attributes.mq_msgsize = static_cast<long>(m_maxMsgSize);
attributes.mq_maxmsg = static_cast<decltype(attributes.mq_maxmsg)>(m_maxMsgNumber);
attributes.mq_msgsize = static_cast<decltype(attributes.mq_msgsize)>(m_maxMsgSize);
attributes.mq_curmsgs = 0L;
#ifdef __QNX__
attributes.mq_recvwait = 0L;
@@ -93,7 +93,7 @@ MessageQueue::MessageQueue(const IpcChannelName_t&& name,
// NOLINTNEXTLINE(readability-function-size) @todo iox-#832 make a struct out of arguments
expected<MessageQueue, IpcChannelError> MessageQueue::create(const IpcChannelName_t& name,
const IpcChannelSide channelSide,
const size_t maxMsgSize,
const uint64_t maxMsgSize,
const uint64_t maxMsgNumber) noexcept
{
return MessageQueueBuilder()