Skip to content

Commit

Permalink
Merge pull request #2017 from elBoberido/iox-1036-remove-creation-pat…
Browse files Browse the repository at this point in the history
…tern

iox-#1036 remove creation pattern
  • Loading branch information
elBoberido authored Sep 6, 2023
2 parents f434f6f + 5a51c7c commit 9d32b95
Show file tree
Hide file tree
Showing 22 changed files with 100 additions and 371 deletions.
2 changes: 1 addition & 1 deletion doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@
#include "iceoryx_hoofs/design_pattern/creation.hpp"

// after
#include "iceoryx_dust/design/creation.hpp"
// fully removed
```

```cpp
Expand Down
1 change: 0 additions & 1 deletion iceoryx_dust/include/iceoryx_dust/cxx/forward_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ class forward_list
size_type& getNextIdx(const const_iterator& iter) noexcept;
const size_type& getNextIdx(const const_iterator& iter) const noexcept;
void setNextIdx(const size_type idx, const size_type nextIdx) noexcept;
static void errorMessage(const char* source, const char* msg) noexcept;

//***************************************
// members
Expand Down
150 changes: 0 additions & 150 deletions iceoryx_dust/include/iceoryx_dust/design/creation.hpp

This file was deleted.

11 changes: 3 additions & 8 deletions iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


#include "iceoryx_dust/cxx/forward_list.hpp"
#include "iox/logging.hpp"


namespace iox
Expand Down Expand Up @@ -233,7 +234,7 @@ forward_list<T, Capacity>::emplace_after(const_iterator iter, ConstructorArgs&&.

if (m_size >= Capacity)
{
errorMessage(__PRETTY_FUNCTION__, " capacity exhausted ");
IOX_LOG(DEBUG) << "capacity exhausted";
return end();
}

Expand Down Expand Up @@ -271,7 +272,7 @@ inline typename forward_list<T, Capacity>::iterator forward_list<T, Capacity>::e
// additional validity check on to-be-erase element
if (!isValidElementIdx(eraseIdx) || empty())
{
errorMessage(__PRETTY_FUNCTION__, " iterator is end() or list is empty");
IOX_LOG(DEBUG) << "iterator is end() or list is empty";
return end();
}

Expand Down Expand Up @@ -609,12 +610,6 @@ inline bool forward_list<T, Capacity>::isInvalidIterOrDifferentLists(const const
return isInvalidIterator(iter);
}

template <typename T, uint64_t Capacity>
inline void forward_list<T, Capacity>::errorMessage(const char* source, const char* msg) noexcept
{
std::cerr << source << " ::: " << msg << std::endl;
}


} // namespace cxx
} // namespace iox
Expand Down
86 changes: 0 additions & 86 deletions iceoryx_dust/include/iceoryx_dust/internal/design/creation.inl

This file was deleted.

27 changes: 13 additions & 14 deletions iceoryx_dust/source/posix_wrapper/message_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "iceoryx_hoofs/posix_wrapper/posix_call.hpp"
#include "iceoryx_platform/fcntl.hpp"
#include "iceoryx_platform/platform_correction.hpp"
#include "iox/logging.hpp"

#include <chrono>
#include <string>
Expand Down Expand Up @@ -53,7 +54,7 @@ expected<MessageQueue, IpcChannelError> MessageQueueBuilder::create() const noex
.and_then([&sanitizedName](auto& r) {
if (r.errnum != ENOENT)
{
std::cout << "MQ still there, doing an unlink of " << sanitizedName << std::endl;
IOX_LOG(DEBUG) << "MQ still there, doing an unlink of '" << sanitizedName << "'";
}
});
}
Expand Down Expand Up @@ -99,7 +100,7 @@ MessageQueue::~MessageQueue() noexcept
{
if (destroy().has_error())
{
std::cerr << "unable to cleanup message queue \"" << m_name << "\" in the destructor" << std::endl;
IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name << "' in the destructor";
}
}

Expand All @@ -109,12 +110,10 @@ MessageQueue& MessageQueue::operator=(MessageQueue&& other) noexcept
{
if (destroy().has_error())
{
std::cerr << "unable to cleanup message queue \"" << m_name
<< "\" during move operation - resource leaks are possible!" << std::endl;
IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name
<< "' during move operation - resource leaks are possible!";
}

/// NOLINTJUSTIFICATION iox-#1036 will be fixed with the builder pattern
/// NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved)
m_name = std::move(other.m_name);
m_attributes = other.m_attributes;
m_mqDescriptor = other.m_mqDescriptor;
Expand Down Expand Up @@ -303,8 +302,8 @@ expected<void, IpcChannelError> MessageQueue::timedSend(const std::string& msg,
const uint64_t messageSize = msg.size() + NULL_TERMINATOR_SIZE;
if (messageSize > static_cast<uint64_t>(m_attributes.mq_msgsize))
{
std::cerr << "the message \"" << msg << "\" which should be sent to the message queue \"" << m_name
<< "\" is too long" << std::endl;
IOX_LOG(ERROR) << "the message '" << msg << "' which should be sent to the message queue '" << m_name
<< "' is too long";
return err(IpcChannelError::MESSAGE_TOO_LONG);
}

Expand Down Expand Up @@ -345,12 +344,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
{
case EACCES:
{
std::cerr << "access denied to message queue \"" << name << "\"" << std::endl;
IOX_LOG(ERROR) << "access denied to message queue '" << name << "'";
return IpcChannelError::ACCESS_DENIED;
}
case EAGAIN:
{
std::cerr << "the message queue \"" << name << "\" is full" << std::endl;
IOX_LOG(ERROR) << "the message queue '" << name << "' is full";
return IpcChannelError::CHANNEL_FULL;
}
case ETIMEDOUT:
Expand All @@ -360,12 +359,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
}
case EEXIST:
{
std::cerr << "message queue \"" << name << "\" already exists" << std::endl;
IOX_LOG(ERROR) << "message queue '" << name << "' already exists";
return IpcChannelError::CHANNEL_ALREADY_EXISTS;
}
case EINVAL:
{
std::cerr << "provided invalid arguments for message queue \"" << name << "\"" << std::endl;
IOX_LOG(ERROR) << "provided invalid arguments for message queue '" << name << "'";
return IpcChannelError::INVALID_ARGUMENTS;
}
case ENOENT:
Expand All @@ -375,12 +374,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
}
case ENAMETOOLONG:
{
std::cerr << "message queue name \"" << name << "\" is too long" << std::endl;
IOX_LOG(ERROR) << "message queue name '" << name << "' is too long";
return IpcChannelError::INVALID_CHANNEL_NAME;
}
default:
{
std::cerr << "internal logic error in message queue \"" << name << "\" occurred" << std::endl;
IOX_LOG(ERROR) << "internal logic error in message queue '" << name << "' occurred";
return IpcChannelError::INTERNAL_LOGIC_ERROR;
}
}
Expand Down
Loading

0 comments on commit 9d32b95

Please sign in to comment.