Skip to content

Commit d0f47ea

Browse files
committed
iox-#1051 Move publish subscribe port type definitions to pub_sub_port_types.hpp
This commit consolidates publish/subscribe port related type definitions into pub_sub_port_types.hpp, following the established pattern of client_server_port_types.hpp. Changes: - Added PublisherChunkQueueData_t, PublisherChunkDistributorData_t, and PublisherChunkSenderData_t type aliases to pub_sub_port_types.hpp - Added SubscriberEvent and SubscriberState enums to pub_sub_port_types.hpp - Updated publisher_port_data.hpp to use types from pub_sub_port_types.hpp instead of defining them locally - Removed redundant includes from publisher_port_data.hpp - Removed TODO comment from subscriber_port_data.hpp and simplified aliases Benefits: - Reduces dependency issues between port data headers - Provides a single point of definition for pub/sub communication types - Improves code organization and discoverability - Consistent with client_server_port_types.hpp pattern Signed-off-by: Nivesh Dandyan <niveshdandyan@gmail.com>
1 parent ffd3610 commit d0f47ea

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

iceoryx_posh/include/iceoryx_posh/internal/popo/ports/pub_sub_port_types.hpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,45 @@
1717
#define IOX_POSH_POPO_PORTS_PUB_SUB_PORT_TYPES_HPP
1818

1919
#include "iceoryx_posh/iceoryx_posh_types.hpp"
20+
#include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.hpp"
2021
#include "iceoryx_posh/internal/popo/building_blocks/chunk_receiver_data.hpp"
22+
#include "iceoryx_posh/internal/popo/building_blocks/chunk_sender_data.hpp"
2123
#include "iceoryx_posh/internal/popo/building_blocks/locking_policy.hpp"
24+
#include "iceoryx_posh/popo/enum_trigger_type.hpp"
2225

2326
namespace iox
2427
{
2528
namespace popo
2629
{
27-
/// @todo iox-#1051 move definitions for publish subscribe communication here
30+
// ==================== Subscriber types ====================
2831

2932
using SubscriberChunkQueueData_t = ChunkQueueData<DefaultChunkQueueConfig, ThreadSafePolicy>;
3033

3134
using SubscriberChunkReceiverData_t =
3235
ChunkReceiverData<MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY, SubscriberChunkQueueData_t>;
3336

37+
// ==================== Publisher types ====================
38+
39+
using PublisherChunkQueueData_t = SubscriberChunkQueueData_t;
40+
41+
using PublisherChunkDistributorData_t =
42+
ChunkDistributorData<DefaultChunkDistributorConfig, ThreadSafePolicy, ChunkQueuePusher<PublisherChunkQueueData_t>>;
43+
44+
using PublisherChunkSenderData_t =
45+
ChunkSenderData<MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY, PublisherChunkDistributorData_t>;
46+
47+
// ==================== Event and State enums ====================
48+
49+
enum class SubscriberEvent : EventEnumIdentifier
50+
{
51+
DATA_RECEIVED
52+
};
53+
54+
enum class SubscriberState : StateEnumIdentifier
55+
{
56+
HAS_DATA
57+
};
58+
3459
} // namespace popo
3560
} // namespace iox
3661

iceoryx_posh/include/iceoryx_posh/internal/popo/ports/publisher_port_data.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
#include "iceoryx_posh/capro/service_description.hpp"
2121
#include "iceoryx_posh/iceoryx_posh_types.hpp"
2222
#include "iceoryx_posh/internal/mepoo/memory_manager.hpp"
23-
#include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.hpp"
24-
#include "iceoryx_posh/internal/popo/building_blocks/chunk_sender_data.hpp"
25-
#include "iceoryx_posh/internal/popo/building_blocks/locking_policy.hpp"
2623
#include "iceoryx_posh/internal/popo/ports/base_port_data.hpp"
27-
#include "iceoryx_posh/internal/popo/ports/subscriber_port_data.hpp"
24+
#include "iceoryx_posh/internal/popo/ports/pub_sub_port_types.hpp"
2825
#include "iceoryx_posh/mepoo/memory_info.hpp"
2926
#include "iceoryx_posh/popo/publisher_options.hpp"
3027
#include "iox/atomic.hpp"
@@ -44,11 +41,9 @@ struct PublisherPortData : public BasePortData
4441
const PublisherOptions& publisherOptions,
4542
const mepoo::MemoryInfo& memoryInfo = mepoo::MemoryInfo()) noexcept;
4643

47-
using ChunkQueueData_t = SubscriberPortData::ChunkQueueData_t;
48-
using ChunkDistributorData_t =
49-
ChunkDistributorData<DefaultChunkDistributorConfig, ThreadSafePolicy, ChunkQueuePusher<ChunkQueueData_t>>;
50-
using ChunkSenderData_t =
51-
ChunkSenderData<MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY, ChunkDistributorData_t>;
44+
using ChunkQueueData_t = PublisherChunkQueueData_t;
45+
using ChunkDistributorData_t = PublisherChunkDistributorData_t;
46+
using ChunkSenderData_t = PublisherChunkSenderData_t;
5247

5348
ChunkSenderData_t m_chunkSenderData;
5449

iceoryx_posh/include/iceoryx_posh/internal/popo/ports/subscriber_port_data.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ struct SubscriberPortData : public BasePortData
4040
const SubscriberOptions& subscriberOptions,
4141
const mepoo::MemoryInfo& memoryInfo = mepoo::MemoryInfo()) noexcept;
4242

43-
/// @todo iox-#1051 remove these aliases here and only depend on pub_sub_port_types.hpp
44-
/// (move relevant types and constants there)
45-
using ChunkQueueData_t = iox::popo::SubscriberChunkQueueData_t;
46-
using ChunkReceiverData_t = iox::popo::SubscriberChunkReceiverData_t;
43+
using ChunkQueueData_t = SubscriberChunkQueueData_t;
44+
using ChunkReceiverData_t = SubscriberChunkReceiverData_t;
4745

4846
ChunkReceiverData_t m_chunkReceiverData;
4947

0 commit comments

Comments
 (0)