Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1391 Move 'VariantQueue' to iceoryx_posh
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jan 2, 2024
1 parent 8c32765 commit e88f23b
Show file tree
Hide file tree
Showing 59 changed files with 83 additions and 115 deletions.
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ using namespace iox;
using namespace iox::popo;
using namespace iox::runtime;
using namespace iox::capro;
using namespace iox::cxx;

extern "C" {
#include "iceoryx_binding_c/client.h"
Expand Down
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


using namespace iox;
using namespace iox::cxx;
using namespace iox::popo;
using namespace iox::capro;
using namespace iox::mepoo;
Expand Down
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_request_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ using namespace iox;
using namespace iox::popo;
using namespace iox::runtime;
using namespace iox::capro;
using namespace iox::cxx;

extern "C" {
#include "iceoryx_binding_c/request_header.h"
Expand Down
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_response_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ using namespace iox;
using namespace iox::popo;
using namespace iox::runtime;
using namespace iox::capro;
using namespace iox::cxx;

extern "C" {
#include "iceoryx_binding_c/response_header.h"
Expand Down
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ using namespace iox;
using namespace iox::popo;
using namespace iox::runtime;
using namespace iox::capro;
using namespace iox::cxx;

extern "C" {
#include "iceoryx_binding_c/server.h"
Expand Down
1 change: 0 additions & 1 deletion iceoryx_binding_c/source/c_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


using namespace iox;
using namespace iox::cxx;
using namespace iox::popo;
using namespace iox::capro;
using namespace iox::mepoo;
Expand Down
3 changes: 1 addition & 2 deletions iceoryx_binding_c/test/moduletests/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using namespace iox::popo;
using namespace iox::capro;
using namespace iox;
using namespace iox::cxx;
using namespace iox::testing;

extern "C" {
Expand Down Expand Up @@ -117,7 +116,7 @@ class iox_client_test : public Test
iox_client_storage_t sutStorage;

ServerChunkQueueData_t serverChunkQueueData{iox::popo::QueueFullPolicy::DISCARD_OLDEST_DATA,
iox::cxx::VariantQueueTypes::SoFi_MultiProducerSingleConsumer};
iox::popo::VariantQueueTypes::SoFi_MultiProducerSingleConsumer};
ChunkQueuePopper<ServerChunkQueueData_t> serverRequestQueue{&serverChunkQueueData};

static constexpr const char SERVICE[] = "allGlory";
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class iox_listener_test : public Test
m_subscriberPortData.resize(MAX_NUMBER_OF_EVENTS_PER_LISTENER + 1U,
TEST_SERVICE_DESCRIPTION,
"myApp",
iox::cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
iox::popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
subscriberOptions);
m_subscriber.resize(MAX_NUMBER_OF_EVENTS_PER_LISTENER + 1U);
for (uint64_t i = 0U; i < MAX_NUMBER_OF_EVENTS_PER_LISTENER + 1U; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace
{
using namespace ::testing;
using namespace iox::capro;
using namespace iox::cxx;
using namespace iox::mepoo;

class iox_notification_info_test : public Test
Expand Down Expand Up @@ -115,7 +114,7 @@ class iox_notification_info_test : public Test
SubscriberOptions m_subscriberOptions{MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY, 0U};
iox::popo::SubscriberPortData m_portPtr{TEST_TheHoff_DESCRIPTION,
"myApp",
iox::cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
iox::popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
m_subscriberOptions};
ChunkQueuePusher<SubscriberPortData::ChunkQueueData_t> m_chunkPusher{&m_portPtr.m_chunkReceiverData};
cpp2c_Subscriber m_subscriber;
Expand Down
3 changes: 1 addition & 2 deletions iceoryx_binding_c/test/moduletests/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ using namespace ::testing;
using namespace iox::testing;
using namespace iox::roudi_env;
using namespace iox::capro;
using namespace iox::cxx;
using namespace iox::mepoo;

class iox_pub_test : public Test
Expand Down Expand Up @@ -103,7 +102,7 @@ class iox_pub_test : public Test

using ChunkQueueData_t = popo::ChunkQueueData<DefaultChunkQueueConfig, popo::ThreadSafePolicy>;
ChunkQueueData_t m_chunkQueueData{iox::popo::QueueFullPolicy::DISCARD_OLDEST_DATA,
iox::cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer};
iox::popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer};

BumpAllocator m_memoryAllocator{m_memory, MEMORY_SIZE};
MePooConfig m_mempoolconf;
Expand Down
3 changes: 1 addition & 2 deletions iceoryx_binding_c/test/moduletests/test_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using namespace iox::popo;
using namespace iox::capro;
using namespace iox;
using namespace iox::cxx;
using namespace iox::testing;

extern "C" {
Expand Down Expand Up @@ -111,7 +110,7 @@ class iox_server_test : public Test
iox_server_storage_t sutStorage;

ClientChunkQueueData_t clientResponseQueueData{iox::popo::QueueFullPolicy::DISCARD_OLDEST_DATA,
iox::cxx::VariantQueueTypes::SoFi_MultiProducerSingleConsumer};
iox::popo::VariantQueueTypes::SoFi_MultiProducerSingleConsumer};
ChunkQueuePopper<ClientChunkQueueData_t> clientResponseQueue{&clientResponseQueueData};

static constexpr const char SERVICE[] = "TheHoff";
Expand Down
3 changes: 1 addition & 2 deletions iceoryx_binding_c/test/moduletests/test_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace
{
using namespace ::testing;
using namespace iox::capro;
using namespace iox::cxx;
using namespace iox::mepoo;

class iox_sub_test : public Test
Expand Down Expand Up @@ -114,7 +113,7 @@ class iox_sub_test : public Test
iox::popo::SubscriberOptions subscriberOptions{MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY, 0U};
iox::popo::SubscriberPortData m_portPtr{TEST_SERVICE_DESCRIPTION,
"myApp",
iox::cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
iox::popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
subscriberOptions};
ChunkQueuePusher<SubscriberPortData::ChunkQueueData_t> m_chunkPusher{&m_portPtr.m_chunkReceiverData};
std::unique_ptr<cpp2c_Subscriber> m_subscriber{new cpp2c_Subscriber};
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_wait_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class iox_ws_test : public Test
{
m_portDataVector.emplace_back(TEST_SERVICE_DESCRIPTION,
"someAppName",
iox::cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
iox::popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer,
m_subscriberOptions);
m_subscriberVector.emplace_back();
m_subscriberVector[i].m_portData = &m_portDataVector[i];
Expand Down
1 change: 0 additions & 1 deletion iceoryx_hoofs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ The module structure is a logical grouping. It is replicated for `concurrent` an
|`SpscSofi` | i | Single producer, single consumer lock-free safely overflowing FiFo (SpscSofi). |
|`MpmcResizeableLockFreeQueue` | | Resizeable variant of the `MpmcLockfreeQueue` |
|`stack` | | Stack implementation with simple push/pop interface. |
|`VariantQueue` | | A queue which wraps multiple variants of Queues (SpscFifo, SpscSofi, MpmcResizeableLockFreeQueue) - will be moved to `iceoryx_posh` - |

#### Attribute overview of the available buffers

Expand Down
1 change: 0 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_cli_cli_definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;

/// This test is only some kind of compilation test to verify that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace
using namespace ::testing;
using namespace iox::cli;
using namespace iox;
using namespace iox::cxx;

class CommandLineParser_test : public Test
{
Expand Down
1 change: 0 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_posix_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;
using namespace iox::units;
using namespace iox::units::duration_literals;
Expand Down
1 change: 0 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_posix_file_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;

/// NOLINTJUSTIFICATION compile time string literal used only in tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;

class NamedSemaphoreTest : public Test
Expand Down
1 change: 0 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_posix_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;
using namespace iox::units;
using namespace iox::units::duration_literals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace
{
using namespace ::testing;
using namespace iox::cxx;
using namespace iox;

class UnnamedSemaphoreTest : public Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "test.hpp"

using namespace ::testing;
using namespace ::iox::cxx;
using namespace ::iox;
using namespace ::iox::testing;

Expand Down
1 change: 0 additions & 1 deletion iceoryx_posh/include/iceoryx_posh/iceoryx_posh_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef IOX_POSH_ICEORYX_POSH_TYPES_HPP
#define IOX_POSH_ICEORYX_POSH_TYPES_HPP

#include "iceoryx_hoofs/cxx/variant_queue.hpp"
#include "iceoryx_platform/platform_settings.hpp"
#include "iceoryx_posh/iceoryx_posh_deployment.hpp"
#include "iox/duration.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_DATA_HPP
#define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_DATA_HPP

#include "iceoryx_hoofs/cxx/variant_queue.hpp"
#include "iceoryx_posh/internal/mepoo/shm_safe_unmanaged_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/condition_notifier.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/variant_queue.hpp"
#include "iceoryx_posh/popo/port_queue_policies.hpp"
#include "iox/detail/unique_id.hpp"
#include "iox/relative_pointer.hpp"
Expand All @@ -38,12 +38,12 @@ struct ChunkQueueData : public LockingPolicy
using LockGuard_t = std::lock_guard<const ThisType_t>;
using ChunkQueueDataProperties_t = ChunkQueueDataProperties;

ChunkQueueData(const QueueFullPolicy policy, const cxx::VariantQueueTypes queueType) noexcept;
ChunkQueueData(const QueueFullPolicy policy, const VariantQueueTypes queueType) noexcept;

UniqueId m_uniqueId{};

static constexpr uint64_t MAX_CAPACITY = ChunkQueueDataProperties_t::MAX_QUEUE_CAPACITY;
cxx::VariantQueue<mepoo::ShmSafeUnmanagedChunk, MAX_CAPACITY> m_queue;
VariantQueue<mepoo::ShmSafeUnmanagedChunk, MAX_CAPACITY> m_queue;
std::atomic_bool m_queueHasLostChunks{false};

RelativePointer<ConditionVariableData> m_conditionVariableDataPtr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace iox
namespace popo
{
template <typename ChunkQueueProperties, typename LockingPolicy>
inline ChunkQueueData<ChunkQueueProperties, LockingPolicy>::ChunkQueueData(
const QueueFullPolicy policy, const cxx::VariantQueueTypes queueType) noexcept
inline ChunkQueueData<ChunkQueueProperties, LockingPolicy>::ChunkQueueData(const QueueFullPolicy policy,
const VariantQueueTypes queueType) noexcept
: m_queue(queueType)
, m_queueFullPolicy(policy)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_RECEIVER_DATA_HPP
#define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_RECEIVER_DATA_HPP

#include "iceoryx_hoofs/cxx/variant_queue.hpp"
#include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_data.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/variant_queue.hpp"
#include "iceoryx_posh/internal/popo/used_chunk_list.hpp"
#include "iceoryx_posh/mepoo/memory_info.hpp"

Expand All @@ -30,7 +30,7 @@ namespace popo
template <uint32_t MaxChunksHeldSimultaneously, typename ChunkQueueDataType>
struct ChunkReceiverData : public ChunkQueueDataType
{
explicit ChunkReceiverData(const cxx::VariantQueueTypes queueType,
explicit ChunkReceiverData(const VariantQueueTypes queueType,
const QueueFullPolicy queueFullPolicy,
const mepoo::MemoryInfo& memoryInfo = mepoo::MemoryInfo()) noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace popo
{
template <uint32_t MaxChunksHeldSimultaneously, typename ChunkQueueDataType>
inline ChunkReceiverData<MaxChunksHeldSimultaneously, ChunkQueueDataType>::ChunkReceiverData(
const cxx::VariantQueueTypes queueType,
const VariantQueueTypes queueType,
const QueueFullPolicy queueFullPolicy,
const mepoo::MemoryInfo& memoryInfo) noexcept
: ChunkQueueDataType(queueFullPolicy, queueType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IOX_HOOFS_CXX_VARIANT_QUEUE_HPP
#define IOX_HOOFS_CXX_VARIANT_QUEUE_HPP

#ifndef IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_HPP
#define IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_HPP

#include "iox/detail/mpmc_resizeable_lockfree_queue.hpp"
#include "iox/detail/spsc_fifo.hpp"
Expand All @@ -27,14 +28,14 @@

namespace iox
{
namespace cxx
namespace popo
{
/// @brief list of the supported underlying queue types
/// @note if a new queue type is added the following steps have to be
/// performed:
/// 1. add queue type here
/// 2. add queue type in m_fifo data member variant type
/// 3. increase numberOfQueueTypes in test_cxx_variant_queue test
/// 3. increase numberOfQueueTypes in test_popo_variant_queue test
enum class VariantQueueTypes : uint64_t
{
FiFo_SingleProducerSingleConsumer = 0,
Expand All @@ -51,8 +52,8 @@ enum class VariantQueueTypes : uint64_t
/// @param[in] ValueType type which should be stored
/// @param[in] Capacity capacity of the underlying fifo
/// @code
/// cxx::VariantQueue<int, 5> nonOverflowingQueue(cxx::VariantQueueTypes::FiFo_SingleProducerSingleConsumer);
/// cxx::VariantQueue<int, 5> overflowingQueue(cxx::VariantQueueTypes::SoFi_SingleProducerSingleConsumer);
/// popo::VariantQueue<int, 5> nonOverflowingQueue(popo::VariantQueueTypes::FiFo_SingleProducerSingleConsumer);
/// popo::VariantQueue<int, 5> overflowingQueue(popo::VariantQueueTypes::SoFi_SingleProducerSingleConsumer);
///
/// // overflow case
/// auto status = nonOverflowingQueue.push(123);
Expand Down Expand Up @@ -116,9 +117,9 @@ class VariantQueue
const VariantQueueTypes m_type;
fifo_t m_fifo;
};
} // namespace cxx
} // namespace popo
} // namespace iox

#include "iceoryx_hoofs/internal/cxx/variant_queue.inl"
#include "iceoryx_posh/internal/popo/building_blocks/variant_queue.inl"

#endif // IOX_HOOFS_CXX_VARIANT_QUEUE_HPP
#endif // IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IOX_HOOFS_CXX_VARIANT_QUEUE_INL
#define IOX_HOOFS_CXX_VARIANT_QUEUE_INL

#include "iceoryx_hoofs/cxx/variant_queue.hpp"
#ifndef IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_INL
#define IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_INL

#include "iceoryx_posh/internal/popo/building_blocks/variant_queue.hpp"

namespace iox
{
namespace cxx
namespace popo
{
template <typename ValueType, uint64_t Capacity>
inline VariantQueue<ValueType, Capacity>::VariantQueue(const VariantQueueTypes type) noexcept
Expand Down Expand Up @@ -259,7 +260,7 @@ inline uint64_t VariantQueue<ValueType, Capacity>::capacity() const noexcept
return 0U;
}

} // namespace cxx
} // namespace popo
} // namespace iox

#endif // IOX_HOOFS_CXX_VARIANT_QUEUE_INL
#endif // IOX_POSH_POPO_BUILDING_BLOCKS_VARIANT_QUEUE_INL
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#ifndef IOX_POSH_POPO_PORTS_SUBSCRIBER_PORT_DATA_HPP
#define IOX_POSH_POPO_PORTS_SUBSCRIBER_PORT_DATA_HPP

#include "iceoryx_hoofs/cxx/variant_queue.hpp"
#include "iceoryx_posh/capro/service_description.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/variant_queue.hpp"
#include "iceoryx_posh/internal/popo/ports/base_port_data.hpp"
#include "iceoryx_posh/internal/popo/ports/pub_sub_port_types.hpp"
#include "iceoryx_posh/popo/subscriber_options.hpp"
Expand All @@ -36,7 +36,7 @@ struct SubscriberPortData : public BasePortData
{
SubscriberPortData(const capro::ServiceDescription& serviceDescription,
const RuntimeName_t& runtimeName,
cxx::VariantQueueTypes queueType,
const VariantQueueTypes queueType,
const SubscriberOptions& subscriberOptions,
const mepoo::MemoryInfo& memoryInfo = mepoo::MemoryInfo()) noexcept;

Expand Down
Loading

0 comments on commit e88f23b

Please sign in to comment.